diff --git a/.bzrignore b/.bzrignore index 35f5199be3c..9b90cd97d84 100644 --- a/.bzrignore +++ b/.bzrignore @@ -4,8 +4,6 @@ *.bb *.bbg *.bin -*.vcproj.cmake -cmake_install.cmake *.cdf *.core *.d @@ -33,6 +31,7 @@ cmake_install.cmake *.spec *.user *.vcproj +*.vcproj.cmake */*.dir/* */*_pure_*warnings */.deps @@ -347,6 +346,7 @@ client/tmp.diff client_debug/* client_release/* client_test +cmake_install.cmake cmd-line-utils/libedit/common.h cmd-line-utils/libedit/makelist comon.h @@ -366,6 +366,9 @@ contrib/*.vcproj core core.* core.2430 +cscope.in.out +cscope.out +cscope.po.out db-*.*.* dbug/*.ds? dbug/*.vcproj @@ -377,6 +380,8 @@ dbug/main.r dbug/output*.r dbug/user.ps dbug/user.t +debian/control +debian/defs.mk depcomp emacs.h examples/*.ds? @@ -413,6 +418,7 @@ heap/hp_test2 help help.c help.h +include/abi_check include/check_abi include/my_config.h include/my_global.h @@ -472,6 +478,7 @@ libmysql/release/libmysql.exp libmysql/vio_priv.h libmysql_r/*.c libmysql_r/acconfig.h +libmysql_r/client_settings.h libmysql_r/conf_to_src libmysql_r/my_static.h libmysql_r/mysys_priv.h @@ -1257,6 +1264,7 @@ support-files/mysql-3.23.29-gamma.spec support-files/mysql-log-rotate support-files/mysql.server support-files/mysql.spec +support-files/mysqld_multi.server support-files/ndb-config-2-node.ini tags test/ndbapi/bank/bankCreator @@ -1315,6 +1323,7 @@ test_xml tests/*.ds? tests/*.vcproj tests/.libs -prune +tests/bug25714 tests/client_test tests/connect_test tests/mysql_client_test @@ -1342,11 +1351,3 @@ win/vs71cache.txt win/vs8cache.txt zlib/*.ds? zlib/*.vcproj -debian/control -debian/defs.mk -include/abi_check -support-files/mysqld_multi.server -tests/bug25714 -cscope.in.out -cscope.out -cscope.po.out diff --git a/BitKeeper/triggers/pre-commit.check-case.pl b/BitKeeper/triggers/pre-commit.check-case.pl new file mode 100755 index 00000000000..4f68f8619e5 --- /dev/null +++ b/BitKeeper/triggers/pre-commit.check-case.pl @@ -0,0 +1,26 @@ +#!/usr/bin/perl +my $status = 0; + +my $pending = $ENV{'BK_PENDING'}; +exit 0 unless -f $pending; + +open FI, "<", $pending || exit 0; +while() { + my ($file, $stuff) = split /\|/, $_, 2; + next unless -f $file; + $file =~ s/^(.*)\/([^\/]*)$/$2/; + my $path = $1; + opendir DIR, $path; + my @files = sort map { lc } readdir DIR; + closedir DIR; + my %count = (); + $count{$_}++ for @files; + @files = grep { $count{$_} > 1 } keys %count; + if(@files > 0) { + print "$path/$file: duplicate file names: " . (join " ", @files) . "\n"; + $status = 1; + } +} +close FI; + +exit $status; diff --git a/CMakeLists.txt b/CMakeLists.txt index e2fb39fee9a..b7b546ab72c 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -109,6 +109,15 @@ IF(CMAKE_GENERATOR MATCHES "Visual Studio 7" OR STRING(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS_INIT ${CMAKE_CXX_FLAGS_INIT}) STRING(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS_DEBUG_INIT ${CMAKE_CXX_FLAGS_DEBUG_INIT}) + # Disable automatic manifest generation. + STRING(REPLACE "/MANIFEST" "/MANIFEST:NO" CMAKE_EXE_LINKER_FLAGS + ${CMAKE_EXE_LINKER_FLAGS}) + # Explicitly disable it since it is the default for newer versions of VS + STRING(REGEX MATCH "MANIFEST:NO" tmp_manifest ${CMAKE_EXE_LINKER_FLAGS}) + IF(NOT tmp_manifest) + SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /MANIFEST:NO") + ENDIF(NOT tmp_manifest) + ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 7" OR CMAKE_GENERATOR MATCHES "Visual Studio 8") @@ -156,14 +165,6 @@ IF(EMBED_MANIFESTS) MESSAGE(FATAL_ERROR "Sign tool, signtool.exe, can't be found.") ENDIF(HAVE_SIGN_TOOL) - # Disable automatic manifest generation. - STRING(REPLACE "/MANIFEST" "/MANIFEST:NO" CMAKE_EXE_LINKER_FLAGS - ${CMAKE_EXE_LINKER_FLAGS}) - # Explicitly disable it since it is the default for newer versions of VS - STRING(REGEX MATCH "MANIFEST:NO" tmp_manifest ${CMAKE_EXE_LINKER_FLAGS}) - IF(NOT tmp_manifest) - SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /MANIFEST:NO") - ENDIF(NOT tmp_manifest) # Set the processor architecture. IF(CMAKE_GENERATOR MATCHES "Visual Studio 8 2005 Win64") SET(PROCESSOR_ARCH "amd64") diff --git a/client/client_priv.h b/client/client_priv.h index 418bf86f2c8..8f509fa0763 100644 --- a/client/client_priv.h +++ b/client/client_priv.h @@ -51,5 +51,5 @@ enum options_client OPT_TRIGGERS, OPT_IGNORE_TABLE,OPT_INSERT_IGNORE,OPT_SHOW_WARNINGS,OPT_DROP_DATABASE, OPT_TZ_UTC, OPT_AUTO_CLOSE, OPT_SSL_VERIFY_SERVER_CERT, - OPT_DEBUG_INFO, OPT_ERROR_LOG_FILE + OPT_DEBUG_INFO, OPT_ERROR_LOG_FILE, OPT_DUMP_DATE }; diff --git a/client/mysql.cc b/client/mysql.cc index aa34c69b945..76ed10d9481 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -140,6 +140,7 @@ static my_bool info_flag=0,ignore_errors=0,wait_flag=0,quick=0, default_pager_set= 0, opt_sigint_ignore= 0, show_warnings= 0; static volatile int executing_query= 0, interrupted_query= 0; +static my_bool preserve_comments= 0; static ulong opt_max_allowed_packet, opt_net_buffer_length; static uint verbose=0,opt_silent=0,opt_mysql_port=0, opt_local_infile=0; static my_string opt_mysql_unix_port=0; @@ -759,6 +760,10 @@ static struct my_option my_long_options[] = {"show-warnings", OPT_SHOW_WARNINGS, "Show warnings after every statement.", (gptr*) &show_warnings, (gptr*) &show_warnings, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"comments", 'c', "Preserve comments. Send comments to the server." + " Comments are discarded by default, enable with --enable-comments", + (gptr*) &preserve_comments, (gptr*) &preserve_comments, + 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; @@ -1136,10 +1141,6 @@ static int read_and_execute(bool interactive) status.exit_status=0; break; } - if (!in_string && (line[0] == '#' || - (line[0] == '-' && line[1] == '-') || - line[0] == 0)) - continue; // Skip comment lines /* Check if line is a mysql command line @@ -1265,15 +1266,21 @@ static bool add_line(String &buffer,char *line,char *in_string, for (pos=out=line ; (inchar= (uchar) *pos) ; pos++) { - if (my_isspace(charset_info,inchar) && out == line && - buffer.is_empty()) - continue; + if (!preserve_comments) + { + // Skip spaces at the beggining of a statement + if (my_isspace(charset_info,inchar) && (out == line) && + buffer.is_empty()) + continue; + } + #ifdef USE_MB + // Accept multi-byte characters as-is int length; if (use_mb(charset_info) && (length= my_ismbchar(charset_info, pos, end_of_line))) { - if (!*ml_comment) + if (!*ml_comment || preserve_comments) { while (length--) *out++ = *pos++; @@ -1299,8 +1306,13 @@ static bool add_line(String &buffer,char *line,char *in_string, } if ((com=find_command(NullS,(char) inchar))) { - const String tmp(line,(uint) (out-line), charset_info); - buffer.append(tmp); + // Flush previously accepted characters + if (out != line) + { + buffer.append(line, (uint) (out-line)); + out= line; + } + if ((*com->func)(&buffer,pos-1) > 0) DBUG_RETURN(1); // Quit if (com->takes_params) @@ -1328,7 +1340,6 @@ static bool add_line(String &buffer,char *line,char *in_string, pos+= delimiter_length - 1; // Point at last delim char } } - out=line; } else { @@ -1341,46 +1352,105 @@ static bool add_line(String &buffer,char *line,char *in_string, } } else if (!*ml_comment && !*in_string && - (*pos == *delimiter && is_prefix(pos + 1, delimiter + 1) || - buffer.length() == 0 && (out - line) >= 9 && - !my_strcasecmp(charset_info, line, "delimiter"))) - { - uint old_delimiter_length= delimiter_length; + strlen(pos) >= 10 && + !my_strnncoll(charset_info, (uchar*) pos, 10, + (const uchar*) "delimiter ", 10)) + { + // Flush previously accepted characters if (out != line) - buffer.append(line, (uint) (out - line)); // Add this line + { + buffer.append(line, (uint32) (out - line)); + out= line; + } + + // Flush possible comments in the buffer + if (!buffer.is_empty()) + { + if (com_go(&buffer, 0) > 0) // < 0 is not fatal + DBUG_RETURN(1); + buffer.length(0); + } + + /* + Delimiter wants the get rest of the given line as argument to + allow one to change ';' to ';;' and back + */ + buffer.append(pos); + if (com_delimiter(&buffer, pos) > 0) + DBUG_RETURN(1); + + buffer.length(0); + break; + } + else if (!*ml_comment && !*in_string && is_prefix(pos, delimiter)) + { + // Found a statement. Continue parsing after the delimiter + pos+= delimiter_length; + + if (preserve_comments) + { + while (my_isspace(charset_info, *pos)) + *out++= *pos++; + } + // Flush previously accepted characters + if (out != line) + { + buffer.append(line, (uint32) (out-line)); + out= line; + } + + if (preserve_comments && ((*pos == '#') || + ((*pos == '-') && + (pos[1] == '-') && + my_isspace(charset_info, pos[2])))) + { + // Add trailing single line comments to this statement + buffer.append(pos); + pos+= strlen(pos); + } + + pos--; + if ((com= find_command(buffer.c_ptr(), 0))) { - if (com->func == com_delimiter) - { - /* - Delimiter wants the get rest of the given line as argument to - allow one to change ';' to ';;' and back - */ - char *end= strend(pos); - buffer.append(pos, (uint) (end - pos)); - /* Ensure pos will point at \0 after the pos+= below */ - pos= end - old_delimiter_length + 1; - } - if ((*com->func)(&buffer, buffer.c_ptr()) > 0) - DBUG_RETURN(1); // Quit + + if ((*com->func)(&buffer, buffer.c_ptr()) > 0) + DBUG_RETURN(1); // Quit } else { - if (com_go(&buffer, 0) > 0) // < 0 is not fatal - DBUG_RETURN(1); + if (com_go(&buffer, 0) > 0) // < 0 is not fatal + DBUG_RETURN(1); } buffer.length(0); - out= line; - pos+= old_delimiter_length - 1; } else if (!*ml_comment && (!*in_string && (inchar == '#' || inchar == '-' && pos[1] == '-' && my_isspace(charset_info,pos[2])))) - break; // comment to end of line + { + // Flush previously accepted characters + if (out != line) + { + buffer.append(line, (uint32) (out - line)); + out= line; + } + + // comment to end of line + if (preserve_comments) + buffer.append(pos); + + break; + } else if (!*in_string && inchar == '/' && *(pos+1) == '*' && *(pos+2) != '!') { - pos++; + if (preserve_comments) + { + *out++= *pos++; // copy '/' + *out++= *pos; // copy '*' + } + else + pos++; *ml_comment= 1; if (out != line) { @@ -1390,8 +1460,21 @@ static bool add_line(String &buffer,char *line,char *in_string, } else if (*ml_comment && !ss_comment && inchar == '*' && *(pos + 1) == '/') { - pos++; + if (preserve_comments) + { + *out++= *pos++; // copy '*' + *out++= *pos; // copy '/' + } + else + pos++; *ml_comment= 0; + if (out != line) + { + buffer.append(line, (uint32) (out - line)); + out= line; + } + // Consumed a 2 chars or more, and will add 1 at most, + // so using the 'line' buffer to edit data in place is ok. need_space= 1; } else @@ -1406,14 +1489,12 @@ static bool add_line(String &buffer,char *line,char *in_string, else if (!*ml_comment && !*in_string && (inchar == '\'' || inchar == '"' || inchar == '`')) *in_string= (char) inchar; - if (!*ml_comment) + if (!*ml_comment || preserve_comments) { if (need_space && !my_isspace(charset_info, (char)inchar)) - { *out++= ' '; - need_space= 0; - } - *out++= (char) inchar; + need_space= 0; + *out++= (char) inchar; } } } @@ -1423,7 +1504,7 @@ static bool add_line(String &buffer,char *line,char *in_string, uint length=(uint) (out-line); if (buffer.length() + length >= buffer.alloced_length()) buffer.realloc(buffer.length()+length+IO_SIZE); - if (!(*ml_comment) && buffer.append(line,length)) + if ((!*ml_comment || preserve_comments) && buffer.append(line, length)) DBUG_RETURN(1); } DBUG_RETURN(0); diff --git a/client/mysqldump.c b/client/mysqldump.c index 4916492201b..48145019446 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -89,7 +89,7 @@ static my_bool verbose= 0, opt_no_create_info= 0, opt_no_data= 0, opt_drop=1,opt_keywords=0,opt_lock=1,opt_compress=0, opt_delayed=0,create_options=1,opt_quoted=0,opt_databases=0, opt_alldbs=0,opt_create_db=0,opt_lock_all_tables=0, - opt_set_charset=0, + opt_set_charset=0, opt_dump_date=1, opt_autocommit=0,opt_disable_keys=1,opt_xml=0, opt_delete_master_logs=0, tty_password=0, opt_single_transaction=0, opt_comments= 0, opt_compact= 0, @@ -408,6 +408,9 @@ static struct my_option my_long_options[] = "automatically turns off --lock-tables.", (gptr*) &opt_single_transaction, (gptr*) &opt_single_transaction, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"dump-date", OPT_DUMP_DATE, "Put a dump date to the end of the output.", + (gptr*) &opt_dump_date, (gptr*) &opt_dump_date, 0, + GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, {"skip-opt", OPT_SKIP_OPTIMIZATION, "Disable --opt. Disables --add-drop-table, --add-locks, --create-options, --quick, --extended-insert, --lock-tables, --set-charset, and --disable-keys.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, @@ -629,10 +632,15 @@ static void write_footer(FILE *sql_file) fputs("\n", sql_file); if (opt_comments) { - char time_str[20]; - get_date(time_str, GETDATE_DATE_TIME, 0); - fprintf(sql_file, "-- Dump completed on %s\n", - time_str); + if (opt_dump_date) + { + char time_str[20]; + get_date(time_str, GETDATE_DATE_TIME, 0); + fprintf(sql_file, "-- Dump completed on %s\n", + time_str); + } + else + fprintf(sql_file, "-- Dump completed\n"); } check_io(sql_file); } diff --git a/cmd-line-utils/libedit/Makefile.am b/cmd-line-utils/libedit/Makefile.am index b7611193aea..bb4b40180d1 100644 --- a/cmd-line-utils/libedit/Makefile.am +++ b/cmd-line-utils/libedit/Makefile.am @@ -5,8 +5,7 @@ ASRC = $(srcdir)/vi.c $(srcdir)/emacs.c $(srcdir)/common.c AHDR = vi.h emacs.h common.h -# Make sure to include stuff from this directory first, to get right "config.h" -INCLUDES = -I. -I$(top_builddir)/include -I$(top_srcdir)/include +INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include noinst_LIBRARIES = libedit.a @@ -31,7 +30,14 @@ EXTRA_DIST = makelist.sh np/unvis.c np/strlcpy.c np/vis.c np/vis.h np/strlcat.c CLEANFILES = makelist common.h emacs.h vi.h fcns.h help.h fcns.c help.c -DEFS = -DUNDEF_THREADS_HACK -DHAVE_CONFIG_H -DNO_KILL_INTR +# Make sure to include stuff from this directory first, to get right "config.h" +# Automake puts into DEFAULT_INCLUDES this source and corresponding +# build directory together with ../../include to let all make files +# find the central "config.h". This variable is used before INCLUDES +# above. But in automake 1.10 the order of these are changed. Put the +# includes of this directory into DEFS to always be sure it is first +# before DEFAULT_INCLUDES on the compile line. +DEFS = -DUNDEF_THREADS_HACK -DHAVE_CONFIG_H -DNO_KILL_INTR -I. -I$(srcdir) SUFFIXES = .sh diff --git a/configure.in b/configure.in index 71d5988480e..c423bca3faa 100644 --- a/configure.in +++ b/configure.in @@ -124,6 +124,8 @@ case $MACHINE_TYPE in esac # Save some variables and the command line options for mysqlbug +SAVE_CC="$CC" +SAVE_CXX="$CXX" SAVE_ASFLAGS="$ASFLAGS" SAVE_CFLAGS="$CFLAGS" SAVE_CXXFLAGS="$CXXFLAGS" @@ -131,6 +133,8 @@ SAVE_LDFLAGS="$LDFLAGS" SAVE_CXXLDFLAGS="$CXXLDFLAGS" CONF_COMMAND="$0 $ac_configure_args" AC_SUBST(CONF_COMMAND) +AC_SUBST(SAVE_CC) +AC_SUBST(SAVE_CXX) AC_SUBST(SAVE_ASFLAGS) AC_SUBST(SAVE_CFLAGS) AC_SUBST(SAVE_CXXFLAGS) @@ -373,6 +377,7 @@ AC_SUBST(CC) AC_SUBST(CFLAGS) AC_SUBST(CXX) AC_SUBST(CXXFLAGS) +AC_SUBST(ASFLAGS) AC_SUBST(LD) AC_SUBST(INSTALL_SCRIPT) @@ -631,7 +636,7 @@ AC_SUBST(NOINST_LDFLAGS) if test "$TARGET_LINUX" = "true" -a "$static_nss" = "" then - tmp=`nm /usr/lib/libc.a | grep _nss_files_getaliasent_r` + tmp=`nm /usr/lib*/libc.a | grep _nss_files_getaliasent_r` if test -n "$tmp" then STATIC_NSS_FLAGS="-lc -lnss_files -lnss_dns -lresolv" diff --git a/include/config-win.h b/include/config-win.h index f0804a368bc..45bfeb5ba26 100644 --- a/include/config-win.h +++ b/include/config-win.h @@ -36,6 +36,7 @@ functions */ #include #include +#define BIG_TABLES 1 #define HAVE_SMEM 1 #if defined(_WIN64) || defined(WIN64) diff --git a/include/my_sys.h b/include/my_sys.h index d401cfca082..764326ac1bf 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -881,6 +881,8 @@ extern CHARSET_INFO *get_charset(uint cs_number, myf flags); extern CHARSET_INFO *get_charset_by_name(const char *cs_name, myf flags); extern CHARSET_INFO *get_charset_by_csname(const char *cs_name, uint cs_flags, myf my_flags); +extern CHARSET_INFO *get_compatible_charset_with_ctype(CHARSET_INFO + *original_cs); extern void free_charsets(void); extern char *get_charsets_dir(char *buf); extern my_bool my_charset_same(CHARSET_INFO *cs1, CHARSET_INFO *cs2); diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index c7bdfc4c42c..85509b49fdd 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -706,7 +706,8 @@ int cli_read_change_user_result(MYSQL *mysql, char *buff, const char *passwd) my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user, const char *passwd, const char *db) { - char buff[512],*end=buff; + char buff[USERNAME_LENGTH+SCRAMBLED_PASSWORD_CHAR_LENGTH+NAME_LEN+2]; + char *end= buff; int rc; DBUG_ENTER("mysql_change_user"); @@ -716,7 +717,7 @@ my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user, passwd=""; /* Store user into the buffer */ - end=strmov(end,user)+1; + end= strmake(end, user, USERNAME_LENGTH) + 1; /* write scrambled password according to server capabilities */ if (passwd[0]) @@ -736,7 +737,7 @@ my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user, else *end++= '\0'; /* empty password */ /* Add database if needed */ - end= strmov(end, db ? db : "") + 1; + end= strmake(end, db ? db : "", NAME_LEN) + 1; /* Write authentication package */ simple_command(mysql,COM_CHANGE_USER, buff,(ulong) (end-buff),1); @@ -4380,6 +4381,7 @@ static my_bool setup_one_fetch_function(MYSQL_BIND *param, MYSQL_FIELD *field) case MYSQL_TYPE_STRING: case MYSQL_TYPE_DECIMAL: case MYSQL_TYPE_NEWDECIMAL: + case MYSQL_TYPE_NEWDATE: DBUG_ASSERT(param->buffer_length != 0); param->fetch_result= fetch_result_str; break; @@ -4452,6 +4454,7 @@ static my_bool setup_one_fetch_function(MYSQL_BIND *param, MYSQL_FIELD *field) case MYSQL_TYPE_VAR_STRING: case MYSQL_TYPE_STRING: case MYSQL_TYPE_BIT: + case MYSQL_TYPE_NEWDATE: param->skip_result= skip_result_string; break; default: diff --git a/myisam/ft_parser.c b/myisam/ft_parser.c index 6d68542e4e2..1d3a19dd8c6 100644 --- a/myisam/ft_parser.c +++ b/myisam/ft_parser.c @@ -188,7 +188,7 @@ byte ft_simple_get_word(CHARSET_INFO *cs, byte **start, const byte *end, do { - for (;; doc+= mbl) + for (;; doc+= (mbl ? mbl : 1)) { if (doc >= end) DBUG_RETURN(0); if (true_word_char(cs, *doc)) break; diff --git a/myisam/mi_check.c b/myisam/mi_check.c index ed0a84e737d..ba308f75d24 100644 --- a/myisam/mi_check.c +++ b/myisam/mi_check.c @@ -1375,6 +1375,139 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend) } /* chk_data_link */ +/** + @brief Drop all indexes + + @param[in] param check parameters + @param[in] info MI_INFO handle + @param[in] force if to force drop all indexes + + @return status + @retval 0 OK + @retval != 0 Error + + @note + Once allocated, index blocks remain part of the key file forever. + When indexes are disabled, no block is freed. When enabling indexes, + no block is freed either. The new indexes are create from new + blocks. (Bug #4692) + + Before recreating formerly disabled indexes, the unused blocks + must be freed. There are two options to do this: + - Follow the tree of disabled indexes, add all blocks to the + deleted blocks chain. Would require a lot of random I/O. + - Drop all blocks by clearing all index root pointers and all + delete chain pointers and resetting key_file_length to the end + of the index file header. This requires to recreate all indexes, + even those that may still be intact. + The second method is probably faster in most cases. + + When disabling indexes, MySQL disables either all indexes or all + non-unique indexes. When MySQL [re-]enables disabled indexes + (T_CREATE_MISSING_KEYS), then we either have "lost" blocks in the + index file, or there are no non-unique indexes. In the latter case, + mi_repair*() would not be called as there would be no disabled + indexes. + + If there would be more unique indexes than disabled (non-unique) + indexes, we could do the first method. But this is not implemented + yet. By now we drop and recreate all indexes when repair is called. + + However, there is an exception. Sometimes MySQL disables non-unique + indexes when the table is empty (e.g. when copying a table in + mysql_alter_table()). When enabling the non-unique indexes, they + are still empty. So there is no index block that can be lost. This + optimization is implemented in this function. + + Note that in normal repair (T_CREATE_MISSING_KEYS not set) we + recreate all enabled indexes unconditonally. We do not change the + key_map. Otherwise we invert the key map temporarily (outside of + this function) and recreate the then "seemingly" enabled indexes. + When we cannot use the optimization, and drop all indexes, we + pretend that all indexes were disabled. By the inversion, we will + then recrate all indexes. +*/ + +static int mi_drop_all_indexes(MI_CHECK *param, MI_INFO *info, my_bool force) +{ + MYISAM_SHARE *share= info->s; + MI_STATE_INFO *state= &share->state; + uint i; + int error; + DBUG_ENTER("mi_drop_all_indexes"); + + /* + If any of the disabled indexes has a key block assigned, we must + drop and recreate all indexes to avoid losing index blocks. + + If we want to recreate disabled indexes only _and_ all of these + indexes are empty, we don't need to recreate the existing indexes. + */ + if (!force && (param->testflag & T_CREATE_MISSING_KEYS)) + { + DBUG_PRINT("repair", ("creating missing indexes")); + for (i= 0; i < share->base.keys; i++) + { + DBUG_PRINT("repair", ("index #: %u key_root: 0x%lx active: %d", + i, (long) state->key_root[i], + mi_is_key_active(state->key_map, i))); + if ((state->key_root[i] != HA_OFFSET_ERROR) && + !mi_is_key_active(state->key_map, i)) + { + /* + This index has at least one key block and it is disabled. + We would lose its block(s) if would just recreate it. + So we need to drop and recreate all indexes. + */ + DBUG_PRINT("repair", ("nonempty and disabled: recreate all")); + break; + } + } + if (i >= share->base.keys) + { + /* + All of the disabled indexes are empty. We can just recreate them. + Flush dirty blocks of this index file from key cache and remove + all blocks of this index file from key cache. + */ + DBUG_PRINT("repair", ("all disabled are empty: create missing")); + error= flush_key_blocks(share->key_cache, share->kfile, + FLUSH_FORCE_WRITE); + goto end; + } + /* + We do now drop all indexes and declare them disabled. With the + T_CREATE_MISSING_KEYS flag, mi_repair*() will recreate all + disabled indexes and enable them. + */ + mi_clear_all_keys_active(state->key_map); + DBUG_PRINT("repair", ("declared all indexes disabled")); + } + + /* Remove all key blocks of this index file from key cache. */ + if ((error= flush_key_blocks(share->key_cache, share->kfile, + FLUSH_IGNORE_CHANGED))) + goto end; + + /* Clear index root block pointers. */ + for (i= 0; i < share->base.keys; i++) + state->key_root[i]= HA_OFFSET_ERROR; + + /* Clear the delete chains. */ + for (i= 0; i < state->header.max_block_size; i++) + state->key_del[i]= HA_OFFSET_ERROR; + + /* Reset index file length to end of index file header. */ + info->state->key_file_length= share->base.keystart; + + DBUG_PRINT("repair", ("dropped all indexes")); + /* error= 0; set by last (error= flush_key_bocks()). */ + + end: + DBUG_RETURN(error); +} + + /* Recover old table by reading each record and writing all keys */ /* Save new datafile-name in temp_filename */ @@ -1382,7 +1515,6 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info, my_string name, int rep_quick) { int error,got_error; - uint i; ha_rows start_records,new_header_length; my_off_t del; File new_file; @@ -1486,25 +1618,10 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info, info->update= (short) (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED); - /* - Clear all keys. Note that all key blocks allocated until now remain - "dead" parts of the key file. (Bug #4692) - */ - for (i=0 ; i < info->s->base.keys ; i++) - share->state.key_root[i]= HA_OFFSET_ERROR; - - /* Drop the delete chain. */ - for (i=0 ; i < share->state.header.max_block_size ; i++) - share->state.key_del[i]= HA_OFFSET_ERROR; - - /* - If requested, activate (enable) all keys in key_map. In this case, - all indexes will be (re-)built. - */ + /* This function always recreates all enabled indexes. */ if (param->testflag & T_CREATE_MISSING_KEYS) mi_set_all_keys_active(share->state.key_map, share->base.keys); - - info->state->key_file_length=share->base.keystart; + mi_drop_all_indexes(param, info, TRUE); lock_memory(param); /* Everything is alloced */ @@ -2105,8 +2222,9 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info, ulong *rec_per_key_part; char llbuff[22]; SORT_INFO sort_info; - ulonglong key_map=share->state.key_map; + ulonglong key_map; DBUG_ENTER("mi_repair_by_sort"); + LINT_INIT(key_map); start_records=info->state->records; got_error=1; @@ -2179,25 +2297,14 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info, } info->update= (short) (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED); - if (!(param->testflag & T_CREATE_MISSING_KEYS)) + + /* Optionally drop indexes and optionally modify the key_map. */ + mi_drop_all_indexes(param, info, FALSE); + key_map= share->state.key_map; + if (param->testflag & T_CREATE_MISSING_KEYS) { - /* - Flush key cache for this file if we are calling this outside - myisamchk - */ - flush_key_blocks(share->key_cache,share->kfile, FLUSH_IGNORE_CHANGED); - /* Clear the pointers to the given rows */ - for (i=0 ; i < share->base.keys ; i++) - share->state.key_root[i]= HA_OFFSET_ERROR; - for (i=0 ; i < share->state.header.max_block_size ; i++) - share->state.key_del[i]= HA_OFFSET_ERROR; - info->state->key_file_length=share->base.keystart; - } - else - { - if (flush_key_blocks(share->key_cache,share->kfile, FLUSH_FORCE_WRITE)) - goto err; - key_map= ~key_map; /* Create the missing keys */ + /* Invert the copied key_map to recreate all disabled indexes. */ + key_map= ~key_map; } sort_info.info=info; @@ -2240,6 +2347,10 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info, sort_param.read_cache=param->read_cache; sort_param.keyinfo=share->keyinfo+sort_param.key; sort_param.seg=sort_param.keyinfo->seg; + /* + Skip this index if it is marked disabled in the copied + (and possibly inverted) key_map. + */ if (! mi_is_key_active(key_map, sort_param.key)) { /* Remember old statistics for key */ @@ -2247,6 +2358,8 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info, (char*) (share->state.rec_per_key_part + (uint) (rec_per_key_part - param->rec_per_key_part)), sort_param.keyinfo->keysegs*sizeof(*rec_per_key_part)); + DBUG_PRINT("repair", ("skipping seemingly disabled index #: %u", + sort_param.key)); continue; } @@ -2302,8 +2415,11 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info, if (param->testflag & T_STATISTICS) update_key_parts(sort_param.keyinfo, rec_per_key_part, sort_param.unique, param->stats_method == MI_STATS_METHOD_IGNORE_NULLS? - sort_param.notnull: NULL,(ulonglong) info->state->records); + sort_param.notnull: NULL, + (ulonglong) info->state->records); + /* Enable this index in the permanent (not the copied) key_map. */ mi_set_key_active(share->state.key_map, sort_param.key); + DBUG_PRINT("repair", ("set enabled index #: %u", sort_param.key)); if (sort_param.fix_datafile) { @@ -2504,9 +2620,10 @@ int mi_repair_parallel(MI_CHECK *param, register MI_INFO *info, IO_CACHE new_data_cache; /* For non-quick repair. */ IO_CACHE_SHARE io_share; SORT_INFO sort_info; - ulonglong key_map=share->state.key_map; + ulonglong key_map; pthread_attr_t thr_attr; DBUG_ENTER("mi_repair_parallel"); + LINT_INIT(key_map); start_records=info->state->records; got_error=1; @@ -2608,25 +2725,14 @@ int mi_repair_parallel(MI_CHECK *param, register MI_INFO *info, } info->update= (short) (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED); - if (!(param->testflag & T_CREATE_MISSING_KEYS)) + + /* Optionally drop indexes and optionally modify the key_map. */ + mi_drop_all_indexes(param, info, FALSE); + key_map= share->state.key_map; + if (param->testflag & T_CREATE_MISSING_KEYS) { - /* - Flush key cache for this file if we are calling this outside - myisamchk - */ - flush_key_blocks(share->key_cache,share->kfile, FLUSH_IGNORE_CHANGED); - /* Clear the pointers to the given rows */ - for (i=0 ; i < share->base.keys ; i++) - share->state.key_root[i]= HA_OFFSET_ERROR; - for (i=0 ; i < share->state.header.max_block_size ; i++) - share->state.key_del[i]= HA_OFFSET_ERROR; - info->state->key_file_length=share->base.keystart; - } - else - { - if (flush_key_blocks(share->key_cache,share->kfile, FLUSH_FORCE_WRITE)) - goto err; - key_map= ~key_map; /* Create the missing keys */ + /* Invert the copied key_map to recreate all disabled indexes. */ + key_map= ~key_map; } sort_info.info=info; @@ -2682,6 +2788,10 @@ int mi_repair_parallel(MI_CHECK *param, register MI_INFO *info, sort_param[i].key=key; sort_param[i].keyinfo=share->keyinfo+key; sort_param[i].seg=sort_param[i].keyinfo->seg; + /* + Skip this index if it is marked disabled in the copied + (and possibly inverted) key_map. + */ if (! mi_is_key_active(key_map, key)) { /* Remember old statistics for key */ diff --git a/myisam/mi_dynrec.c b/myisam/mi_dynrec.c index 11f51f08d23..67d40ec50bf 100644 --- a/myisam/mi_dynrec.c +++ b/myisam/mi_dynrec.c @@ -144,6 +144,29 @@ static int write_dynamic_record(MI_INFO *info, const byte *record, DBUG_ENTER("write_dynamic_record"); flag=0; + + /* + Check if we have enough room for the new record. + First we do simplified check to make usual case faster. + Then we do more precise check for the space left. + Though it still is not absolutely precise, as + we always use MI_MAX_DYN_BLOCK_HEADER while it can be + less in the most of the cases. + */ + + if (unlikely(info->s->base.max_data_file_length - + info->state->data_file_length < + reclength + MI_MAX_DYN_BLOCK_HEADER)) + { + if (info->s->base.max_data_file_length - info->state->data_file_length + + info->state->empty - info->state->del * MI_MAX_DYN_BLOCK_HEADER < + reclength + MI_MAX_DYN_BLOCK_HEADER) + { + my_errno=HA_ERR_RECORD_FILE_FULL; + DBUG_RETURN(1); + } + } + do { if (_mi_find_writepos(info,reclength,&filepos,&length)) @@ -580,6 +603,51 @@ static int update_dynamic_record(MI_INFO *info, my_off_t filepos, byte *record, DBUG_ENTER("update_dynamic_record"); flag=block_info.second_read=0; + /* + Check if we have enough room for the record. + First we do simplified check to make usual case faster. + Then we do more precise check for the space left. + Though it still is not absolutely precise, as + we always use MI_MAX_DYN_BLOCK_HEADER while it can be + less in the most of the cases. + */ + + /* + compare with just the reclength as we're going + to get some space from the old replaced record + */ + if (unlikely(info->s->base.max_data_file_length - + info->state->data_file_length < reclength)) + { + /* + let's read the old record's block to find out the length of the + old record + */ + if ((error=_mi_get_block_info(&block_info,info->dfile,filepos)) + & (BLOCK_DELETED | BLOCK_ERROR | BLOCK_SYNC_ERROR | BLOCK_FATAL_ERROR)) + { + DBUG_PRINT("error",("Got wrong block info")); + if (!(error & BLOCK_FATAL_ERROR)) + my_errno=HA_ERR_WRONG_IN_RECORD; + goto err; + } + + /* + if new record isn't longer, we can go on safely + */ + if (block_info.rec_len < reclength) + { + if (info->s->base.max_data_file_length - info->state->data_file_length + + info->state->empty - info->state->del * MI_MAX_DYN_BLOCK_HEADER < + reclength - block_info.rec_len + MI_MAX_DYN_BLOCK_HEADER) + { + my_errno=HA_ERR_RECORD_FILE_FULL; + goto err; + } + } + block_info.second_read=0; + } + while (reclength > 0) { if (filepos != info->s->state.dellink) diff --git a/myisam/mi_write.c b/myisam/mi_write.c index cc17d4c6165..967fbdc2330 100644 --- a/myisam/mi_write.c +++ b/myisam/mi_write.c @@ -975,7 +975,7 @@ int mi_init_bulk_insert(MI_INFO *info, ulong cache_size, ha_rows rows) DBUG_RETURN(0); if (rows && rows*total_keylength < cache_size) - cache_size=rows; + cache_size= (ulong)rows; else cache_size/=total_keylength*16; diff --git a/myisam/rt_index.c b/myisam/rt_index.c index cf144839dd1..8ecb3688ad5 100644 --- a/myisam/rt_index.c +++ b/myisam/rt_index.c @@ -483,15 +483,16 @@ static uchar *rtree_pick_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key, uint key_length, uchar *page_buf, uint nod_flag) { double increase; - double best_incr = DBL_MAX; + double best_incr; double area; double best_area; - uchar *best_key; + uchar *best_key= NULL; uchar *k = rt_PAGE_FIRST_KEY(page_buf, nod_flag); uchar *last = rt_PAGE_END(page_buf); LINT_INIT(best_area); LINT_INIT(best_key); + LINT_INIT(best_incr); for (; k < last; k = rt_PAGE_NEXT_KEY(k, key_length, nod_flag)) { @@ -500,22 +501,13 @@ static uchar *rtree_pick_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key, &area)) == -1.0) return NULL; /* The following should be safe, even if we compare doubles */ - if (increase < best_incr) + if (!best_key || increase < best_incr || + ((increase == best_incr) && (area < best_area))) { best_key = k; best_area = area; best_incr = increase; } - else - { - /* The following should be safe, even if we compare doubles */ - if ((increase == best_incr) && (area < best_area)) - { - best_key = k; - best_area = area; - best_incr = increase; - } - } } return best_key; } diff --git a/myisam/rt_mbr.c b/myisam/rt_mbr.c index 1855e24feb0..deca23bbec7 100644 --- a/myisam/rt_mbr.c +++ b/myisam/rt_mbr.c @@ -523,7 +523,10 @@ double rtree_overlapping_area(HA_KEYSEG *keyseg, uchar* a, uchar* b, } /* -Calculates MBR_AREA(a+b) - MBR_AREA(a) + Calculates MBR_AREA(a+b) - MBR_AREA(a) + Note: when 'a' and 'b' objects are far from each other, + the area increase can be really big, so this function + can return 'inf' as a result. */ double rtree_area_increase(HA_KEYSEG *keyseg, uchar* a, uchar* b, uint key_length, double *ab_area) diff --git a/myisam/sort.c b/myisam/sort.c index b6cc8e8c2e0..2465227a449 100644 --- a/myisam/sort.c +++ b/myisam/sort.c @@ -141,7 +141,7 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages, if ((records < UINT_MAX32) && ((my_off_t) (records + 1) * (sort_length + sizeof(char*)) <= (my_off_t) memavl)) - keys= records+1; + keys= (uint)records+1; else do { @@ -349,7 +349,7 @@ pthread_handler_t thr_find_all_keys(void *arg) sort_keys= (uchar **) NULL; memavl= max(sort_param->sortbuff_size, MIN_SORT_MEMORY); - idx= sort_param->sort_info->max_records; + idx= (uint)sort_param->sort_info->max_records; sort_length= sort_param->key_length; maxbuffer= 1; diff --git a/mysql-test/include/gis_keys.inc b/mysql-test/include/gis_keys.inc new file mode 100644 index 00000000000..c75311f062a --- /dev/null +++ b/mysql-test/include/gis_keys.inc @@ -0,0 +1,46 @@ +--source include/have_geometry.inc + +# +# Spatial objects with keys +# + +# +# Bug #30825: Problems when putting a non-spatial index on a GIS column +# + +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)')); + +# no index, returns 1 as expected +SELECT COUNT(*) FROM t1 WHERE p=POINTFROMTEXT('POINT(1 2)'); + +# with index, returns 1 as expected +# EXPLAIN shows that the index is not used though +# due to the "most rows covered anyway, so a scan is more effective" rule +EXPLAIN +SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); +SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); + +# adding another row to the table so that +# the "most rows covered" rule doesn't kick in anymore +# now EXPLAIN shows the index used on the table +# and we're getting the wrong result again +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)'); +SELECT COUNT(*) FROM t1 WHERE p=POINTFROMTEXT('POINT(1 2)'); + +EXPLAIN +SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); +SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); + +EXPLAIN +SELECT COUNT(*) FROM t2 IGNORE INDEX(p) WHERE p=POINTFROMTEXT('POINT(1 2)'); +SELECT COUNT(*) FROM t2 IGNORE INDEX(p) WHERE p=POINTFROMTEXT('POINT(1 2)'); + +DROP TABLE t1, t2; + +--echo End of 5.0 tests diff --git a/mysql-test/r/almost_full.result b/mysql-test/r/almost_full.result new file mode 100644 index 00000000000..eb28f12fa51 --- /dev/null +++ b/mysql-test/r/almost_full.result @@ -0,0 +1,29 @@ +drop table if exists t1; +set global myisam_data_pointer_size=2; +CREATE TABLE t1 (a int auto_increment primary key not null, b longtext) ENGINE=MyISAM; +DELETE FROM t1 WHERE a=1 or a=5; +INSERT INTO t1 SET b=repeat('a',600); +ERROR HY000: The table 't1' is full +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check warning Datafile is almost full, 65448 of 65534 used +test.t1 check status OK +UPDATE t1 SET b=repeat('a', 800) where a=10; +ERROR HY000: The table 't1' is full +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check warning Datafile is almost full, 65448 of 65534 used +test.t1 check status OK +INSERT INTO t1 SET b=repeat('a',400); +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check warning Datafile is almost full, 65448 of 65534 used +test.t1 check status OK +DELETE FROM t1 WHERE a=2 or a=6; +UPDATE t1 SET b=repeat('a', 600) where a=11; +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check warning Datafile is almost full, 65448 of 65534 used +test.t1 check status OK +drop table t1; +set global myisam_data_pointer_size=default; diff --git a/mysql-test/r/bdb_gis.result b/mysql-test/r/bdb_gis.result index d48b5a26e1d..6651421b51c 100644 --- a/mysql-test/r/bdb_gis.result +++ b/mysql-test/r/bdb_gis.result @@ -542,3 +542,42 @@ 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 ALL p NULL NULL NULL 2 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 diff --git a/mysql-test/r/cast.result b/mysql-test/r/cast.result index 524ff48d69e..88601eceb0a 100644 --- a/mysql-test/r/cast.result +++ b/mysql-test/r/cast.result @@ -414,4 +414,28 @@ NULL NULL 20070719 drop table t1; +CREATE TABLE t1 (f1 DATE); +INSERT INTO t1 VALUES ('2007-07-19'), (NULL); +SELECT HOUR(f1), +MINUTE(f1), +SECOND(f1) FROM t1; +HOUR(f1) MINUTE(f1) SECOND(f1) +0 0 0 +NULL NULL NULL +SELECT HOUR(CAST('2007-07-19' AS DATE)), +MINUTE(CAST('2007-07-19' AS DATE)), +SECOND(CAST('2007-07-19' AS DATE)); +HOUR(CAST('2007-07-19' AS DATE)) MINUTE(CAST('2007-07-19' AS DATE)) SECOND(CAST('2007-07-19' AS DATE)) +0 0 0 +SELECT HOUR(CAST(NULL AS DATE)), +MINUTE(CAST(NULL AS DATE)), +SECOND(CAST(NULL AS DATE)); +HOUR(CAST(NULL AS DATE)) MINUTE(CAST(NULL AS DATE)) SECOND(CAST(NULL AS DATE)) +NULL NULL NULL +SELECT HOUR(NULL), +MINUTE(NULL), +SECOND(NULL); +HOUR(NULL) MINUTE(NULL) SECOND(NULL) +NULL NULL NULL +DROP TABLE t1; End of 5.0 tests diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index ab5d23d6cea..3d7486b6ba2 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -425,7 +425,7 @@ explain t2; Field Type Null Key Default Extra a int(11) YES NULL b bigint(11) NO 0 -c bigint(11) NO 0 +c bigint(11) unsigned NO 0 d date YES NULL e varchar(1) NO f datetime YES NULL diff --git a/mysql-test/r/csv.result b/mysql-test/r/csv.result index 3900597d2a6..dca4e349c8a 100644 --- a/mysql-test/r/csv.result +++ b/mysql-test/r/csv.result @@ -5029,4 +5029,46 @@ F7 FE þ LATIN SMALL LETTER THORN FF ÿ LATIN SMALL LETTER Y WITH DIAERESIS drop table t1; +create table t1(a datetime) engine=csv; +insert into t1 values(); +select * from t1; +a +0000-00-00 00:00:00 +drop table t1; +create table t1(a set('foo','bar')) engine=csv; +insert into t1 values(); +select * from t1; +a + +drop table t1; +create table t1(a varchar(32)) engine=csv; +insert into t1 values(); +select * from t1; +a + +drop table t1; +create table t1(a int) engine=csv; +insert into t1 values(); +select * from t1; +a +0 +drop table t1; +create table t1(a blob) engine=csv; +insert into t1 values(); +select * from t1; +a + +drop table t1; +create table t1(a bit(1)) engine=csv; +insert into t1 values(); +select BIN(a) from t1; +BIN(a) +0 +drop table t1; +create table t1(a enum('foo','bar') default 'foo') engine=csv; +insert into t1 values(); +select * from t1; +a +foo +drop table t1; End of 5.0 tests diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result index cd734ff9d23..a7d7f11828b 100644 --- a/mysql-test/r/ctype_ucs.result +++ b/mysql-test/r/ctype_ucs.result @@ -811,6 +811,12 @@ quote(name) ???????? ???????????????? drop table bug20536; +CREATE TABLE t1(a TEXT CHARSET ucs2 COLLATE ucs2_unicode_ci); +INSERT INTO t1 VALUES('abcd'); +SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abcd' IN BOOLEAN MODE); +a +abcd +DROP TABLE t1; set names ucs2; ERROR 42000: Variable 'character_set_client' can't be set to the value of 'ucs2' set names ucs2 collate ucs2_bin; @@ -930,4 +936,7 @@ ERROR HY000: Illegal mix of collations (ascii_general_ci,IMPLICIT) and (ucs2_gen select * from t1 where a=if(b<10,_ucs2 0x0062,_ucs2 0x00C0); ERROR HY000: Illegal mix of collations (ascii_general_ci,IMPLICIT) and (ucs2_general_ci,COERCIBLE) for operation '=' drop table t1; +select hex(char(0x41 using ucs2)); +hex(char(0x41 using ucs2)) +0041 End of 5.0 tests diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result index 710cac388a5..4a15da71ee2 100644 --- a/mysql-test/r/ctype_utf8.result +++ b/mysql-test/r/ctype_utf8.result @@ -1538,12 +1538,12 @@ char(53647 using utf8) Ñ select char(0xff,0x8f using utf8); char(0xff,0x8f using utf8) -ÿ + Warnings: Warning 1300 Invalid utf8 character string: 'FF8F' select convert(char(0xff,0x8f) using utf8); convert(char(0xff,0x8f) using utf8) -ÿ + Warnings: Warning 1300 Invalid utf8 character string: 'FF8F' set sql_mode=traditional; @@ -1730,3 +1730,41 @@ i 1 н1234567890 DROP TABLE t1, t2; +set sql_mode=traditional; +select hex(char(0xFF using utf8)); +hex(char(0xFF using utf8)) +NULL +Warnings: +Error 1300 Invalid utf8 character string: 'FF' +select hex(convert(0xFF using utf8)); +hex(convert(0xFF using utf8)) +NULL +Warnings: +Error 1300 Invalid utf8 character string: 'FF' +select hex(_utf8 0x616263FF); +ERROR HY000: Invalid utf8 character string: 'FF' +select hex(_utf8 X'616263FF'); +ERROR HY000: Invalid utf8 character string: 'FF' +select hex(_utf8 B'001111111111'); +ERROR HY000: Invalid utf8 character string: 'FF' +select (_utf8 X'616263FF'); +ERROR HY000: Invalid utf8 character string: 'FF' +set sql_mode=default; +select hex(char(0xFF using utf8)); +hex(char(0xFF using utf8)) + +Warnings: +Warning 1300 Invalid utf8 character string: 'FF' +select hex(convert(0xFF using utf8)); +hex(convert(0xFF using utf8)) + +Warnings: +Warning 1300 Invalid utf8 character string: 'FF' +select hex(_utf8 0x616263FF); +ERROR HY000: Invalid utf8 character string: 'FF' +select hex(_utf8 X'616263FF'); +ERROR HY000: Invalid utf8 character string: 'FF' +select hex(_utf8 B'001111111111'); +ERROR HY000: Invalid utf8 character string: 'FF' +select (_utf8 X'616263FF'); +ERROR HY000: Invalid utf8 character string: 'FF' diff --git a/mysql-test/r/date_formats.result b/mysql-test/r/date_formats.result index d62c865bb3c..6833a7f1594 100644 --- a/mysql-test/r/date_formats.result +++ b/mysql-test/r/date_formats.result @@ -481,7 +481,7 @@ str_to_date(a,b) create table t2 select str_to_date(a,b) from t1; describe t2; Field Type Null Key Default Extra -str_to_date(a,b) binary(29) YES NULL +str_to_date(a,b) datetime YES NULL select str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%S.%f") as f1, str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%S") as f2, str_to_date("2003-01-02", "%Y-%m-%d") as f3, diff --git a/mysql-test/r/delete.result b/mysql-test/r/delete.result index 5084498c01c..eb93c69d960 100644 --- a/mysql-test/r/delete.result +++ b/mysql-test/r/delete.result @@ -271,3 +271,11 @@ a DROP TABLE t1, t2; DROP DATABASE db1; DROP DATABASE db2; +CREATE FUNCTION f1() RETURNS INT RETURN 1; +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (0); +DELETE FROM t1 ORDER BY (f1(10)) LIMIT 1; +ERROR 42000: Incorrect number of arguments for FUNCTION test.f1; expected 0, got 1 +DROP TABLE t1; +DROP FUNCTION f1; +End of 5.0 tests diff --git a/mysql-test/r/derived.result b/mysql-test/r/derived.result index 3a098308b49..81502c7b430 100644 --- a/mysql-test/r/derived.result +++ b/mysql-test/r/derived.result @@ -326,7 +326,8 @@ id select_type table type possible_keys key key_len ref rows Extra 2 DERIVED t2 index PRIMARY PRIMARY 4 NULL 2 Using where; Using index drop table t2; CREATE TABLE `t1` ( `itemid` int(11) NOT NULL default '0', `grpid` varchar(15) NOT NULL default '', `vendor` int(11) NOT NULL default '0', `date_` date NOT NULL default '0000-00-00', `price` decimal(12,2) NOT NULL default '0.00', PRIMARY KEY (`itemid`,`grpid`,`vendor`,`date_`), KEY `itemid` (`itemid`,`vendor`), KEY `itemid_2` (`itemid`,`date_`)); -insert into t1 values (128, 'rozn', 2, now(), 10),(128, 'rozn', 1, now(), 10); +insert into t1 values (128, 'rozn', 2, curdate(), 10), +(128, 'rozn', 1, curdate(), 10); SELECT MIN(price) min, MAX(price) max, AVG(price) avg FROM (SELECT SUBSTRING( MAX(concat(date_,";",price)), 12) price FROM t1 WHERE itemid=128 AND grpid='rozn' GROUP BY itemid, grpid, vendor) lastprices; min max avg 10.00 10.00 10 diff --git a/mysql-test/r/fulltext.result b/mysql-test/r/fulltext.result index f6efe2411c0..29fb430bb97 100644 --- a/mysql-test/r/fulltext.result +++ b/mysql-test/r/fulltext.result @@ -463,3 +463,9 @@ ALTER TABLE t1 DISABLE KEYS; SELECT * FROM t1 WHERE MATCH(a) AGAINST('test'); ERROR HY000: Can't find FULLTEXT index matching the column list DROP TABLE t1; +CREATE TABLE t1(a TEXT); +INSERT INTO t1 VALUES(' aaaaa aaaa'); +SELECT * FROM t1 WHERE MATCH(a) AGAINST ('"aaaa"' IN BOOLEAN MODE); +a + aaaaa aaaa +DROP TABLE t1; diff --git a/mysql-test/r/func_gconcat.result b/mysql-test/r/func_gconcat.result index 73f756bc1d2..df61954b22a 100644 --- a/mysql-test/r/func_gconcat.result +++ b/mysql-test/r/func_gconcat.result @@ -861,4 +861,13 @@ select group_concat(distinct a, c order by a desc, c desc) from t1; group_concat(distinct a, c order by a desc, c desc) 31,11,10,01,00 drop table t1; +create table t1 (f1 char(20)); +insert into t1 values (''),(''); +select group_concat(distinct f1) from t1; +group_concat(distinct f1) + +select group_concat(f1) from t1; +group_concat(f1) +, +drop table t1; End of 5.0 tests diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result index e5720cc1ee0..1e130877088 100644 --- a/mysql-test/r/func_group.result +++ b/mysql-test/r/func_group.result @@ -1377,4 +1377,34 @@ SELECT MIN(a), MIN(b) FROM t5 WHERE a = 1 and b > 1; MIN(a) MIN(b) 1 2 DROP TABLE t1, t2, t3, t4, t5; +CREATE TABLE t1 (a INT); +INSERT INTO t1 values (),(),(); +SELECT (SELECT SLEEP(0) FROM t1 ORDER BY AVG(DISTINCT a) ) as x FROM t1 +GROUP BY x; +x +0 +SELECT 1 FROM t1 GROUP BY (SELECT SLEEP(0) FROM t1 ORDER BY AVG(DISTINCT a) ); +1 +1 +DROP TABLE t1; +CREATE TABLE t1 (a int, b date NOT NULL, KEY k1 (a,b)); +SELECT MIN(b) FROM t1 WHERE a=1 AND b>'2007-08-01'; +MIN(b) +NULL +DROP TABLE t1; +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2),(3),(4); +SET SQL_MODE=ONLY_FULL_GROUP_BY; +SELECT a FROM t1 HAVING COUNT(*)>2; +ERROR 42000: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause +SELECT COUNT(*), a FROM t1; +ERROR 42000: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause +SET SQL_MODE=DEFAULT; +SELECT a FROM t1 HAVING COUNT(*)>2; +a +1 +SELECT COUNT(*), a FROM t1; +COUNT(*) a +4 1 +DROP TABLE t1; End of 5.0 tests diff --git a/mysql-test/r/func_math.result b/mysql-test/r/func_math.result index ace94217fdc..150b6003dbe 100644 --- a/mysql-test/r/func_math.result +++ b/mysql-test/r/func_math.result @@ -322,4 +322,42 @@ mod(5, cast(-2 as unsigned)) mod(5, 18446744073709551614) mod(5, -2) select pow(cast(-2 as unsigned), 5), pow(18446744073709551614, 5), pow(-2, 5); pow(cast(-2 as unsigned), 5) pow(18446744073709551614, 5) pow(-2, 5) 2.1359870359209e+96 2.1359870359209e+96 -32 +CREATE TABLE t1 (a timestamp, b varchar(20), c bit(1)); +INSERT INTO t1 VALUES('1998-09-23', 'str1', 1), ('2003-03-25', 'str2', 0); +SELECT a DIV 900 y FROM t1 GROUP BY y; +y +22201025555 +22255916666 +SELECT DISTINCT a DIV 900 y FROM t1; +y +22201025555 +22255916666 +SELECT b DIV 900 y FROM t1 GROUP BY y; +y +0 +SELECT c DIV 900 y FROM t1 GROUP BY y; +y +0 +DROP TABLE t1; +CREATE TABLE t1(a LONGBLOB); +INSERT INTO t1 VALUES('1'),('2'),('3'); +SELECT DISTINCT (a DIV 254576881) FROM t1; +(a DIV 254576881) +0 +SELECT (a DIV 254576881) FROM t1 UNION ALL +SELECT (a DIV 254576881) FROM t1; +(a DIV 254576881) +0 +0 +0 +0 +0 +0 +DROP TABLE t1; +CREATE TABLE t1(a SET('a','b','c')); +INSERT INTO t1 VALUES ('a'); +SELECT a DIV 2 FROM t1 UNION SELECT a DIV 2 FROM t1; +a DIV 2 +0 +DROP TABLE t1; End of 5.0 tests diff --git a/mysql-test/r/func_misc.result b/mysql-test/r/func_misc.result index db2490bd261..0dae788722c 100644 --- a/mysql-test/r/func_misc.result +++ b/mysql-test/r/func_misc.result @@ -191,4 +191,26 @@ select min(a) from t1 group by inet_ntoa(a); min(a) -2 drop table t1; +SELECT NAME_CONST('test', NOW()); +ERROR HY000: Incorrect arguments to NAME_CONST +SELECT NAME_CONST('test', UPPER('test')); +ERROR HY000: Incorrect arguments to NAME_CONST +SELECT NAME_CONST('test', NULL); +test +NULL +SELECT NAME_CONST('test', 1); +test +1 +SELECT NAME_CONST('test', -1); +test +-1 +SELECT NAME_CONST('test', 1.0); +test +1.0 +SELECT NAME_CONST('test', -1.0); +test +-1.0 +SELECT NAME_CONST('test', 'test'); +test +test End of 5.0 tests diff --git a/mysql-test/r/func_regexp.result b/mysql-test/r/func_regexp.result index 584c8a9b820..2366947d2a7 100644 --- a/mysql-test/r/func_regexp.result +++ b/mysql-test/r/func_regexp.result @@ -98,3 +98,8 @@ R2 R3 deallocate prepare stmt1; drop table t1; +End of 4.1 tests +SELECT 1 REGEXP NULL; +1 REGEXP NULL +NULL +End of 5.0 tests diff --git a/mysql-test/r/func_sapdb.result b/mysql-test/r/func_sapdb.result index ba66ac3bc94..4db0416bdce 100644 --- a/mysql-test/r/func_sapdb.result +++ b/mysql-test/r/func_sapdb.result @@ -199,7 +199,7 @@ f2 datetime YES NULL f3 time YES NULL f4 time YES NULL f5 time YES NULL -f6 time NO 00:00:00 +f6 time YES NULL f7 datetime YES NULL f8 date YES NULL f9 time YES NULL diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result index ce9633006af..d0809eca65b 100644 --- a/mysql-test/r/func_str.result +++ b/mysql-test/r/func_str.result @@ -722,11 +722,11 @@ Warning 1265 Data truncated for column 'format(130,10)' at row 1 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `bin(130)` varchar(64) NOT NULL default '', - `oct(130)` varchar(64) NOT NULL default '', - `conv(130,16,10)` varchar(64) NOT NULL default '', + `bin(130)` varchar(64) default NULL, + `oct(130)` varchar(64) default NULL, + `conv(130,16,10)` varchar(64) default NULL, `hex(130)` varchar(6) NOT NULL default '', - `char(130)` varbinary(1) NOT NULL default '', + `char(130)` varbinary(4) NOT NULL default '', `format(130,10)` varchar(4) NOT NULL default '', `left(_latin2'a',1)` varchar(1) character set latin2 NOT NULL default '', `right(_latin2'a',1)` varchar(1) character set latin2 NOT NULL default '', @@ -1095,6 +1095,18 @@ 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 Warnings: Note 1003 select decode('','zxcv') AS `enc` from `test`.`t1` +drop table t1; +create table t1 (a bigint not null)engine=myisam; +insert into t1 set a = 1024*1024*1024*4; +delete from t1 order by (inet_ntoa(a)) desc limit 10; +drop table t1; +create table t1 (a char(36) not null)engine=myisam; +insert ignore into t1 set a = ' '; +insert ignore into t1 set a = ' '; +select * from t1 order by (oct(a)); +a + + drop table t1; End of 4.1 tests create table t1 (d decimal default null); @@ -2153,4 +2165,14 @@ SUBSTR(a,1,len) ba DROP TABLE t1; +CREATE TABLE t1 AS SELECT CHAR(0x414243) as c1; +SELECT HEX(c1) from t1; +HEX(c1) +414243 +DROP TABLE t1; +CREATE VIEW v1 AS SELECT CHAR(0x414243) as c1; +SELECT HEX(c1) from v1; +HEX(c1) +414243 +DROP VIEW v1; End of 5.0 tests diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index ee8b8c1e908..74859be4d04 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -1027,6 +1027,15 @@ fmtddate field2 Sep-4 12:00AM abcd DROP TABLE testBug8868; SET NAMES DEFAULT; +CREATE TABLE t1 ( +a TIMESTAMP +); +INSERT INTO t1 VALUES (now()), (now()); +SELECT 1 FROM t1 ORDER BY MAKETIME(1, 1, a); +1 +1 +1 +DROP TABLE t1; (select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%H') As H) union (select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%H') As H); diff --git a/mysql-test/r/gis-rtree.result b/mysql-test/r/gis-rtree.result index 8476ea9e838..99bfede3ee0 100644 --- a/mysql-test/r/gis-rtree.result +++ b/mysql-test/r/gis-rtree.result @@ -167,7 +167,7 @@ count(*) 150 EXPLAIN SELECT fid, AsText(g) FROM t1 WHERE Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))')); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range g g 32 NULL 8 Using where +1 SIMPLE t1 range g g 34 NULL 8 Using where SELECT fid, AsText(g) FROM t1 WHERE Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))')); fid AsText(g) 1 LINESTRING(150 150,150 150) @@ -301,7 +301,7 @@ count(*) EXPLAIN SELECT fid, AsText(g) FROM t2 WHERE Within(g, GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))')); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range g g 32 NULL 4 Using where +1 SIMPLE t2 range g g 34 NULL 4 Using where SELECT fid, AsText(g) FROM t2 WHERE Within(g, GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))')); fid AsText(g) @@ -1425,6 +1425,37 @@ CHECK TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 check status OK DROP TABLE t1; +create table t1 (a geometry not null, spatial index(a)); +insert into t1 values (PointFromWKB(POINT(1.1517219314031e+164, 131072))); +insert into t1 values (PointFromWKB(POINT(9.1248812352444e+192, 2.9740338169556e+284))); +insert into t1 values (PointFromWKB(POINT(4.7783097267365e-299, -0))); +insert into t1 values (PointFromWKB(POINT(1.49166814624e-154, 2.0880974297595e-53))); +insert into t1 values (PointFromWKB(POINT(4.0917382598702e+149, 1.2024538023802e+111))); +insert into t1 values (PointFromWKB(POINT(2.0349165139404e+236, 2.9993936277913e-241))); +insert into t1 values (PointFromWKB(POINT(2.5243548967072e-29, 1.2024538023802e+111))); +insert into t1 values (PointFromWKB(POINT(0, 6.9835074892995e-251))); +insert into t1 values (PointFromWKB(POINT(2.0880974297595e-53, 3.1050361846014e+231))); +insert into t1 values (PointFromWKB(POINT(2.8728483499323e-188, 2.4600631144627e+260))); +insert into t1 values (PointFromWKB(POINT(3.0517578125e-05, 2.0349165139404e+236))); +insert into t1 values (PointFromWKB(POINT(1.1517219314031e+164, 1.1818212630766e-125))); +insert into t1 values (PointFromWKB(POINT(2.481040258324e-265, 5.7766220027675e-275))); +insert into t1 values (PointFromWKB(POINT(2.0880974297595e-53, 2.5243548967072e-29))); +insert into t1 values (PointFromWKB(POINT(5.7766220027675e-275, 9.9464647281957e+86))); +insert into t1 values (PointFromWKB(POINT(2.2181357552967e+130, 3.7857669957337e-270))); +insert into t1 values (PointFromWKB(POINT(4.5767114681874e-246, 3.6893488147419e+19))); +insert into t1 values (PointFromWKB(POINT(4.5767114681874e-246, 3.7537584144024e+255))); +insert into t1 values (PointFromWKB(POINT(3.7857669957337e-270, 1.8033161362863e-130))); +insert into t1 values (PointFromWKB(POINT(0, 5.8774717541114e-39))); +insert into t1 values (PointFromWKB(POINT(1.1517219314031e+164, 2.2761049594727e-159))); +insert into t1 values (PointFromWKB(POINT(6.243497100632e+144, 3.7857669957337e-270))); +insert into t1 values (PointFromWKB(POINT(3.7857669957337e-270, 2.6355494858076e-82))); +insert into t1 values (PointFromWKB(POINT(2.0349165139404e+236, 3.8518598887745e-34))); +insert into t1 values (PointFromWKB(POINT(4.6566128730774e-10, 2.0880974297595e-53))); +insert into t1 values (PointFromWKB(POINT(2.0880974297595e-53, 1.8827498946116e-183))); +insert into t1 values (PointFromWKB(POINT(1.8033161362863e-130, 9.1248812352444e+192))); +insert into t1 values (PointFromWKB(POINT(4.7783097267365e-299, 2.2761049594727e-159))); +insert into t1 values (PointFromWKB(POINT(1.94906280228e+289, 1.2338789709327e-178))); +drop table t1; CREATE TABLE t1(foo GEOMETRY NOT NULL, SPATIAL INDEX(foo) ); INSERT INTO t1(foo) VALUES (NULL); ERROR 23000: Column 'foo' cannot be null diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result index f6189ec1236..40c70721347 100644 --- a/mysql-test/r/gis.result +++ b/mysql-test/r/gis.result @@ -736,6 +736,12 @@ SELECT * FROM t1; a NULL DROP TABLE t1; +CREATE TABLE `t1` ( `col9` set('a'), `col89` date); +INSERT INTO `t1` VALUES ('','0000-00-00'); +select geomfromtext(col9,col89) as a from t1; +a +NULL +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; @@ -888,4 +894,43 @@ 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 system p NULL NULL NULL 1 +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 1 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 End of 5.0 tests diff --git a/mysql-test/r/grant2.result b/mysql-test/r/grant2.result index 6de9a83aeed..e3c92ecc7c8 100644 --- a/mysql-test/r/grant2.result +++ b/mysql-test/r/grant2.result @@ -421,4 +421,22 @@ revoke all privileges, grant option from mysqltest_1@localhost; revoke all privileges, grant option from mysqltest_2@localhost; drop user mysqltest_1@localhost; drop user mysqltest_2@localhost; +CREATE DATABASE db1; +USE db1; +CREATE TABLE t1 (a INT, b INT); +INSERT INTO t1 VALUES (1,1),(2,2); +CREATE TABLE t2 (b INT, c INT); +INSERT INTO t2 VALUES (1,100),(2,200); +GRANT SELECT ON t1 TO mysqltest1@localhost; +GRANT SELECT (b) ON t2 TO mysqltest1@localhost; +USE db1; +SELECT c FROM t2; +ERROR 42000: SELECT command denied to user 'mysqltest1'@'localhost' for column 'c' in table 't2' +SELECT * FROM t2; +ERROR 42000: SELECT command denied to user 'mysqltest1'@'localhost' for column 'c' in table 't2' +SELECT * FROM t1 JOIN t2 USING (b); +ERROR 42000: SELECT command denied to user 'mysqltest1'@'localhost' for column 'c' in table 't2' +DROP TABLE db1.t1, db1.t2; +DROP USER mysqltest1@localhost; +DROP DATABASE db1; End of 5.0 tests diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result index 053c2901509..1693fa646eb 100644 --- a/mysql-test/r/group_by.result +++ b/mysql-test/r/group_by.result @@ -1113,3 +1113,68 @@ c b 3 1 3 2 DROP TABLE t1; +CREATE TABLE t1( +id INT AUTO_INCREMENT PRIMARY KEY, +c1 INT NOT NULL, +c2 INT NOT NULL, +UNIQUE KEY (c2,c1)); +INSERT INTO t1(c1,c2) VALUES (5,1), (4,1), (3,5), (2,3), (1,3); +SELECT * FROM t1 ORDER BY c1; +id c1 c2 +5 1 3 +4 2 3 +3 3 5 +2 4 1 +1 5 1 +SELECT * FROM t1 GROUP BY id ORDER BY c1; +id c1 c2 +5 1 3 +4 2 3 +3 3 5 +2 4 1 +1 5 1 +SELECT * FROM t1 GROUP BY id ORDER BY id DESC; +id c1 c2 +5 1 3 +4 2 3 +3 3 5 +2 4 1 +1 5 1 +SELECT * FROM t1 GROUP BY c2 ,c1, id ORDER BY c2, c1; +id c1 c2 +2 4 1 +1 5 1 +5 1 3 +4 2 3 +3 3 5 +SELECT * FROM t1 GROUP BY c2, c1, id ORDER BY c2 DESC, c1; +id c1 c2 +3 3 5 +5 1 3 +4 2 3 +2 4 1 +1 5 1 +SELECT * FROM t1 GROUP BY c2, c1, id ORDER BY c2 DESC, c1 DESC; +id c1 c2 +3 3 5 +4 2 3 +5 1 3 +1 5 1 +2 4 1 +SELECT * FROM t1 GROUP BY c2 ORDER BY c2, c1; +id c1 c2 +1 5 1 +4 2 3 +3 3 5 +SELECT * FROM t1 GROUP BY c2 ORDER BY c2 DESC, c1; +id c1 c2 +3 3 5 +4 2 3 +1 5 1 +SELECT * FROM t1 GROUP BY c2 ORDER BY c2 DESC, c1 DESC; +id c1 c2 +3 3 5 +4 2 3 +1 5 1 +DROP TABLE t1; +End of 5.0 tests diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result index cf82cdd31bd..80f85aee429 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -1385,4 +1385,40 @@ f6 bigint(20) NO 10 f7 datetime NO NULL f8 datetime YES 2006-01-01 00:00:00 drop table t1; +select * from information_schema.columns where table_schema = NULL; +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT +select * from `information_schema`.`COLUMNS` where `TABLE_NAME` = NULL; +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT +select * from `information_schema`.`KEY_COLUMN_USAGE` where `TABLE_SCHEMA` = NULL; +CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION POSITION_IN_UNIQUE_CONSTRAINT REFERENCED_TABLE_SCHEMA REFERENCED_TABLE_NAME REFERENCED_COLUMN_NAME +select * from `information_schema`.`KEY_COLUMN_USAGE` where `TABLE_NAME` = NULL; +CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION POSITION_IN_UNIQUE_CONSTRAINT REFERENCED_TABLE_SCHEMA REFERENCED_TABLE_NAME REFERENCED_COLUMN_NAME +select * from information_schema.schemata where schema_name = NULL; +CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH +select * from `information_schema`.`STATISTICS` where `TABLE_SCHEMA` = NULL; +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLUMN_NAME COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT +select * from `information_schema`.`STATISTICS` where `TABLE_NAME` = NULL; +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLUMN_NAME COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT +select * from information_schema.tables where table_schema = NULL; +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE VERSION ROW_FORMAT TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE AUTO_INCREMENT CREATE_TIME UPDATE_TIME CHECK_TIME TABLE_COLLATION CHECKSUM CREATE_OPTIONS TABLE_COMMENT +select * from information_schema.tables where table_catalog = NULL; +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE VERSION ROW_FORMAT TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE AUTO_INCREMENT CREATE_TIME UPDATE_TIME CHECK_TIME TABLE_COLLATION CHECKSUM CREATE_OPTIONS TABLE_COMMENT +select * from information_schema.tables where table_name = NULL; +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE VERSION ROW_FORMAT TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE AUTO_INCREMENT CREATE_TIME UPDATE_TIME CHECK_TIME TABLE_COLLATION CHECKSUM CREATE_OPTIONS TABLE_COMMENT +select * from `information_schema`.`TABLE_CONSTRAINTS` where `TABLE_SCHEMA` = NULL; +CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_SCHEMA TABLE_NAME CONSTRAINT_TYPE +select * from `information_schema`.`TABLE_CONSTRAINTS` where `TABLE_NAME` = NULL; +CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_SCHEMA TABLE_NAME CONSTRAINT_TYPE +select * from `information_schema`.`TRIGGERS` where `EVENT_OBJECT_SCHEMA` = NULL; +TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER +select * from `information_schema`.`TRIGGERS` where `EVENT_OBJECT_TABLE` = NULL; +TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER +select * from `information_schema`.`VIEWS` where `TABLE_SCHEMA` = NULL; +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE +select * from `information_schema`.`VIEWS` where `TABLE_NAME` = NULL; +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE End of 5.0 tests. +show fields from information_schema.table_names; +ERROR 42S02: Unknown table 'table_names' in information_schema +show keys from information_schema.table_names; +ERROR 42S02: Unknown table 'table_names' in information_schema diff --git a/mysql-test/r/information_schema_db.result b/mysql-test/r/information_schema_db.result index dd1f0295277..ef63ef719a4 100644 --- a/mysql-test/r/information_schema_db.result +++ b/mysql-test/r/information_schema_db.result @@ -130,7 +130,7 @@ Warnings: Warning 1356 View 'testdb_1.v7' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them show fields from testdb_1.v7; Field Type Null Key Default Extra -f1 null YES NULL +f1 char(4) YES NULL Warnings: Note 1449 There is no 'no_such_user'@'no_such_host' registered create table t3 (f1 char(4), f2 char(4)); @@ -150,7 +150,7 @@ View Create View v6 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `testdb_1`.`v6` AS select `testdb_1`.`t1`.`f1` AS `f1` from `testdb_1`.`t1` show fields from testdb_1.v7; Field Type Null Key Default Extra -f1 null YES NULL +f1 char(4) YES NULL Warnings: Note 1449 There is no 'no_such_user'@'no_such_host' registered show create view testdb_1.v7; @@ -178,7 +178,7 @@ show create view v4; ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table show fields from v4; Field Type Null Key Default Extra -f1 null YES NULL +f1 char(4) YES NULL f2 char(4) YES NULL show fields from v2; Field Type Null Key Default Extra diff --git a/mysql-test/r/innodb_gis.result b/mysql-test/r/innodb_gis.result index 2c62537aa94..bfe8c984b7b 100644 --- a/mysql-test/r/innodb_gis.result +++ b/mysql-test/r/innodb_gis.result @@ -542,3 +542,42 @@ 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 1 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 diff --git a/mysql-test/r/insert_select.result b/mysql-test/r/insert_select.result index d16562d97e2..7a37f49125a 100644 --- a/mysql-test/r/insert_select.result +++ b/mysql-test/r/insert_select.result @@ -830,3 +830,15 @@ id prev_id join_id 3 2 0 4 3 0 DROP TABLE t1,t2; +# +# Bug#30384: Having SQL_BUFFER_RESULT option in the +# CREATE .. KEY(..) .. SELECT led to creating corrupted index. +# +create table t1(f1 int); +insert into t1 values(1),(2),(3); +create table t2 (key(f1)) engine=myisam select sql_buffer_result f1 from t1; +check table t2 extended; +Table Op Msg_type Msg_text +test.t2 check status OK +drop table t1,t2; +################################################################## diff --git a/mysql-test/r/lowercase_view.result b/mysql-test/r/lowercase_view.result index f09725dafcb..a89b79263c5 100644 --- a/mysql-test/r/lowercase_view.result +++ b/mysql-test/r/lowercase_view.result @@ -119,7 +119,7 @@ create table t1Aa (col1 int); create view v1Aa as select col1 from t1Aa as AaA; show create view v1AA; View Create View -v1aa CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1aa` AS select `aaa`.`col1` AS `col1` from `t1aa` `AaA` +v1aa CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1aa` AS select `aaa`.`col1` AS `col1` from `t1aa` `aaa` drop view v1AA; select Aaa.col1 from t1Aa as AaA; col1 @@ -128,6 +128,23 @@ drop view v1AA; create view v1Aa as select AaA.col1 from t1Aa as AaA; show create view v1AA; View Create View -v1aa CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1aa` AS select `aaa`.`col1` AS `col1` from `t1aa` `AaA` +v1aa CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1aa` AS select `aaa`.`col1` AS `col1` from `t1aa` `aaa` drop view v1AA; drop table t1Aa; +CREATE TABLE t1 (a int, b int); +select X.a from t1 AS X group by X.b having (X.a = 1); +a +select X.a from t1 AS X group by X.b having (x.a = 1); +a +select X.a from t1 AS X group by X.b having (x.b = 1); +a +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 +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) +SELECT * FROM v1; +a +DROP VIEW v1; +DROP TABLE t1; +End of 5.0 tests. diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result index 7fc29cd13ca..176d0e97012 100644 --- a/mysql-test/r/myisam.result +++ b/mysql-test/r/myisam.result @@ -1806,4 +1806,29 @@ SELECT a FROM t1 FORCE INDEX (inx) WHERE a=1; a 1 DROP TABLE t1; +CREATE TABLE t1 (c1 INT, c2 INT, UNIQUE INDEX (c1), INDEX (c2)) ENGINE=MYISAM; +SHOW TABLE STATUS LIKE 't1'; +Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment +t1 MyISAM 10 Fixed 0 # # # 1024 # # # # # # # +INSERT INTO t1 VALUES (1,1); +SHOW TABLE STATUS LIKE 't1'; +Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment +t1 MyISAM 10 Fixed 1 # # # 3072 # # # # # # # +ALTER TABLE t1 DISABLE KEYS; +SHOW TABLE STATUS LIKE 't1'; +Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment +t1 MyISAM 10 Fixed 1 # # # 3072 # # # # # # # +ALTER TABLE t1 ENABLE KEYS; +SHOW TABLE STATUS LIKE 't1'; +Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment +t1 MyISAM 10 Fixed 1 # # # 3072 # # # # # # # +ALTER TABLE t1 DISABLE KEYS; +SHOW TABLE STATUS LIKE 't1'; +Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment +t1 MyISAM 10 Fixed 1 # # # 3072 # # # # # # # +ALTER TABLE t1 ENABLE KEYS; +SHOW TABLE STATUS LIKE 't1'; +Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment +t1 MyISAM 10 Fixed 1 # # # 3072 # # # # # # # +DROP TABLE t1; End of 5.0 tests diff --git a/mysql-test/r/mysql_comments.result b/mysql-test/r/mysql_comments.result new file mode 100644 index 00000000000..366ceeb5bbf --- /dev/null +++ b/mysql-test/r/mysql_comments.result @@ -0,0 +1,50 @@ +drop table if exists t1; +drop function if exists foofct; +drop procedure if exists empty; +drop procedure if exists foosp; +drop procedure if exists nicesp; +drop trigger if exists t1_empty; +drop trigger if exists t1_bi; +"Pass 1 : --disable-comments" +1 +1 +2 +2 +foofct("call 1") +call 1 +Function sql_mode Create Function +foofct CREATE DEFINER=`root`@`localhost` FUNCTION `foofct`(x char(20)) RETURNS char(20) CHARSET latin1\nreturn\n\n\n\nx +foofct("call 2") +call 2 +Function sql_mode Create Function +foofct CREATE DEFINER=`root`@`localhost` FUNCTION `foofct`(x char(20)) RETURNS char(20) CHARSET latin1\nbegin\n \n \n \n\n \n\n \n return x;\nend +Procedure sql_mode Create Procedure +empty CREATE DEFINER=`root`@`localhost` PROCEDURE `empty`()\nbegin\nend +id data +foo 42 +Procedure sql_mode Create Procedure +foosp CREATE DEFINER=`root`@`localhost` PROCEDURE `foosp`()\ninsert into test.t1\n\n\n\n\n \n\n \n values ("foo", 42) +Procedure sql_mode Create Procedure +nicesp CREATE DEFINER=`root`@`localhost` PROCEDURE `nicesp`(a int)\nbegin\n \n declare b int;\n declare c float;\n\n \n \n\n \nend +"Pass 2 : --enable-comments" +1 +1 +2 +2 +foofct("call 1") +call 1 +Function sql_mode Create Function +foofct CREATE DEFINER=`root`@`localhost` FUNCTION `foofct`(x char(20)) RETURNS char(20) CHARSET latin1\nreturn\n-- comment 1a\n# comment 1b\n/* comment 1c */\nx # after body, on same line +foofct("call 2") +call 2 +Function sql_mode Create Function +foofct CREATE DEFINER=`root`@`localhost` FUNCTION `foofct`(x char(20)) RETURNS char(20) CHARSET latin1\nbegin\n -- comment 1a\n # comment 1b\n /*\n comment 1c\n */\n\n -- empty line below\n\n -- empty line above\n return x;\nend +Procedure sql_mode Create Procedure +empty CREATE DEFINER=`root`@`localhost` PROCEDURE `empty`()\nbegin\nend +id data +foo 42 +Procedure sql_mode Create Procedure +foosp CREATE DEFINER=`root`@`localhost` PROCEDURE `foosp`()\ninsert into test.t1\n## These comments are part of the procedure body, and should be kept.\n# Comment 2a\n-- Comment 2b\n/* Comment 2c */\n -- empty line below\n\n -- empty line above\n values ("foo", 42) # comment 3, still part of the body +Procedure sql_mode Create Procedure +nicesp CREATE DEFINER=`root`@`localhost` PROCEDURE `nicesp`(a int)\nbegin\n -- declare some variables here\n declare b int;\n declare c float;\n\n -- do more stuff here\n -- commented nicely and so on\n\n -- famous last words ...\nend +End of 5.0 tests diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result index 42c437857b7..ca0aa399a56 100644 --- a/mysql-test/r/mysqldump.result +++ b/mysql-test/r/mysqldump.result @@ -3544,5 +3544,27 @@ c1 2 DROP TABLE t1,t2; # +# Bug#29815: new option for suppressing last line of mysqldump: +# "Dump completed on" +# +# --skip-dump-date: +-- + + + +-- Dump completed +# --dump-date: +-- + + + +-- Dump completed on DATE +# --dump-date (default): +-- + + + +-- Dump completed on DATE +# # End of 5.0 tests # diff --git a/mysql-test/r/ndb_condition_pushdown.result b/mysql-test/r/ndb_condition_pushdown.result index 6012c9b6969..d49c0cd983e 100644 --- a/mysql-test/r/ndb_condition_pushdown.result +++ b/mysql-test/r/ndb_condition_pushdown.result @@ -1888,5 +1888,27 @@ set engine_condition_pushdown = 1; SELECT fname, lname FROM t1 WHERE (fname like 'Y%') or (lname like 'F%'); fname lname Young Foo +drop table t1; +create table t1 (a int, b int, c int, d int, primary key using hash(a)) +engine=ndbcluster; +insert into t1 values (10,1,100,0+0x1111); +insert into t1 values (20,2,200,0+0x2222); +insert into t1 values (30,3,300,0+0x3333); +insert into t1 values (40,4,400,0+0x4444); +insert into t1 values (50,5,500,0+0x5555); +set engine_condition_pushdown = on; +select a,b,d from t1 +where b in (0,1,2,5) +order by b; +a b d +10 1 4369 +20 2 8738 +50 5 21845 +a b d +10 1 4369 +20 2 8738 +50 5 21845 +Warnings: +Warning 4294 Scan filter is too large, discarded set engine_condition_pushdown = @old_ecpd; DROP TABLE t1,t2,t3,t4,t5; diff --git a/mysql-test/r/ndb_update.result b/mysql-test/r/ndb_update.result index d75f82172ae..7848a47bcef 100644 --- a/mysql-test/r/ndb_update.result +++ b/mysql-test/r/ndb_update.result @@ -39,4 +39,12 @@ pk1 b c 10 0 0 12 2 2 14 1 1 +create unique index ib on t1(b); +update t1 set c = 4 where pk1 = 12; +update ignore t1 set b = 55 where pk1 = 14; +select * from t1 order by pk1; +pk1 b c +10 0 0 +12 2 4 +14 55 1 DROP TABLE IF EXISTS t1; diff --git a/mysql-test/r/null.result b/mysql-test/r/null.result index c33adee76b2..090f41baec3 100644 --- a/mysql-test/r/null.result +++ b/mysql-test/r/null.result @@ -1,4 +1,4 @@ -drop table if exists t1; +drop table if exists t1, t2; select null,\N,isnull(null),isnull(1/0),isnull(1/0 = null),ifnull(null,1),ifnull(null,"TRUE"),ifnull("TRUE","ERROR"),1/0 is null,1 is not null; NULL NULL isnull(null) isnull(1/0) isnull(1/0 = null) ifnull(null,1) ifnull(null,"TRUE") ifnull("TRUE","ERROR") 1/0 is null 1 is not null NULL NULL 1 1 1 1 TRUE TRUE 1 1 @@ -320,3 +320,26 @@ bug19145c CREATE TABLE `bug19145c` ( drop table bug19145a; drop table bug19145b; drop table bug19145c; +# End of 4.1 tests +# +# Bug #31471: decimal_bin_size: Assertion `scale >= 0 && +# precision > 0 && scale <= precision' +# +CREATE TABLE t1 (a DECIMAL (1, 0) ZEROFILL, b DECIMAL (1, 0) ZEROFILL); +INSERT INTO t1 (a, b) VALUES (0, 0); +CREATE TABLE t2 SELECT IFNULL(a, b) FROM t1; +DESCRIBE t2; +Field Type Null Key Default Extra +IFNULL(a, b) decimal(1,0) unsigned YES NULL +DROP TABLE t2; +CREATE TABLE t2 SELECT IFNULL(a, NULL) FROM t1; +DESCRIBE t2; +Field Type Null Key Default Extra +IFNULL(a, NULL) decimal(1,0) YES NULL +DROP TABLE t2; +CREATE TABLE t2 SELECT IFNULL(NULL, b) FROM t1; +DESCRIBE t2; +Field Type Null Key Default Extra +IFNULL(NULL, b) decimal(1,0) YES NULL +DROP TABLE t1, t2; +# End of 5.0 tests diff --git a/mysql-test/r/olap.result b/mysql-test/r/olap.result index 4a54b17316d..a1d66b11f58 100644 --- a/mysql-test/r/olap.result +++ b/mysql-test/r/olap.result @@ -715,3 +715,14 @@ a SUM(a) 4 4 NULL 14 DROP TABLE t1; +# +# Bug#31095: Unexpected NULL constant caused server crash. +# +create table t1(a int); +insert into t1 values (1),(2),(3); +select count(a) from t1 group by null with rollup; +count(a) +3 +3 +drop table t1; +############################################################## diff --git a/mysql-test/r/outfile_loaddata.result b/mysql-test/r/outfile_loaddata.result new file mode 100644 index 00000000000..1bcaf308b7c --- /dev/null +++ b/mysql-test/r/outfile_loaddata.result @@ -0,0 +1,85 @@ +DROP TABLE IF EXISTS t1, t2; +# +# Bug#31663 FIELDS TERMINATED BY special character +# +CREATE TABLE t1 (i1 int, i2 int, c1 VARCHAR(256), c2 VARCHAR(256)); +INSERT INTO t1 VALUES (101, 202, '-r-', '=raker='); +# FIELDS TERMINATED BY 'raker', warning: +SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug31663.txt' FIELDS TERMINATED BY 'raker' FROM t1; +Warnings: +Warning 1475 First character of the FIELDS TERMINATED string is ambiguous; please use non-optional and non-empty FIELDS ENCLOSED BY +SELECT LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug31663.txt'); +LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug31663.txt') +101raker202raker-r-raker=raker= + +CREATE TABLE t2 SELECT * FROM t1; +LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug31663.txt' INTO TABLE t2 FIELDS TERMINATED BY 'raker'; +Warnings: +Warning 1262 Row 1 was truncated; it contained more data than there were input columns +SELECT * FROM t2; +i1 i2 c1 c2 +101 202 -r- =raker= +101 202 -r- = +DROP TABLE t2; +# Only numeric fields, FIELDS TERMINATED BY 'r', no warnings: +SELECT i1, i2 INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug31663.txt' FIELDS TERMINATED BY 'r' FROM t1; +SELECT LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug31663.txt'); +LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug31663.txt') +101r202 + +CREATE TABLE t2 SELECT i1, i2 FROM t1; +LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug31663.txt' INTO TABLE t2 FIELDS TERMINATED BY 'r'; +SELECT i1, i2 FROM t2; +i1 i2 +101 202 +101 202 +DROP TABLE t2; +# FIELDS TERMINATED BY '0', warning: +SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug31663.txt' FIELDS TERMINATED BY '0' FROM t1; +Warnings: +Warning 1475 First character of the FIELDS TERMINATED string is ambiguous; please use non-optional and non-empty FIELDS ENCLOSED BY +SELECT LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug31663.txt'); +LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug31663.txt') +10102020-r-0=raker= + +CREATE TABLE t2 SELECT * FROM t1; +LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug31663.txt' INTO TABLE t2 FIELDS TERMINATED BY '0'; +Warnings: +Warning 1262 Row 1 was truncated; it contained more data than there were input columns +SELECT * FROM t2; +i1 i2 c1 c2 +101 202 -r- =raker= +1 1 2 2 +DROP TABLE t2; +# FIELDS OPTIONALLY ENCLOSED BY '"' TERMINATED BY '0', warning: +SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug31663.txt' FIELDS OPTIONALLY ENCLOSED BY '"' TERMINATED BY '0' FROM t1; +Warnings: +Warning 1475 First character of the FIELDS TERMINATED string is ambiguous; please use non-optional and non-empty FIELDS ENCLOSED BY +SELECT LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug31663.txt'); +LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug31663.txt') +10102020"-r-"0"=raker=" + +CREATE TABLE t2 SELECT * FROM t1; +LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug31663.txt' INTO TABLE t2 FIELDS OPTIONALLY ENCLOSED BY '"' TERMINATED BY '0'; +Warnings: +Warning 1262 Row 1 was truncated; it contained more data than there were input columns +SELECT * FROM t2; +i1 i2 c1 c2 +101 202 -r- =raker= +1 1 2 2 +DROP TABLE t2; +# Only string fields, FIELDS OPTIONALLY ENCLOSED BY '"' TERMINATED BY '0', no warnings: +SELECT c1, c2 INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug31663.txt' FIELDS OPTIONALLY ENCLOSED BY '"' TERMINATED BY '0' FROM t1; +SELECT LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug31663.txt'); +LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug31663.txt') +"-r-"0"=raker=" + +CREATE TABLE t2 SELECT c1, c2 FROM t1; +LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug31663.txt' INTO TABLE t2 FIELDS OPTIONALLY ENCLOSED BY '"' TERMINATED BY '0'; +SELECT c1, c2 FROM t2; +c1 c2 +-r- =raker= +-r- =raker= +DROP TABLE t2; +DROP TABLE t1; +# End of 5.0 tests. diff --git a/mysql-test/r/ps_2myisam.result b/mysql-test/r/ps_2myisam.result index 7ccb41e6294..57932a6c455 100644 --- a/mysql-test/r/ps_2myisam.result +++ b/mysql-test/r/ps_2myisam.result @@ -2973,11 +2973,13 @@ Warnings: Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 Warnings: +Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 Warnings: Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 Warnings: +Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 Warnings: Note 1265 Data truncated for column 'c13' at row 1 @@ -3011,7 +3013,6 @@ Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value adjusted for column 'c16' at row 1 Warning 1264 Out of range value adjusted for column 'c17' at row 1 Warnings: -Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value adjusted for column 'c16' at row 1 Warning 1264 Out of range value adjusted for column 'c17' at row 1 diff --git a/mysql-test/r/ps_3innodb.result b/mysql-test/r/ps_3innodb.result index 21d2b23f27b..fd24c29d558 100644 --- a/mysql-test/r/ps_3innodb.result +++ b/mysql-test/r/ps_3innodb.result @@ -2956,11 +2956,13 @@ Warnings: Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 Warnings: +Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 Warnings: Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 Warnings: +Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 Warnings: Note 1265 Data truncated for column 'c13' at row 1 @@ -2994,7 +2996,6 @@ Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value adjusted for column 'c16' at row 1 Warning 1264 Out of range value adjusted for column 'c17' at row 1 Warnings: -Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value adjusted for column 'c16' at row 1 Warning 1264 Out of range value adjusted for column 'c17' at row 1 diff --git a/mysql-test/r/ps_4heap.result b/mysql-test/r/ps_4heap.result index 6b31e95c6c8..b4596ab85bc 100644 --- a/mysql-test/r/ps_4heap.result +++ b/mysql-test/r/ps_4heap.result @@ -2957,11 +2957,13 @@ Warnings: Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 Warnings: +Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 Warnings: Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 Warnings: +Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 Warnings: Note 1265 Data truncated for column 'c13' at row 1 @@ -2995,7 +2997,6 @@ Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value adjusted for column 'c16' at row 1 Warning 1264 Out of range value adjusted for column 'c17' at row 1 Warnings: -Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value adjusted for column 'c16' at row 1 Warning 1264 Out of range value adjusted for column 'c17' at row 1 diff --git a/mysql-test/r/ps_5merge.result b/mysql-test/r/ps_5merge.result index c7b20b774bd..18982db937a 100644 --- a/mysql-test/r/ps_5merge.result +++ b/mysql-test/r/ps_5merge.result @@ -2893,11 +2893,13 @@ Warnings: Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 Warnings: +Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 Warnings: Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 Warnings: +Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 Warnings: Note 1265 Data truncated for column 'c13' at row 1 @@ -2931,7 +2933,6 @@ Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value adjusted for column 'c16' at row 1 Warning 1264 Out of range value adjusted for column 'c17' at row 1 Warnings: -Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value adjusted for column 'c16' at row 1 Warning 1264 Out of range value adjusted for column 'c17' at row 1 @@ -5914,11 +5915,13 @@ Warnings: Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 Warnings: +Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 Warnings: Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 Warnings: +Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 Warnings: Note 1265 Data truncated for column 'c13' at row 1 @@ -5952,7 +5955,6 @@ Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value adjusted for column 'c16' at row 1 Warning 1264 Out of range value adjusted for column 'c17' at row 1 Warnings: -Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value adjusted for column 'c16' at row 1 Warning 1264 Out of range value adjusted for column 'c17' at row 1 diff --git a/mysql-test/r/ps_6bdb.result b/mysql-test/r/ps_6bdb.result index 5e97d5cf179..0e4086bc202 100644 --- a/mysql-test/r/ps_6bdb.result +++ b/mysql-test/r/ps_6bdb.result @@ -2956,11 +2956,13 @@ Warnings: Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 Warnings: +Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 Warnings: Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 Warnings: +Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 Warnings: Note 1265 Data truncated for column 'c13' at row 1 @@ -2994,7 +2996,6 @@ Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value adjusted for column 'c16' at row 1 Warning 1264 Out of range value adjusted for column 'c17' at row 1 Warnings: -Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value adjusted for column 'c16' at row 1 Warning 1264 Out of range value adjusted for column 'c17' at row 1 diff --git a/mysql-test/r/ps_7ndb.result b/mysql-test/r/ps_7ndb.result index 7ca18edc9cc..7a20fb3146d 100644 --- a/mysql-test/r/ps_7ndb.result +++ b/mysql-test/r/ps_7ndb.result @@ -2956,11 +2956,13 @@ Warnings: Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 Warnings: +Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 Warnings: Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 Warnings: +Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 Warnings: Note 1265 Data truncated for column 'c13' at row 1 @@ -2994,7 +2996,6 @@ Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value adjusted for column 'c16' at row 1 Warning 1264 Out of range value adjusted for column 'c17' at row 1 Warnings: -Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value adjusted for column 'c16' at row 1 Warning 1264 Out of range value adjusted for column 'c17' at row 1 diff --git a/mysql-test/r/rpl_flush_log_loop.result b/mysql-test/r/rpl_flush_log_loop.result index f9bd42ec26c..3b1db804da9 100644 --- a/mysql-test/r/rpl_flush_log_loop.result +++ b/mysql-test/r/rpl_flush_log_loop.result @@ -4,6 +4,13 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; +show variables like 'relay_log%'; +Variable_name Value +relay_log MYSQLTEST_VARDIR/master-data/relay-log +relay_log_index +relay_log_info_file relay-log.info +relay_log_purge ON +relay_log_space_limit 0 stop slave; change master to master_host='127.0.0.1',master_user='root', master_password='',master_port=MASTER_PORT; diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index ed120a1bbb8..a1ba58a536c 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -2827,6 +2827,14 @@ FFFFFFFFFFFFFFFF 7FFFFFFFFFFFFFFF FFFFFFFFFFFFFFFF 7FFFFFFFFFFFFFFF 8FFFFFFFFFFFFFFF 7FFFFFFFFFFFFFFF drop table t1; +CREATE TABLE t1 (c0 int); +CREATE TABLE t2 (c0 int); +INSERT INTO t1 VALUES(@@connect_timeout); +INSERT INTO t2 VALUES(@@connect_timeout); +SELECT * FROM t1 JOIN t2 ON t1.c0 = t2.c0 WHERE (t1.c0 <=> @@connect_timeout); +c0 c0 +X X +DROP TABLE t1, t2; End of 4.1 tests CREATE TABLE t1 ( K2C4 varchar(4) character set latin1 collate latin1_bin NOT NULL default '', @@ -3233,40 +3241,40 @@ drop table t1, t2 ,t3; create table t1(f1 int, f2 date); insert into t1 values(1,'2005-01-01'),(2,'2005-09-01'),(3,'2005-09-30'), (4,'2005-10-01'),(5,'2005-12-30'); -select * from t1 where f2 >= 0; +select * from t1 where f2 >= 0 order by f2; f1 f2 1 2005-01-01 2 2005-09-01 3 2005-09-30 4 2005-10-01 5 2005-12-30 -select * from t1 where f2 >= '0000-00-00'; +select * from t1 where f2 >= '0000-00-00' order by f2; f1 f2 1 2005-01-01 2 2005-09-01 3 2005-09-30 4 2005-10-01 5 2005-12-30 -select * from t1 where f2 >= '2005-09-31'; +select * from t1 where f2 >= '2005-09-31' order by f2; f1 f2 4 2005-10-01 5 2005-12-30 -select * from t1 where f2 >= '2005-09-3a'; +select * from t1 where f2 >= '2005-09-3a' order by f2; f1 f2 +3 2005-09-30 4 2005-10-01 5 2005-12-30 Warnings: Warning 1292 Incorrect date value: '2005-09-3a' for column 'f2' at row 1 -select * from t1 where f2 <= '2005-09-31'; +select * from t1 where f2 <= '2005-09-31' order by f2; f1 f2 1 2005-01-01 2 2005-09-01 3 2005-09-30 -select * from t1 where f2 <= '2005-09-3a'; +select * from t1 where f2 <= '2005-09-3a' order by f2; f1 f2 1 2005-01-01 2 2005-09-01 -3 2005-09-30 Warnings: Warning 1292 Incorrect date value: '2005-09-3a' for column 'f2' at row 1 drop table t1; @@ -4077,23 +4085,241 @@ x 1 Warnings: Warning 1466 Leading spaces are removed from name ' x' +CREATE VIEW v1 AS SELECT 1 AS ``; +ERROR 42000: Incorrect column name '' CREATE VIEW v1 AS SELECT 1 AS ` `; -Warnings: -Warning 1474 Name ' ' has become '' -SELECT `` FROM v1; - -1 -CREATE VIEW v2 AS SELECT 1 AS ` `; -Warnings: -Warning 1474 Name ' ' has become '' -SELECT `` FROM v2; - -1 -CREATE VIEW v3 AS SELECT 1 AS ` x`; +ERROR 42000: Incorrect column name ' ' +CREATE VIEW v1 AS SELECT 1 AS ` `; +ERROR 42000: Incorrect column name ' ' +CREATE VIEW v1 AS SELECT (SELECT 1 AS ` `); +ERROR 42000: Incorrect column name ' ' +CREATE VIEW v1 AS SELECT 1 AS ` x`; Warnings: Warning 1466 Leading spaces are removed from name ' x' -SELECT `x` FROM v3; +SELECT `x` FROM v1; x 1 -DROP VIEW v1, v2, v3; +ALTER VIEW v1 AS SELECT 1 AS ` `; +ERROR 42000: Incorrect column name ' ' +DROP VIEW v1; +select str_to_date('2007-10-09','%Y-%m-%d') between '2007/10/01 00:00:00 GMT' + and '2007/10/20 00:00:00 GMT'; +str_to_date('2007-10-09','%Y-%m-%d') between '2007/10/01 00:00:00 GMT' + and '2007/10/20 00:00:00 GMT' +1 +Warnings: +Warning 1292 Truncated incorrect datetime value: '2007/10/01 00:00:00 GMT' +Warning 1292 Truncated incorrect datetime value: '2007/10/20 00:00:00 GMT' +select str_to_date('2007-10-09','%Y-%m-%d') > '2007/10/01 00:00:00 GMT-6'; +str_to_date('2007-10-09','%Y-%m-%d') > '2007/10/01 00:00:00 GMT-6' +1 +Warnings: +Warning 1292 Truncated incorrect date value: '2007/10/01 00:00:00 GMT-6' +select str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/2000:00:00 GMT-6'; +str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/2000:00:00 GMT-6' +1 +Warnings: +Warning 1292 Truncated incorrect date value: '2007/10/2000:00:00 GMT-6' +select str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-1 00:00:00 GMT-6'; +str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-1 00:00:00 GMT-6' +1 +Warnings: +Warning 1292 Truncated incorrect date value: '2007-10-1 00:00:00 GMT-6' +select str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-01 x00:00:00 GMT-6'; +str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-01 x00:00:00 GMT-6' +1 +Warnings: +Warning 1292 Truncated incorrect date value: '2007-10-01 x00:00:00 GMT-6' +select str_to_date('2007-10-01','%Y-%m-%d %H:%i:%s') = '2007-10-01 00:00:00 GMT-6'; +str_to_date('2007-10-01','%Y-%m-%d %H:%i:%s') = '2007-10-01 00:00:00 GMT-6' +1 +Warnings: +Warning 1292 Truncated incorrect datetime value: '2007-10-01 00:00:00 GMT-6' +select str_to_date('2007-10-01','%Y-%m-%d %H:%i:%s') = '2007-10-01 00:x00:00 GMT-6'; +str_to_date('2007-10-01','%Y-%m-%d %H:%i:%s') = '2007-10-01 00:x00:00 GMT-6' +1 +Warnings: +Warning 1292 Truncated incorrect datetime value: '2007-10-01 00:x00:00 GMT-6' +select str_to_date('2007-10-01','%Y-%m-%d %H:%i:%s') = '2007-10-01 x12:34:56 GMT-6'; +str_to_date('2007-10-01','%Y-%m-%d %H:%i:%s') = '2007-10-01 x12:34:56 GMT-6' +1 +Warnings: +Warning 1292 Truncated incorrect datetime value: '2007-10-01 x12:34:56 GMT-6' +select str_to_date('2007-10-01 12:34:00','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34x:56 GMT-6'; +str_to_date('2007-10-01 12:34:00','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34x:56 GMT-6' +1 +Warnings: +Warning 1292 Truncated incorrect datetime value: '2007-10-01 12:34x:56 GMT-6' +select str_to_date('2007-10-01 12:34:56','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34x:56 GMT-6'; +str_to_date('2007-10-01 12:34:56','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34x:56 GMT-6' +0 +Warnings: +Warning 1292 Truncated incorrect datetime value: '2007-10-01 12:34x:56 GMT-6' +select str_to_date('2007-10-01 12:34:56','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34:56'; +str_to_date('2007-10-01 12:34:56','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34:56' +1 +select str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-01 12:00:00'; +str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-01 12:00:00' +0 +select str_to_date('2007-10-01 12','%Y-%m-%d %H') = '2007-10-01 12:00:00'; +str_to_date('2007-10-01 12','%Y-%m-%d %H') = '2007-10-01 12:00:00' +1 +select str_to_date('2007-10-01 12:34','%Y-%m-%d %H') = '2007-10-01 12:00:00'; +str_to_date('2007-10-01 12:34','%Y-%m-%d %H') = '2007-10-01 12:00:00' +1 +Warnings: +Warning 1292 Truncated incorrect datetime value: '2007-10-01 12:34' +select str_to_date('2007-02-30 12:34','%Y-%m-%d %H:%i') = '2007-02-30 12:34'; +str_to_date('2007-02-30 12:34','%Y-%m-%d %H:%i') = '2007-02-30 12:34' +1 +select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34'; +str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34' +1 +select str_to_date('2007-10-00','%Y-%m-%d') between '2007/09/01 00:00:00' + and '2007/10/20 00:00:00'; +str_to_date('2007-10-00','%Y-%m-%d') between '2007/09/01 00:00:00' + and '2007/10/20 00:00:00' +1 +set SQL_MODE=TRADITIONAL; +select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34'; +str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34' +0 +Warnings: +Warning 1292 Truncated incorrect datetime value: '2007-10-00 12:34' +select str_to_date('2007-10-01 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34'; +str_to_date('2007-10-01 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34' +0 +Warnings: +Warning 1292 Truncated incorrect datetime value: '2007-10-00 12:34' +select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-01 12:34'; +str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-01 12:34' +0 +Warnings: +Warning 1292 Truncated incorrect datetime value: '2007-10-00 12:34:00' +select str_to_date('2007-10-00','%Y-%m-%d') between '2007/09/01' + and '2007/10/20'; +str_to_date('2007-10-00','%Y-%m-%d') between '2007/09/01' + and '2007/10/20' +0 +Warnings: +Warning 1292 Incorrect datetime value: '2007-10-00' for column '2007/09/01' at row 1 +Warning 1292 Incorrect datetime value: '2007-10-00' for column '2007/10/20' at row 1 +set SQL_MODE=DEFAULT; +select str_to_date('2007-10-00','%Y-%m-%d') between '' and '2007/10/20'; +str_to_date('2007-10-00','%Y-%m-%d') between '' and '2007/10/20' +1 +Warnings: +Warning 1292 Truncated incorrect datetime value: '' +select str_to_date('','%Y-%m-%d') between '2007/10/01' and '2007/10/20'; +str_to_date('','%Y-%m-%d') between '2007/10/01' and '2007/10/20' +0 +select str_to_date('','%Y-%m-%d %H:%i') = '2007-10-01 12:34'; +str_to_date('','%Y-%m-%d %H:%i') = '2007-10-01 12:34' +0 +select str_to_date(NULL,'%Y-%m-%d %H:%i') = '2007-10-01 12:34'; +str_to_date(NULL,'%Y-%m-%d %H:%i') = '2007-10-01 12:34' +NULL +select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = ''; +str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '' +0 +Warnings: +Warning 1292 Truncated incorrect datetime value: '' +select str_to_date('1','%Y-%m-%d') = '1'; +str_to_date('1','%Y-%m-%d') = '1' +0 +Warnings: +Warning 1292 Truncated incorrect date value: '1' +select str_to_date('1','%Y-%m-%d') = '1'; +str_to_date('1','%Y-%m-%d') = '1' +0 +Warnings: +Warning 1292 Truncated incorrect date value: '1' +select str_to_date('','%Y-%m-%d') = ''; +str_to_date('','%Y-%m-%d') = '' +0 +Warnings: +Warning 1292 Truncated incorrect date value: '' +select str_to_date('1000-01-01','%Y-%m-%d') between '0000-00-00' and NULL; +str_to_date('1000-01-01','%Y-%m-%d') between '0000-00-00' and NULL +0 +select str_to_date('1000-01-01','%Y-%m-%d') between NULL and '2000-00-00'; +str_to_date('1000-01-01','%Y-%m-%d') between NULL and '2000-00-00' +0 +select str_to_date('1000-01-01','%Y-%m-%d') between NULL and NULL; +str_to_date('1000-01-01','%Y-%m-%d') between NULL and NULL +0 +CREATE TABLE t1 (c11 INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY); +CREATE TABLE t2 (c21 INT UNSIGNED NOT NULL, +c22 INT DEFAULT NULL, +KEY(c21, c22)); +CREATE TABLE t3 (c31 INT UNSIGNED NOT NULL DEFAULT 0, +c32 INT DEFAULT NULL, +c33 INT NOT NULL, +c34 INT UNSIGNED DEFAULT 0, +KEY (c33, c34, c32)); +INSERT INTO t1 values (),(),(),(),(); +INSERT INTO t2 SELECT a.c11, b.c11 FROM t1 a, t1 b; +INSERT INTO t3 VALUES (1, 1, 1, 0), +(2, 2, 0, 0), +(3, 3, 1, 0), +(4, 4, 0, 0), +(5, 5, 1, 0); +SELECT c32 FROM t1, t2, t3 WHERE t1.c11 IN (1, 3, 5) AND +t3.c31 = t1.c11 AND t2.c21 = t1.c11 AND +t3.c33 = 1 AND t2.c22 in (1, 3) +ORDER BY c32; +c32 +1 +1 +3 +3 +5 +5 +SELECT c32 FROM t1, t2, t3 WHERE t1.c11 IN (1, 3, 5) AND +t3.c31 = t1.c11 AND t2.c21 = t1.c11 AND +t3.c33 = 1 AND t2.c22 in (1, 3) +ORDER BY c32 DESC; +c32 +5 +5 +3 +3 +1 +1 +DROP TABLE t1, t2, t3; + +# +# Bug#30736: Row Size Too Large Error Creating a Table and +# Inserting Data. +# +DROP TABLE IF EXISTS t1; +DROP TABLE IF EXISTS t2; + +CREATE TABLE t1( +c1 DECIMAL(10, 2), +c2 FLOAT); + +INSERT INTO t1 VALUES (0, 1), (2, 3), (4, 5); + +CREATE TABLE t2( +c3 DECIMAL(10, 2)) +SELECT +c1 * c2 AS c3 +FROM t1; + +SELECT * FROM t1; +c1 c2 +0.00 1 +2.00 3 +4.00 5 + +SELECT * FROM t2; +c3 +0.00 +6.00 +20.00 + +DROP TABLE t1; +DROP TABLE t2; + End of 5.0 tests diff --git a/mysql-test/r/skip_grants.result b/mysql-test/r/skip_grants.result index 3052bae8e97..1ef35b051d6 100644 --- a/mysql-test/r/skip_grants.result +++ b/mysql-test/r/skip_grants.result @@ -70,3 +70,8 @@ count(*) select count(*) from information_schema.USER_PRIVILEGES; count(*) 0 +CREATE FUNCTION a RETURNS STRING SONAME ''; +ERROR HY000: Can't initialize function 'a'; UDFs are unavailable with the --skip-grant-tables option +DROP FUNCTION a; +ERROR 42000: FUNCTION test.a does not exist +End of 5.0 tests diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index be99bdb1afc..1c450269809 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -4139,4 +4139,64 @@ SELECT (SELECT SUM(t1.a) FROM t2 WHERE a=1) FROM t1; (SELECT SUM(t1.a) FROM t2 WHERE a=1) 3 DROP TABLE t1,t2; +CREATE TABLE t1 (a1 INT, a2 INT); +CREATE TABLE t2 (b1 INT, b2 INT); +INSERT INTO t1 VALUES (100, 200); +INSERT INTO t1 VALUES (101, 201); +INSERT INTO t2 VALUES (101, 201); +INSERT INTO t2 VALUES (103, 203); +SELECT ((a1,a2) IN (SELECT * FROM t2 WHERE b2 > 0)) IS NULL FROM t1; +((a1,a2) IN (SELECT * FROM t2 WHERE b2 > 0)) IS NULL +0 +0 +DROP TABLE t1, t2; +CREATE TABLE t1 (s1 BINARY(5), s2 VARBINARY(5)); +INSERT INTO t1 VALUES (0x41,0x41), (0x42,0x42), (0x43,0x43); +SELECT s1, s2 FROM t1 WHERE s2 IN (SELECT s1 FROM t1); +s1 s2 +SELECT s1, s2 FROM t1 WHERE (s2, 10) IN (SELECT s1, 10 FROM t1); +s1 s2 +CREATE INDEX I1 ON t1 (s1); +CREATE INDEX I2 ON t1 (s2); +SELECT s1, s2 FROM t1 WHERE s2 IN (SELECT s1 FROM t1); +s1 s2 +SELECT s1, s2 FROM t1 WHERE (s2, 10) IN (SELECT s1, 10 FROM t1); +s1 s2 +TRUNCATE t1; +INSERT INTO t1 VALUES (0x41,0x41); +SELECT * FROM t1 WHERE s1 = (SELECT s2 FROM t1); +s1 s2 +DROP TABLE t1; +CREATE TABLE t1 (a1 VARBINARY(2) NOT NULL DEFAULT '0', PRIMARY KEY (a1)); +CREATE TABLE t2 (a2 BINARY(2) default '0', INDEX (a2)); +CREATE TABLE t3 (a3 BINARY(2) default '0'); +INSERT INTO t1 VALUES (1),(2),(3),(4); +INSERT INTO t2 VALUES (1),(2),(3); +INSERT INTO t3 VALUES (1),(2),(3); +SELECT LEFT(t2.a2, 1) FROM t2,t3 WHERE t3.a3=t2.a2; +LEFT(t2.a2, 1) +1 +2 +3 +SELECT t1.a1, t1.a1 in (SELECT t2.a2 FROM t2,t3 WHERE t3.a3=t2.a2) FROM t1; +a1 t1.a1 in (SELECT t2.a2 FROM t2,t3 WHERE t3.a3=t2.a2) +1 0 +2 0 +3 0 +4 0 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (a1 BINARY(3) PRIMARY KEY, b1 VARBINARY(3)); +CREATE TABLE t2 (a2 VARBINARY(3) PRIMARY KEY); +CREATE TABLE t3 (a3 VARBINARY(3) PRIMARY KEY); +INSERT INTO t1 VALUES (1,10), (2,20), (3,30), (4,40); +INSERT INTO t2 VALUES (2), (3), (4), (5); +INSERT INTO t3 VALUES (10), (20), (30); +SELECT LEFT(t1.a1,1) FROM t1,t3 WHERE t1.b1=t3.a3; +LEFT(t1.a1,1) +1 +2 +3 +SELECT a2 FROM t2 WHERE t2.a2 IN (SELECT t1.a1 FROM t1,t3 WHERE t1.b1=t3.a3); +a2 +DROP TABLE t1, t2, t3; End of 5.0 tests. diff --git a/mysql-test/r/symlink.result b/mysql-test/r/symlink.result index 18299bf4298..833adbeb851 100644 --- a/mysql-test/r/symlink.result +++ b/mysql-test/r/symlink.result @@ -99,6 +99,12 @@ t1 CREATE TABLE `t1` ( `b` int(11) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; +CREATE TABLE t1(a INT) +DATA DIRECTORY='TEST_DIR/master-data/mysql' +INDEX DIRECTORY='TEST_DIR/master-data/mysql'; +RENAME TABLE t1 TO user; +ERROR HY000: Can't create/write to file 'TEST_DIR/master-data/mysql/user.MYI' (Errcode: 17) +DROP TABLE t1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( diff --git a/mysql-test/r/type_date.result b/mysql-test/r/type_date.result index 9f51fc0371c..bd2a43569dd 100644 --- a/mysql-test/r/type_date.result +++ b/mysql-test/r/type_date.result @@ -136,3 +136,82 @@ d dt ts 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 2001-11-11 2001-11-11 00:00:00 2001-11-11 00:00:00 drop table t1; +CREATE TABLE t1 ( +a INT +); +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (NULL); +SELECT str_to_date( '', a ) FROM t1; +str_to_date( '', a ) +0000-00-00 00:00:00 +NULL +DROP TABLE t1; +CREATE TABLE t1 (a DATE, b int, PRIMARY KEY (a,b)); +INSERT INTO t1 VALUES (DATE(NOW()), 1); +SELECT COUNT(*) FROM t1 WHERE a = NOW(); +COUNT(*) +0 +EXPLAIN SELECT COUNT(*) FROM t1 WHERE a = NOW(); +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 +INSERT INTO t1 VALUES (DATE(NOW()), 2); +SELECT COUNT(*) FROM t1 WHERE a = NOW(); +COUNT(*) +0 +EXPLAIN SELECT COUNT(*) FROM t1 WHERE a = NOW(); +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 COUNT(*) FROM t1 WHERE a = NOW() AND b = 1; +COUNT(*) +0 +EXPLAIN SELECT COUNT(*) FROM t1 WHERE a = NOW() AND b = 1; +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 +ALTER TABLE t1 DROP PRIMARY KEY; +SELECT COUNT(*) FROM t1 WHERE a = NOW(); +COUNT(*) +0 +EXPLAIN SELECT COUNT(*) FROM t1 WHERE a = NOW(); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where +DROP TABLE t1; +CREATE TABLE t1 (a DATE); +CREATE TABLE t2 (a DATE); +CREATE INDEX i ON t1 (a); +INSERT INTO t1 VALUES ('0000-00-00'),('0000-00-00'); +INSERT INTO t2 VALUES ('0000-00-00'),('0000-00-00'); +SELECT * FROM t1 WHERE a = '0000-00-00'; +a +0000-00-00 +0000-00-00 +SELECT * FROM t2 WHERE a = '0000-00-00'; +a +0000-00-00 +0000-00-00 +SET SQL_MODE=TRADITIONAL; +EXPLAIN SELECT * FROM t1 WHERE a = '0000-00-00'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref i i 4 const 1 Using where; Using index +Warnings: +Warning 1292 Incorrect date value: '0000-00-00' for column 'a' at row 1 +Warning 1292 Incorrect date value: '0000-00-00' for column 'a' at row 1 +SELECT * FROM t1 WHERE a = '0000-00-00'; +a +0000-00-00 +0000-00-00 +Warnings: +Warning 1292 Incorrect date value: '0000-00-00' for column 'a' at row 1 +Warning 1292 Incorrect date value: '0000-00-00' for column 'a' at row 1 +Warning 1292 Incorrect date value: '0000-00-00' for column 'a' at row 1 +SELECT * FROM t2 WHERE a = '0000-00-00'; +a +0000-00-00 +0000-00-00 +Warnings: +Warning 1292 Incorrect date value: '0000-00-00' for column 'a' at row 1 +Warning 1292 Incorrect date value: '0000-00-00' for column 'a' at row 1 +INSERT INTO t1 VALUES ('0000-00-00'); +ERROR 22007: Incorrect date value: '0000-00-00' for column 'a' at row 1 +SET SQL_MODE=DEFAULT; +DROP TABLE t1,t2; +End of 5.0 tests diff --git a/mysql-test/r/type_datetime.result b/mysql-test/r/type_datetime.result index 590e9b7c9e0..73edfb75ff6 100644 --- a/mysql-test/r/type_datetime.result +++ b/mysql-test/r/type_datetime.result @@ -59,6 +59,8 @@ t drop table t1; CREATE TABLE t1 (a timestamp, b date, c time, d datetime); insert into t1 (b,c,d) values(now(),curtime(),now()); +Warnings: +Note 1265 Data truncated for column 'b' at row 1 select date_format(a,"%Y-%m-%d")=b,right(a+0,6)=c+0,a=d+0 from t1; date_format(a,"%Y-%m-%d")=b right(a+0,6)=c+0 a=d+0 1 1 1 @@ -427,6 +429,67 @@ f1 Warnings: Warning 1292 Incorrect datetime value: '2007010100000' for column 'f1' at row 1 drop table t1; +# +# Bug#27216: functions with parameters of different date types may +# return wrong type of the result. +# +create table t1 (f1 date, f2 datetime, f3 varchar(20)); +create table t2 as select coalesce(f1,f1) as f4 from t1; +desc t2; +Field Type Null Key Default Extra +f4 date YES NULL +create table t3 as select coalesce(f1,f2) as f4 from t1; +desc t3; +Field Type Null Key Default Extra +f4 datetime YES NULL +create table t4 as select coalesce(f2,f2) as f4 from t1; +desc t4; +Field Type Null Key Default Extra +f4 datetime YES NULL +create table t5 as select coalesce(f1,f3) as f4 from t1; +desc t5; +Field Type Null Key Default Extra +f4 varbinary(20) YES NULL +create table t6 as select coalesce(f2,f3) as f4 from t1; +desc t6; +Field Type Null Key Default Extra +f4 varbinary(20) YES NULL +create table t7 as select coalesce(makedate(1997,1),f2) as f4 from t1; +desc t7; +Field Type Null Key Default Extra +f4 datetime YES NULL +create table t8 as select coalesce(cast('01-01-01' as datetime),f2) as f4 +from t1; +desc t8; +Field Type Null Key Default Extra +f4 datetime YES NULL +create table t9 as select case when 1 then cast('01-01-01' as date) +when 0 then cast('01-01-01' as date) end as f4 from t1; +desc t9; +Field Type Null Key Default Extra +f4 date YES NULL +create table t10 as select case when 1 then cast('01-01-01' as datetime) +when 0 then cast('01-01-01' as datetime) end as f4 from t1; +desc t10; +Field Type Null Key Default Extra +f4 datetime YES NULL +create table t11 as select if(1, cast('01-01-01' as datetime), +cast('01-01-01' as date)) as f4 from t1; +desc t11; +Field Type Null Key Default Extra +f4 datetime YES NULL +create table t12 as select least(cast('01-01-01' as datetime), +cast('01-01-01' as date)) as f4 from t1; +desc t12; +Field Type Null Key Default Extra +f4 datetime YES NULL +create table t13 as select ifnull(cast('01-01-01' as datetime), +cast('01-01-01' as date)) as f4 from t1; +desc t13; +Field Type Null Key Default Extra +f4 datetime YES NULL +drop tables t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13; +################################################################### create table t1 (f1 time); insert into t1 set f1 = '45:44:44'; insert into t1 set f1 = '15:44:44'; diff --git a/mysql-test/r/type_decimal.result b/mysql-test/r/type_decimal.result index 65a72e0aa9b..a438755ce6b 100644 --- a/mysql-test/r/type_decimal.result +++ b/mysql-test/r/type_decimal.result @@ -800,10 +800,93 @@ SELECT ROUND(qty,3), dps, ROUND(qty,dps) FROM t1; ROUND(qty,3) dps ROUND(qty,dps) 1.133 3 1.133 DROP TABLE t1; +SELECT 1 % .123456789123456789123456789123456789123456789123456789123456789123456789123456789 AS '%'; +% +0.012345687012345687012345687012345687012345687012345687012345687012345687000000000 +SELECT MOD(1, .123456789123456789123456789123456789123456789123456789123456789123456789123456789) AS 'MOD()'; +MOD() +0.012345687012345687012345687012345687012345687012345687012345687012345687000000000 create table t1 (f1 decimal(6,6),f2 decimal(6,6) zerofill); insert into t1 values (-0.123456,0.123456); select group_concat(f1),group_concat(f2) from t1; group_concat(f1) group_concat(f2) -0.123456 0.123456 drop table t1; +create table t1 ( +ua_id decimal(22,0) not null, +ua_invited_by_id decimal(22,0) default NULL, +primary key(ua_id) +); +insert into t1 values (123, NULL), (456, NULL); +this must not produce error 1048: +select * from t1 where ua_invited_by_id not in (select ua_id from t1); +ua_id ua_invited_by_id +drop table t1; +DROP TABLE IF EXISTS t3; +DROP TABLE IF EXISTS t4; +CREATE TABLE t1( a NUMERIC, b INT ); +INSERT INTO t1 VALUES (123456, 40), (123456, 40); +SELECT TRUNCATE( a, b ) AS c FROM t1 ORDER BY c; +c +123456 +123456 +SELECT ROUND( a, b ) AS c FROM t1 ORDER BY c; +c +123456 +123456 +SELECT ROUND( a, 100 ) AS c FROM t1 ORDER BY c; +c +123456.000000000000000000000000000000 +123456.000000000000000000000000000000 +CREATE TABLE t2( a NUMERIC, b INT ); +INSERT INTO t2 VALUES (123456, 100); +SELECT TRUNCATE( a, b ) AS c FROM t2 ORDER BY c; +c +123456 +SELECT ROUND( a, b ) AS c FROM t2 ORDER BY c; +c +123456 +CREATE TABLE t3( a DECIMAL, b INT ); +INSERT INTO t3 VALUES (123456, 40), (123456, 40); +SELECT TRUNCATE( a, b ) AS c FROM t3 ORDER BY c; +c +123456 +123456 +SELECT ROUND( a, b ) AS c FROM t3 ORDER BY c; +c +123456 +123456 +SELECT ROUND( a, 100 ) AS c FROM t3 ORDER BY c; +c +123456.000000000000000000000000000000 +123456.000000000000000000000000000000 +CREATE TABLE t4( a DECIMAL, b INT ); +INSERT INTO t4 VALUES (123456, 40), (123456, 40); +SELECT TRUNCATE( a, b ) AS c FROM t4 ORDER BY c; +c +123456 +123456 +SELECT ROUND( a, b ) AS c FROM t4 ORDER BY c; +c +123456 +123456 +SELECT ROUND( a, 100 ) AS c FROM t4 ORDER BY c; +c +123456.000000000000000000000000000000 +123456.000000000000000000000000000000 +delete from t1; +INSERT INTO t1 VALUES (1234567890, 20), (999.99, 5); +Warnings: +Note 1265 Data truncated for column 'a' at row 2 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` decimal(10,0) default NULL, + `b` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +select round(a,b) as c from t1 order by c; +c +1000 +1234567890 +DROP TABLE t1, t2, t3, t4; End of 5.0 tests diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result index 9e52fbeac1a..47cd96b90b7 100644 --- a/mysql-test/r/variables.result +++ b/mysql-test/r/variables.result @@ -675,6 +675,9 @@ set @@query_prealloc_size = @test; select @@query_prealloc_size = @test; @@query_prealloc_size = @test 1 +set global sql_mode=repeat('a',80); +ERROR 42000: Variable 'sql_mode' can't be set to the value of 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +End of 4.1 tests create table t1 (a int); select a into @x from t1; Warnings: @@ -793,6 +796,22 @@ ERROR HY000: Variable 'hostname' is a read only variable show variables like 'hostname'; Variable_name Value hostname # +SHOW VARIABLES LIKE 'log'; +Variable_name Value +log ON +SELECT @@log; +@@log +1 +SET GLOBAL log=0; +ERROR HY000: Variable 'log' is a read only variable +SHOW VARIABLES LIKE 'log_slow_queries'; +Variable_name Value +log_slow_queries ON +SELECT @@log_slow_queries; +@@log_slow_queries +1 +SET GLOBAL log_slow_queries=0; +ERROR HY000: Variable 'log_slow_queries' is a read only variable End of 5.0 tests set global binlog_cache_size =@my_binlog_cache_size; set global connect_timeout =@my_connect_timeout; diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index c5c6b675146..0e3d650c571 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -625,7 +625,7 @@ drop table t1; create table t1 (a int, b int); create view v1 as select a, sum(b) from t1 group by a; select b from v1 use index (some_index) where b=1; -ERROR HY000: Key 'some_index' doesn't exist in table 'v1' +ERROR HY000: Incorrect usage of USE INDEX and VIEW drop view v1; drop table t1; create table t1 (col1 char(5),col2 char(5)); @@ -2706,18 +2706,19 @@ CREATE TABLE t1( fName varchar(25) NOT NULL, lName varchar(25) NOT NULL, DOB date NOT NULL, +test_date date NOT NULL, uID int unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY); -INSERT INTO t1(fName, lName, DOB) VALUES -('Hank', 'Hill', '1964-09-29'), -('Tom', 'Adams', '1908-02-14'), -('Homer', 'Simpson', '1968-03-05'); +INSERT INTO t1(fName, lName, DOB, test_date) VALUES +('Hank', 'Hill', '1964-09-29', '2007-01-01'), +('Tom', 'Adams', '1908-02-14', '2007-01-01'), +('Homer', 'Simpson', '1968-03-05', '2007-01-01'); CREATE VIEW v1 AS -SELECT (year(now())-year(DOB)) AS Age +SELECT (year(test_date)-year(DOB)) AS Age FROM t1 HAVING Age < 75; SHOW CREATE VIEW v1; View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select (year(now()) - year(`t1`.`DOB`)) AS `Age` from `t1` having (`Age` < 75) -SELECT (year(now())-year(DOB)) AS Age FROM t1 HAVING Age < 75; +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) +SELECT (year(test_date)-year(DOB)) AS Age FROM t1 HAVING Age < 75; Age 43 39 @@ -3562,4 +3563,43 @@ table_name is_updatable v1 NO drop view v1; drop table t1; +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2); +CREATE VIEW v1 AS SELECT * FROM t1; +SELECT * FROM v1 USE KEY(non_existant); +ERROR HY000: Incorrect usage of USE INDEX and VIEW +SELECT * FROM v1 FORCE KEY(non_existant); +ERROR HY000: Incorrect usage of FORCE INDEX and VIEW +SELECT * FROM v1 IGNORE KEY(non_existant); +ERROR HY000: Incorrect usage of IGNORE INDEX and VIEW +DROP VIEW v1; +DROP TABLE t1; +CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT, b INT NOT NULL DEFAULT 0, +PRIMARY KEY(a), KEY (b)); +INSERT INTO t1 VALUES (),(),(),(),(),(),(),(),(),(),(),(),(),(),(); +CREATE VIEW v1 AS SELECT * FROM t1 FORCE KEY (PRIMARY,b) ORDER BY a; +SHOW CREATE VIEW v1; +View Create View +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a`,`t1`.`b` AS `b` from `t1` FORCE INDEX (PRIMARY,`b`) order by `t1`.`a` +EXPLAIN SELECT * FROM v1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL PRIMARY 4 NULL 15 +CREATE VIEW v2 AS SELECT * FROM t1 USE KEY () ORDER BY a; +SHOW CREATE VIEW v2; +View Create View +v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `t1`.`a` AS `a`,`t1`.`b` AS `b` from `t1` USE INDEX () order by `t1`.`a` +EXPLAIN SELECT * FROM v2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 15 Using filesort +CREATE VIEW v3 AS SELECT * FROM t1 IGNORE KEY (b) ORDER BY a; +SHOW CREATE VIEW v3; +View Create View +v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `t1`.`a` AS `a`,`t1`.`b` AS `b` from `t1` IGNORE INDEX (`b`) order by `t1`.`a` +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 15 Using filesort +DROP VIEW v1; +DROP VIEW v2; +DROP VIEW v3; +DROP TABLE t1; End of 5.0 tests. diff --git a/mysql-test/r/view_grant.result b/mysql-test/r/view_grant.result index 0f9ce47dec6..eef61c65fb8 100644 --- a/mysql-test/r/view_grant.result +++ b/mysql-test/r/view_grant.result @@ -776,15 +776,60 @@ GRANT CREATE VIEW ON db26813.v2 TO u26813@localhost; GRANT DROP, CREATE VIEW ON db26813.v3 TO u26813@localhost; GRANT SELECT ON db26813.t1 TO u26813@localhost; ALTER VIEW v1 AS SELECT f2 FROM t1; -ERROR 42000: CREATE VIEW command denied to user 'u26813'@'localhost' for table 'v1' +ERROR 42000: Access denied; you need the SUPER privilege for this operation ALTER VIEW v2 AS SELECT f2 FROM t1; -ERROR 42000: DROP command denied to user 'u26813'@'localhost' for table 'v2' +ERROR 42000: Access denied; you need the SUPER privilege for this operation ALTER VIEW v3 AS SELECT f2 FROM t1; +ERROR 42000: Access denied; you need the SUPER privilege for this operation SHOW CREATE VIEW v3; View Create View -v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `t1`.`f2` AS `f2` from `t1` +v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `t1`.`f1` AS `f1` from `t1` DROP USER u26813@localhost; DROP DATABASE db26813; +# +# Bug#29908: A user can gain additional access through the ALTER VIEW. +# +CREATE DATABASE mysqltest_29908; +USE mysqltest_29908; +CREATE TABLE t1(f1 INT, f2 INT); +CREATE USER u29908_1@localhost; +CREATE DEFINER = u29908_1@localhost VIEW v1 AS SELECT f1 FROM t1; +CREATE DEFINER = u29908_1@localhost SQL SECURITY INVOKER VIEW v2 AS +SELECT f1 FROM t1; +GRANT DROP, CREATE VIEW, SHOW VIEW ON mysqltest_29908.v1 TO u29908_1@localhost; +GRANT DROP, CREATE VIEW, SHOW VIEW ON mysqltest_29908.v2 TO u29908_1@localhost; +GRANT SELECT ON mysqltest_29908.t1 TO u29908_1@localhost; +CREATE USER u29908_2@localhost; +GRANT DROP, CREATE VIEW ON mysqltest_29908.v1 TO u29908_2@localhost; +GRANT DROP, CREATE VIEW, SHOW VIEW ON mysqltest_29908.v2 TO u29908_2@localhost; +GRANT SELECT ON mysqltest_29908.t1 TO u29908_2@localhost; +ALTER VIEW v1 AS SELECT f2 FROM t1; +ERROR 42000: Access denied; you need the SUPER privilege for this operation +ALTER VIEW v2 AS SELECT f2 FROM t1; +ERROR 42000: Access denied; you need the SUPER privilege for this operation +SHOW CREATE VIEW v2; +View Create View +v2 CREATE ALGORITHM=UNDEFINED DEFINER=`u29908_1`@`localhost` SQL SECURITY INVOKER VIEW `v2` AS select `t1`.`f1` AS `f1` from `t1` +ALTER VIEW v1 AS SELECT f2 FROM t1; +SHOW CREATE VIEW v1; +View Create View +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`u29908_1`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f2` AS `f2` from `t1` +ALTER VIEW v2 AS SELECT f2 FROM t1; +SHOW CREATE VIEW v2; +View Create View +v2 CREATE ALGORITHM=UNDEFINED DEFINER=`u29908_1`@`localhost` SQL SECURITY INVOKER VIEW `v2` AS select `t1`.`f2` AS `f2` from `t1` +ALTER VIEW v1 AS SELECT f1 FROM t1; +SHOW CREATE VIEW v1; +View Create View +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`u29908_1`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f1` AS `f1` from `t1` +ALTER VIEW v2 AS SELECT f1 FROM t1; +SHOW CREATE VIEW v2; +View Create View +v2 CREATE ALGORITHM=UNDEFINED DEFINER=`u29908_1`@`localhost` SQL SECURITY INVOKER VIEW `v2` AS select `t1`.`f1` AS `f1` from `t1` +DROP USER u29908_1@localhost; +DROP USER u29908_2@localhost; +DROP DATABASE mysqltest_29908; +####################################################################### DROP DATABASE IF EXISTS mysqltest1; DROP DATABASE IF EXISTS mysqltest2; CREATE DATABASE mysqltest1; diff --git a/mysql-test/suite/funcs_1/r/innodb__datadict.result b/mysql-test/suite/funcs_1/r/innodb__datadict.result index ff6de471cb0..c3bdca3ff0a 100644 --- a/mysql-test/suite/funcs_1/r/innodb__datadict.result +++ b/mysql-test/suite/funcs_1/r/innodb__datadict.result @@ -1786,7 +1786,7 @@ NULL information_schema COLUMNS NUMERIC_PRECISION 11 NULL YES bigint NULL NULL 1 NULL information_schema COLUMNS NUMERIC_SCALE 12 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) select NULL information_schema COLUMNS CHARACTER_SET_NAME 13 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema COLUMNS COLLATION_NAME 14 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select -NULL information_schema COLUMNS COLUMN_TYPE 15 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema COLUMNS COLUMN_TYPE 15 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema COLUMNS COLUMN_KEY 16 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select NULL information_schema COLUMNS EXTRA 17 NO varchar 20 60 NULL NULL utf8 utf8_general_ci varchar(20) select NULL information_schema COLUMNS PRIVILEGES 18 NO varchar 80 240 NULL NULL utf8 utf8_general_ci varchar(80) select @@ -1827,7 +1827,7 @@ NULL information_schema ROUTINES SQL_PATH 14 NULL YES varchar 64 192 NULL NULL u NULL information_schema ROUTINES SECURITY_TYPE 15 NO varchar 7 21 NULL NULL utf8 utf8_general_ci varchar(7) select NULL information_schema ROUTINES CREATED 16 0000-00-00 00:00:00 NO datetime NULL NULL NULL NULL NULL NULL datetime select NULL information_schema ROUTINES LAST_ALTERED 17 0000-00-00 00:00:00 NO datetime NULL NULL NULL NULL NULL NULL datetime select -NULL information_schema ROUTINES SQL_MODE 18 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema ROUTINES SQL_MODE 18 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema ROUTINES ROUTINE_COMMENT 19 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema ROUTINES DEFINER 20 NO varchar 77 231 NULL NULL utf8 utf8_general_ci varchar(77) select NULL information_schema SCHEMATA CATALOG_NAME 1 NULL YES varchar 4096 12288 NULL NULL utf8 utf8_general_ci varchar(4096) select @@ -1897,7 +1897,7 @@ NULL information_schema TRIGGERS EVENT_OBJECT_SCHEMA 6 NO varchar 64 192 NULL N NULL information_schema TRIGGERS EVENT_OBJECT_TABLE 7 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema TRIGGERS ACTION_ORDER 8 0 NO bigint NULL NULL 19 0 NULL NULL bigint(4) select NULL information_schema TRIGGERS ACTION_CONDITION 9 NULL YES longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select -NULL information_schema TRIGGERS ACTION_STATEMENT 10 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema TRIGGERS ACTION_STATEMENT 10 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema TRIGGERS ACTION_ORIENTATION 11 NO varchar 9 27 NULL NULL utf8 utf8_general_ci varchar(9) select NULL information_schema TRIGGERS ACTION_TIMING 12 NO varchar 6 18 NULL NULL utf8 utf8_general_ci varchar(6) select NULL information_schema TRIGGERS ACTION_REFERENCE_OLD_TABLE 13 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select @@ -1905,8 +1905,8 @@ NULL information_schema TRIGGERS ACTION_REFERENCE_NEW_TABLE 14 NULL YES varchar NULL information_schema TRIGGERS ACTION_REFERENCE_OLD_ROW 15 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select NULL information_schema TRIGGERS ACTION_REFERENCE_NEW_ROW 16 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select NULL information_schema TRIGGERS CREATED 17 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select -NULL information_schema TRIGGERS SQL_MODE 18 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select -NULL information_schema TRIGGERS DEFINER 19 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema TRIGGERS SQL_MODE 18 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema TRIGGERS DEFINER 19 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema USER_PRIVILEGES GRANTEE 1 NO varchar 81 243 NULL NULL utf8 utf8_general_ci varchar(81) select NULL information_schema USER_PRIVILEGES TABLE_CATALOG 2 NULL YES varchar 4096 12288 NULL NULL utf8 utf8_general_ci varchar(4096) select NULL information_schema USER_PRIVILEGES PRIVILEGE_TYPE 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select @@ -1914,7 +1914,7 @@ NULL information_schema USER_PRIVILEGES IS_GRANTABLE 4 NO varchar 3 9 NULL NULL NULL information_schema VIEWS TABLE_CATALOG 1 NULL YES varchar 4096 12288 NULL NULL utf8 utf8_general_ci varchar(4096) select NULL information_schema VIEWS TABLE_SCHEMA 2 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema VIEWS TABLE_NAME 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select -NULL information_schema VIEWS VIEW_DEFINITION 4 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema VIEWS VIEW_DEFINITION 4 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema VIEWS CHECK_OPTION 5 NO varchar 8 24 NULL NULL utf8 utf8_general_ci varchar(8) select NULL information_schema VIEWS IS_UPDATABLE 6 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select NULL information_schema VIEWS DEFINER 7 NO varchar 77 231 NULL NULL utf8 utf8_general_ci varchar(77) select @@ -2457,7 +2457,7 @@ cp932 cp932_japanese_ci SJIS for Windows Japanese 2 eucjpms eucjpms_japanese_ci UJIS for Windows Japanese 3 select sum(id) from collations; sum(id) -10995 +10741 select collation_name, character_set_name into @x,@y from collation_character_set_applicability limit 1; select @x, @y; @@ -4381,10 +4381,10 @@ COUNT(*) 36 SELECT COUNT(*) FROM information_schema. collations ; COUNT(*) -127 +126 SELECT COUNT(*) FROM information_schema. collation_character_set_applicability ; COUNT(*) -127 +126 SELECT COUNT(*) FROM information_schema. routines ; COUNT(*) 1 @@ -7240,7 +7240,6 @@ utf8_roman_ci utf8 utf8_persian_ci utf8 utf8_esperanto_ci utf8 utf8_hungarian_ci utf8 -utf8_general_cs utf8 ucs2_general_ci ucs2 ucs2_bin ucs2 ucs2_unicode_ci ucs2 @@ -7872,7 +7871,6 @@ utf8_roman_ci utf8_persian_ci utf8_esperanto_ci utf8_hungarian_ci -utf8_general_cs ucs2_general_ci ucs2_bin ucs2_unicode_ci @@ -8237,7 +8235,6 @@ utf8_roman_ci utf8 207 Yes 8 utf8_persian_ci utf8 208 Yes 8 utf8_esperanto_ci utf8 209 Yes 8 utf8_hungarian_ci utf8 210 Yes 8 -utf8_general_cs utf8 254 Yes 1 ucs2_general_ci ucs2 35 Yes Yes 1 ucs2_bin ucs2 90 Yes 1 ucs2_unicode_ci ucs2 128 Yes 8 @@ -8399,7 +8396,6 @@ utf8_roman_ci utf8 utf8_persian_ci utf8 utf8_esperanto_ci utf8 utf8_hungarian_ci utf8 -utf8_general_cs utf8 ucs2_general_ci ucs2 ucs2_bin ucs2 ucs2_unicode_ci ucs2 @@ -8633,7 +8629,7 @@ NUMERIC_PRECISION bigint(21) YES NULL NUMERIC_SCALE bigint(21) YES NULL CHARACTER_SET_NAME varchar(64) YES NULL COLLATION_NAME varchar(64) YES NULL -COLUMN_TYPE longtext NO +COLUMN_TYPE longtext NO NULL COLUMN_KEY varchar(3) NO EXTRA varchar(20) NO PRIVILEGES varchar(80) NO @@ -8686,7 +8682,7 @@ NULL information_schema COLUMNS NUMERIC_PRECISION 11 NULL YES bigint NULL NULL 1 NULL information_schema COLUMNS NUMERIC_SCALE 12 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) select NULL information_schema COLUMNS CHARACTER_SET_NAME 13 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema COLUMNS COLLATION_NAME 14 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select -NULL information_schema COLUMNS COLUMN_TYPE 15 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema COLUMNS COLUMN_TYPE 15 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema COLUMNS COLUMN_KEY 16 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select NULL information_schema COLUMNS EXTRA 17 NO varchar 20 60 NULL NULL utf8 utf8_general_ci varchar(20) select NULL information_schema COLUMNS PRIVILEGES 18 NO varchar 80 240 NULL NULL utf8 utf8_general_ci varchar(80) select @@ -8741,7 +8737,7 @@ NULL information_schema COLUMNS NUMERIC_PRECISION 11 NULL YES bigint NULL NULL 1 NULL information_schema COLUMNS NUMERIC_SCALE 12 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) select NULL information_schema COLUMNS CHARACTER_SET_NAME 13 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema COLUMNS COLLATION_NAME 14 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select -NULL information_schema COLUMNS COLUMN_TYPE 15 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema COLUMNS COLUMN_TYPE 15 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema COLUMNS COLUMN_KEY 16 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select NULL information_schema COLUMNS EXTRA 17 NO varchar 20 60 NULL NULL utf8 utf8_general_ci varchar(20) select NULL information_schema COLUMNS PRIVILEGES 18 NO varchar 80 240 NULL NULL utf8 utf8_general_ci varchar(80) select @@ -8782,7 +8778,7 @@ NULL information_schema ROUTINES SQL_PATH 14 NULL YES varchar 64 192 NULL NULL u NULL information_schema ROUTINES SECURITY_TYPE 15 NO varchar 7 21 NULL NULL utf8 utf8_general_ci varchar(7) select NULL information_schema ROUTINES CREATED 16 0000-00-00 00:00:00 NO datetime NULL NULL NULL NULL NULL NULL datetime select NULL information_schema ROUTINES LAST_ALTERED 17 0000-00-00 00:00:00 NO datetime NULL NULL NULL NULL NULL NULL datetime select -NULL information_schema ROUTINES SQL_MODE 18 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema ROUTINES SQL_MODE 18 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema ROUTINES ROUTINE_COMMENT 19 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema ROUTINES DEFINER 20 NO varchar 77 231 NULL NULL utf8 utf8_general_ci varchar(77) select NULL information_schema SCHEMATA CATALOG_NAME 1 NULL YES varchar 4096 12288 NULL NULL utf8 utf8_general_ci varchar(4096) select @@ -8852,7 +8848,7 @@ NULL information_schema TRIGGERS EVENT_OBJECT_SCHEMA 6 NO varchar 64 192 NULL N NULL information_schema TRIGGERS EVENT_OBJECT_TABLE 7 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema TRIGGERS ACTION_ORDER 8 0 NO bigint NULL NULL 19 0 NULL NULL bigint(4) select NULL information_schema TRIGGERS ACTION_CONDITION 9 NULL YES longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select -NULL information_schema TRIGGERS ACTION_STATEMENT 10 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema TRIGGERS ACTION_STATEMENT 10 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema TRIGGERS ACTION_ORIENTATION 11 NO varchar 9 27 NULL NULL utf8 utf8_general_ci varchar(9) select NULL information_schema TRIGGERS ACTION_TIMING 12 NO varchar 6 18 NULL NULL utf8 utf8_general_ci varchar(6) select NULL information_schema TRIGGERS ACTION_REFERENCE_OLD_TABLE 13 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select @@ -8860,8 +8856,8 @@ NULL information_schema TRIGGERS ACTION_REFERENCE_NEW_TABLE 14 NULL YES varchar NULL information_schema TRIGGERS ACTION_REFERENCE_OLD_ROW 15 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select NULL information_schema TRIGGERS ACTION_REFERENCE_NEW_ROW 16 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select NULL information_schema TRIGGERS CREATED 17 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select -NULL information_schema TRIGGERS SQL_MODE 18 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select -NULL information_schema TRIGGERS DEFINER 19 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema TRIGGERS SQL_MODE 18 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema TRIGGERS DEFINER 19 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema USER_PRIVILEGES GRANTEE 1 NO varchar 81 243 NULL NULL utf8 utf8_general_ci varchar(81) select NULL information_schema USER_PRIVILEGES TABLE_CATALOG 2 NULL YES varchar 4096 12288 NULL NULL utf8 utf8_general_ci varchar(4096) select NULL information_schema USER_PRIVILEGES PRIVILEGE_TYPE 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select @@ -8869,7 +8865,7 @@ NULL information_schema USER_PRIVILEGES IS_GRANTABLE 4 NO varchar 3 9 NULL NULL NULL information_schema VIEWS TABLE_CATALOG 1 NULL YES varchar 4096 12288 NULL NULL utf8 utf8_general_ci varchar(4096) select NULL information_schema VIEWS TABLE_SCHEMA 2 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema VIEWS TABLE_NAME 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select -NULL information_schema VIEWS VIEW_DEFINITION 4 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema VIEWS VIEW_DEFINITION 4 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema VIEWS CHECK_OPTION 5 NO varchar 8 24 NULL NULL utf8 utf8_general_ci varchar(8) select NULL information_schema VIEWS IS_UPDATABLE 6 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select NULL information_schema VIEWS DEFINER 7 NO varchar 77 231 NULL NULL utf8 utf8_general_ci varchar(77) select @@ -9379,7 +9375,7 @@ NULL information_schema COLUMNS NUMERIC_PRECISION 11 NULL YES bigint NULL NULL 1 NULL information_schema COLUMNS NUMERIC_SCALE 12 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) select NULL information_schema COLUMNS CHARACTER_SET_NAME 13 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema COLUMNS COLLATION_NAME 14 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select -NULL information_schema COLUMNS COLUMN_TYPE 15 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema COLUMNS COLUMN_TYPE 15 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema COLUMNS COLUMN_KEY 16 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select NULL information_schema COLUMNS EXTRA 17 NO varchar 20 60 NULL NULL utf8 utf8_general_ci varchar(20) select NULL information_schema COLUMNS PRIVILEGES 18 NO varchar 80 240 NULL NULL utf8 utf8_general_ci varchar(80) select @@ -9420,7 +9416,7 @@ NULL information_schema ROUTINES SQL_PATH 14 NULL YES varchar 64 192 NULL NULL u NULL information_schema ROUTINES SECURITY_TYPE 15 NO varchar 7 21 NULL NULL utf8 utf8_general_ci varchar(7) select NULL information_schema ROUTINES CREATED 16 0000-00-00 00:00:00 NO datetime NULL NULL NULL NULL NULL NULL datetime select NULL information_schema ROUTINES LAST_ALTERED 17 0000-00-00 00:00:00 NO datetime NULL NULL NULL NULL NULL NULL datetime select -NULL information_schema ROUTINES SQL_MODE 18 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema ROUTINES SQL_MODE 18 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema ROUTINES ROUTINE_COMMENT 19 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema ROUTINES DEFINER 20 NO varchar 77 231 NULL NULL utf8 utf8_general_ci varchar(77) select NULL information_schema SCHEMATA CATALOG_NAME 1 NULL YES varchar 4096 12288 NULL NULL utf8 utf8_general_ci varchar(4096) select @@ -9490,7 +9486,7 @@ NULL information_schema TRIGGERS EVENT_OBJECT_SCHEMA 6 NO varchar 64 192 NULL N NULL information_schema TRIGGERS EVENT_OBJECT_TABLE 7 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema TRIGGERS ACTION_ORDER 8 0 NO bigint NULL NULL 19 0 NULL NULL bigint(4) select NULL information_schema TRIGGERS ACTION_CONDITION 9 NULL YES longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select -NULL information_schema TRIGGERS ACTION_STATEMENT 10 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema TRIGGERS ACTION_STATEMENT 10 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema TRIGGERS ACTION_ORIENTATION 11 NO varchar 9 27 NULL NULL utf8 utf8_general_ci varchar(9) select NULL information_schema TRIGGERS ACTION_TIMING 12 NO varchar 6 18 NULL NULL utf8 utf8_general_ci varchar(6) select NULL information_schema TRIGGERS ACTION_REFERENCE_OLD_TABLE 13 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select @@ -9498,8 +9494,8 @@ NULL information_schema TRIGGERS ACTION_REFERENCE_NEW_TABLE 14 NULL YES varchar NULL information_schema TRIGGERS ACTION_REFERENCE_OLD_ROW 15 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select NULL information_schema TRIGGERS ACTION_REFERENCE_NEW_ROW 16 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select NULL information_schema TRIGGERS CREATED 17 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select -NULL information_schema TRIGGERS SQL_MODE 18 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select -NULL information_schema TRIGGERS DEFINER 19 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema TRIGGERS SQL_MODE 18 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema TRIGGERS DEFINER 19 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema USER_PRIVILEGES GRANTEE 1 NO varchar 81 243 NULL NULL utf8 utf8_general_ci varchar(81) select NULL information_schema USER_PRIVILEGES TABLE_CATALOG 2 NULL YES varchar 4096 12288 NULL NULL utf8 utf8_general_ci varchar(4096) select NULL information_schema USER_PRIVILEGES PRIVILEGE_TYPE 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select @@ -9507,7 +9503,7 @@ NULL information_schema USER_PRIVILEGES IS_GRANTABLE 4 NO varchar 3 9 NULL NULL NULL information_schema VIEWS TABLE_CATALOG 1 NULL YES varchar 4096 12288 NULL NULL utf8 utf8_general_ci varchar(4096) select NULL information_schema VIEWS TABLE_SCHEMA 2 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema VIEWS TABLE_NAME 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select -NULL information_schema VIEWS VIEW_DEFINITION 4 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema VIEWS VIEW_DEFINITION 4 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema VIEWS CHECK_OPTION 5 NO varchar 8 24 NULL NULL utf8 utf8_general_ci varchar(8) select NULL information_schema VIEWS IS_UPDATABLE 6 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select NULL information_schema VIEWS DEFINER 7 NO varchar 77 231 NULL NULL utf8 utf8_general_ci varchar(77) select @@ -9813,7 +9809,7 @@ NULL information_schema COLUMNS NUMERIC_PRECISION 11 NULL YES bigint NULL NULL 1 NULL information_schema COLUMNS NUMERIC_SCALE 12 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) select NULL information_schema COLUMNS CHARACTER_SET_NAME 13 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema COLUMNS COLLATION_NAME 14 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select -NULL information_schema COLUMNS COLUMN_TYPE 15 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema COLUMNS COLUMN_TYPE 15 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema COLUMNS COLUMN_KEY 16 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select NULL information_schema COLUMNS EXTRA 17 NO varchar 20 60 NULL NULL utf8 utf8_general_ci varchar(20) select NULL information_schema COLUMNS PRIVILEGES 18 NO varchar 80 240 NULL NULL utf8 utf8_general_ci varchar(80) select @@ -9854,7 +9850,7 @@ NULL information_schema ROUTINES SQL_PATH 14 NULL YES varchar 64 192 NULL NULL u NULL information_schema ROUTINES SECURITY_TYPE 15 NO varchar 7 21 NULL NULL utf8 utf8_general_ci varchar(7) select NULL information_schema ROUTINES CREATED 16 0000-00-00 00:00:00 NO datetime NULL NULL NULL NULL NULL NULL datetime select NULL information_schema ROUTINES LAST_ALTERED 17 0000-00-00 00:00:00 NO datetime NULL NULL NULL NULL NULL NULL datetime select -NULL information_schema ROUTINES SQL_MODE 18 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema ROUTINES SQL_MODE 18 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema ROUTINES ROUTINE_COMMENT 19 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema ROUTINES DEFINER 20 NO varchar 77 231 NULL NULL utf8 utf8_general_ci varchar(77) select NULL information_schema SCHEMATA CATALOG_NAME 1 NULL YES varchar 4096 12288 NULL NULL utf8 utf8_general_ci varchar(4096) select @@ -9924,7 +9920,7 @@ NULL information_schema TRIGGERS EVENT_OBJECT_SCHEMA 6 NO varchar 64 192 NULL N NULL information_schema TRIGGERS EVENT_OBJECT_TABLE 7 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema TRIGGERS ACTION_ORDER 8 0 NO bigint NULL NULL 19 0 NULL NULL bigint(4) select NULL information_schema TRIGGERS ACTION_CONDITION 9 NULL YES longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select -NULL information_schema TRIGGERS ACTION_STATEMENT 10 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema TRIGGERS ACTION_STATEMENT 10 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema TRIGGERS ACTION_ORIENTATION 11 NO varchar 9 27 NULL NULL utf8 utf8_general_ci varchar(9) select NULL information_schema TRIGGERS ACTION_TIMING 12 NO varchar 6 18 NULL NULL utf8 utf8_general_ci varchar(6) select NULL information_schema TRIGGERS ACTION_REFERENCE_OLD_TABLE 13 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select @@ -9932,8 +9928,8 @@ NULL information_schema TRIGGERS ACTION_REFERENCE_NEW_TABLE 14 NULL YES varchar NULL information_schema TRIGGERS ACTION_REFERENCE_OLD_ROW 15 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select NULL information_schema TRIGGERS ACTION_REFERENCE_NEW_ROW 16 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select NULL information_schema TRIGGERS CREATED 17 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select -NULL information_schema TRIGGERS SQL_MODE 18 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select -NULL information_schema TRIGGERS DEFINER 19 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema TRIGGERS SQL_MODE 18 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema TRIGGERS DEFINER 19 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema USER_PRIVILEGES GRANTEE 1 NO varchar 81 243 NULL NULL utf8 utf8_general_ci varchar(81) select NULL information_schema USER_PRIVILEGES TABLE_CATALOG 2 NULL YES varchar 4096 12288 NULL NULL utf8 utf8_general_ci varchar(4096) select NULL information_schema USER_PRIVILEGES PRIVILEGE_TYPE 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select @@ -9941,7 +9937,7 @@ NULL information_schema USER_PRIVILEGES IS_GRANTABLE 4 NO varchar 3 9 NULL NULL NULL information_schema VIEWS TABLE_CATALOG 1 NULL YES varchar 4096 12288 NULL NULL utf8 utf8_general_ci varchar(4096) select NULL information_schema VIEWS TABLE_SCHEMA 2 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema VIEWS TABLE_NAME 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select -NULL information_schema VIEWS VIEW_DEFINITION 4 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema VIEWS VIEW_DEFINITION 4 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema VIEWS CHECK_OPTION 5 NO varchar 8 24 NULL NULL utf8 utf8_general_ci varchar(8) select NULL information_schema VIEWS IS_UPDATABLE 6 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select NULL information_schema VIEWS DEFINER 7 NO varchar 77 231 NULL NULL utf8 utf8_general_ci varchar(77) select @@ -11118,7 +11114,7 @@ SQL_PATH varchar(64) YES NULL SECURITY_TYPE varchar(7) NO CREATED datetime NO 0000-00-00 00:00:00 LAST_ALTERED datetime NO 0000-00-00 00:00:00 -SQL_MODE longtext NO +SQL_MODE longtext NO NULL ROUTINE_COMMENT varchar(64) NO DEFINER varchar(77) NO SHOW CREATE TABLE routines; @@ -11173,7 +11169,7 @@ NULL information_schema ROUTINES SQL_PATH 14 NULL YES varchar 64 192 NULL NULL u NULL information_schema ROUTINES SECURITY_TYPE 15 NO varchar 7 21 NULL NULL utf8 utf8_general_ci varchar(7) select NULL information_schema ROUTINES CREATED 16 0000-00-00 00:00:00 NO datetime NULL NULL NULL NULL NULL NULL datetime select NULL information_schema ROUTINES LAST_ALTERED 17 0000-00-00 00:00:00 NO datetime NULL NULL NULL NULL NULL NULL datetime select -NULL information_schema ROUTINES SQL_MODE 18 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema ROUTINES SQL_MODE 18 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema ROUTINES ROUTINE_COMMENT 19 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema ROUTINES DEFINER 20 NO varchar 77 231 NULL NULL utf8 utf8_general_ci varchar(77) select @@ -12024,7 +12020,7 @@ Field Type Null Key Default Extra TABLE_CATALOG varchar(4096) YES NULL TABLE_SCHEMA varchar(64) NO TABLE_NAME varchar(64) NO -VIEW_DEFINITION longtext NO +VIEW_DEFINITION longtext NO NULL CHECK_OPTION varchar(8) NO IS_UPDATABLE varchar(3) NO DEFINER varchar(77) NO @@ -12055,7 +12051,7 @@ TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION COLUMN_DEFAUL NULL information_schema VIEWS TABLE_CATALOG 1 NULL YES varchar 4096 12288 NULL NULL utf8 utf8_general_ci varchar(4096) select NULL information_schema VIEWS TABLE_SCHEMA 2 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema VIEWS TABLE_NAME 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select -NULL information_schema VIEWS VIEW_DEFINITION 4 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema VIEWS VIEW_DEFINITION 4 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema VIEWS CHECK_OPTION 5 NO varchar 8 24 NULL NULL utf8 utf8_general_ci varchar(8) select NULL information_schema VIEWS IS_UPDATABLE 6 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select NULL information_schema VIEWS DEFINER 7 NO varchar 77 231 NULL NULL utf8 utf8_general_ci varchar(77) select @@ -12813,7 +12809,7 @@ EVENT_OBJECT_SCHEMA varchar(64) NO EVENT_OBJECT_TABLE varchar(64) NO ACTION_ORDER bigint(4) NO 0 ACTION_CONDITION longtext YES NULL -ACTION_STATEMENT longtext NO +ACTION_STATEMENT longtext NO NULL ACTION_ORIENTATION varchar(9) NO ACTION_TIMING varchar(6) NO ACTION_REFERENCE_OLD_TABLE varchar(64) YES NULL @@ -12821,8 +12817,8 @@ ACTION_REFERENCE_NEW_TABLE varchar(64) YES NULL ACTION_REFERENCE_OLD_ROW varchar(3) NO ACTION_REFERENCE_NEW_ROW varchar(3) NO CREATED datetime YES NULL -SQL_MODE longtext NO -DEFINER longtext NO +SQL_MODE longtext NO NULL +DEFINER longtext NO NULL SHOW CREATE TABLE triggers; Table Create Table TRIGGERS CREATE TEMPORARY TABLE `TRIGGERS` ( @@ -12866,7 +12862,7 @@ NULL information_schema TRIGGERS EVENT_OBJECT_SCHEMA 6 NO varchar 64 192 NULL N NULL information_schema TRIGGERS EVENT_OBJECT_TABLE 7 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema TRIGGERS ACTION_ORDER 8 0 NO bigint NULL NULL 19 0 NULL NULL bigint(4) select NULL information_schema TRIGGERS ACTION_CONDITION 9 NULL YES longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select -NULL information_schema TRIGGERS ACTION_STATEMENT 10 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema TRIGGERS ACTION_STATEMENT 10 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema TRIGGERS ACTION_ORIENTATION 11 NO varchar 9 27 NULL NULL utf8 utf8_general_ci varchar(9) select NULL information_schema TRIGGERS ACTION_TIMING 12 NO varchar 6 18 NULL NULL utf8 utf8_general_ci varchar(6) select NULL information_schema TRIGGERS ACTION_REFERENCE_OLD_TABLE 13 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select @@ -12874,8 +12870,8 @@ NULL information_schema TRIGGERS ACTION_REFERENCE_NEW_TABLE 14 NULL YES varchar NULL information_schema TRIGGERS ACTION_REFERENCE_OLD_ROW 15 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select NULL information_schema TRIGGERS ACTION_REFERENCE_NEW_ROW 16 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select NULL information_schema TRIGGERS CREATED 17 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select -NULL information_schema TRIGGERS SQL_MODE 18 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select -NULL information_schema TRIGGERS DEFINER 19 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema TRIGGERS SQL_MODE 18 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema TRIGGERS DEFINER 19 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select Testcase 3.2.18.2 + 3.2.18.3: -------------------------------------------------------------------------------- diff --git a/mysql-test/suite/funcs_1/r/memory__datadict.result b/mysql-test/suite/funcs_1/r/memory__datadict.result index b2972796d44..3b3cf65f9f8 100644 --- a/mysql-test/suite/funcs_1/r/memory__datadict.result +++ b/mysql-test/suite/funcs_1/r/memory__datadict.result @@ -1784,7 +1784,7 @@ NULL information_schema COLUMNS NUMERIC_PRECISION 11 NULL YES bigint NULL NULL 1 NULL information_schema COLUMNS NUMERIC_SCALE 12 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) select NULL information_schema COLUMNS CHARACTER_SET_NAME 13 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema COLUMNS COLLATION_NAME 14 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select -NULL information_schema COLUMNS COLUMN_TYPE 15 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema COLUMNS COLUMN_TYPE 15 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema COLUMNS COLUMN_KEY 16 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select NULL information_schema COLUMNS EXTRA 17 NO varchar 20 60 NULL NULL utf8 utf8_general_ci varchar(20) select NULL information_schema COLUMNS PRIVILEGES 18 NO varchar 80 240 NULL NULL utf8 utf8_general_ci varchar(80) select @@ -1825,7 +1825,7 @@ NULL information_schema ROUTINES SQL_PATH 14 NULL YES varchar 64 192 NULL NULL u NULL information_schema ROUTINES SECURITY_TYPE 15 NO varchar 7 21 NULL NULL utf8 utf8_general_ci varchar(7) select NULL information_schema ROUTINES CREATED 16 0000-00-00 00:00:00 NO datetime NULL NULL NULL NULL NULL NULL datetime select NULL information_schema ROUTINES LAST_ALTERED 17 0000-00-00 00:00:00 NO datetime NULL NULL NULL NULL NULL NULL datetime select -NULL information_schema ROUTINES SQL_MODE 18 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema ROUTINES SQL_MODE 18 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema ROUTINES ROUTINE_COMMENT 19 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema ROUTINES DEFINER 20 NO varchar 77 231 NULL NULL utf8 utf8_general_ci varchar(77) select NULL information_schema SCHEMATA CATALOG_NAME 1 NULL YES varchar 4096 12288 NULL NULL utf8 utf8_general_ci varchar(4096) select @@ -1895,7 +1895,7 @@ NULL information_schema TRIGGERS EVENT_OBJECT_SCHEMA 6 NO varchar 64 192 NULL N NULL information_schema TRIGGERS EVENT_OBJECT_TABLE 7 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema TRIGGERS ACTION_ORDER 8 0 NO bigint NULL NULL 19 0 NULL NULL bigint(4) select NULL information_schema TRIGGERS ACTION_CONDITION 9 NULL YES longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select -NULL information_schema TRIGGERS ACTION_STATEMENT 10 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema TRIGGERS ACTION_STATEMENT 10 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema TRIGGERS ACTION_ORIENTATION 11 NO varchar 9 27 NULL NULL utf8 utf8_general_ci varchar(9) select NULL information_schema TRIGGERS ACTION_TIMING 12 NO varchar 6 18 NULL NULL utf8 utf8_general_ci varchar(6) select NULL information_schema TRIGGERS ACTION_REFERENCE_OLD_TABLE 13 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select @@ -1903,8 +1903,8 @@ NULL information_schema TRIGGERS ACTION_REFERENCE_NEW_TABLE 14 NULL YES varchar NULL information_schema TRIGGERS ACTION_REFERENCE_OLD_ROW 15 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select NULL information_schema TRIGGERS ACTION_REFERENCE_NEW_ROW 16 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select NULL information_schema TRIGGERS CREATED 17 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select -NULL information_schema TRIGGERS SQL_MODE 18 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select -NULL information_schema TRIGGERS DEFINER 19 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema TRIGGERS SQL_MODE 18 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema TRIGGERS DEFINER 19 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema USER_PRIVILEGES GRANTEE 1 NO varchar 81 243 NULL NULL utf8 utf8_general_ci varchar(81) select NULL information_schema USER_PRIVILEGES TABLE_CATALOG 2 NULL YES varchar 4096 12288 NULL NULL utf8 utf8_general_ci varchar(4096) select NULL information_schema USER_PRIVILEGES PRIVILEGE_TYPE 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select @@ -1912,7 +1912,7 @@ NULL information_schema USER_PRIVILEGES IS_GRANTABLE 4 NO varchar 3 9 NULL NULL NULL information_schema VIEWS TABLE_CATALOG 1 NULL YES varchar 4096 12288 NULL NULL utf8 utf8_general_ci varchar(4096) select NULL information_schema VIEWS TABLE_SCHEMA 2 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema VIEWS TABLE_NAME 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select -NULL information_schema VIEWS VIEW_DEFINITION 4 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema VIEWS VIEW_DEFINITION 4 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema VIEWS CHECK_OPTION 5 NO varchar 8 24 NULL NULL utf8 utf8_general_ci varchar(8) select NULL information_schema VIEWS IS_UPDATABLE 6 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select NULL information_schema VIEWS DEFINER 7 NO varchar 77 231 NULL NULL utf8 utf8_general_ci varchar(77) select @@ -2440,7 +2440,7 @@ cp932 cp932_japanese_ci SJIS for Windows Japanese 2 eucjpms eucjpms_japanese_ci UJIS for Windows Japanese 3 select sum(id) from collations; sum(id) -10995 +10741 select collation_name, character_set_name into @x,@y from collation_character_set_applicability limit 1; select @x, @y; @@ -4364,10 +4364,10 @@ COUNT(*) 36 SELECT COUNT(*) FROM information_schema. collations ; COUNT(*) -127 +126 SELECT COUNT(*) FROM information_schema. collation_character_set_applicability ; COUNT(*) -127 +126 SELECT COUNT(*) FROM information_schema. routines ; COUNT(*) 1 @@ -7223,7 +7223,6 @@ utf8_roman_ci utf8 utf8_persian_ci utf8 utf8_esperanto_ci utf8 utf8_hungarian_ci utf8 -utf8_general_cs utf8 ucs2_general_ci ucs2 ucs2_bin ucs2 ucs2_unicode_ci ucs2 @@ -7840,7 +7839,6 @@ utf8_roman_ci utf8_persian_ci utf8_esperanto_ci utf8_hungarian_ci -utf8_general_cs ucs2_general_ci ucs2_bin ucs2_unicode_ci @@ -8205,7 +8203,6 @@ utf8_roman_ci utf8 207 Yes 8 utf8_persian_ci utf8 208 Yes 8 utf8_esperanto_ci utf8 209 Yes 8 utf8_hungarian_ci utf8 210 Yes 8 -utf8_general_cs utf8 254 Yes 1 ucs2_general_ci ucs2 35 Yes Yes 1 ucs2_bin ucs2 90 Yes 1 ucs2_unicode_ci ucs2 128 Yes 8 @@ -8367,7 +8364,6 @@ utf8_roman_ci utf8 utf8_persian_ci utf8 utf8_esperanto_ci utf8 utf8_hungarian_ci utf8 -utf8_general_cs utf8 ucs2_general_ci ucs2 ucs2_bin ucs2 ucs2_unicode_ci ucs2 @@ -8601,7 +8597,7 @@ NUMERIC_PRECISION bigint(21) YES NULL NUMERIC_SCALE bigint(21) YES NULL CHARACTER_SET_NAME varchar(64) YES NULL COLLATION_NAME varchar(64) YES NULL -COLUMN_TYPE longtext NO +COLUMN_TYPE longtext NO NULL COLUMN_KEY varchar(3) NO EXTRA varchar(20) NO PRIVILEGES varchar(80) NO @@ -8654,7 +8650,7 @@ NULL information_schema COLUMNS NUMERIC_PRECISION 11 NULL YES bigint NULL NULL 1 NULL information_schema COLUMNS NUMERIC_SCALE 12 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) select NULL information_schema COLUMNS CHARACTER_SET_NAME 13 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema COLUMNS COLLATION_NAME 14 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select -NULL information_schema COLUMNS COLUMN_TYPE 15 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema COLUMNS COLUMN_TYPE 15 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema COLUMNS COLUMN_KEY 16 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select NULL information_schema COLUMNS EXTRA 17 NO varchar 20 60 NULL NULL utf8 utf8_general_ci varchar(20) select NULL information_schema COLUMNS PRIVILEGES 18 NO varchar 80 240 NULL NULL utf8 utf8_general_ci varchar(80) select @@ -8709,7 +8705,7 @@ NULL information_schema COLUMNS NUMERIC_PRECISION 11 NULL YES bigint NULL NULL 1 NULL information_schema COLUMNS NUMERIC_SCALE 12 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) select NULL information_schema COLUMNS CHARACTER_SET_NAME 13 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema COLUMNS COLLATION_NAME 14 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select -NULL information_schema COLUMNS COLUMN_TYPE 15 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema COLUMNS COLUMN_TYPE 15 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema COLUMNS COLUMN_KEY 16 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select NULL information_schema COLUMNS EXTRA 17 NO varchar 20 60 NULL NULL utf8 utf8_general_ci varchar(20) select NULL information_schema COLUMNS PRIVILEGES 18 NO varchar 80 240 NULL NULL utf8 utf8_general_ci varchar(80) select @@ -8750,7 +8746,7 @@ NULL information_schema ROUTINES SQL_PATH 14 NULL YES varchar 64 192 NULL NULL u NULL information_schema ROUTINES SECURITY_TYPE 15 NO varchar 7 21 NULL NULL utf8 utf8_general_ci varchar(7) select NULL information_schema ROUTINES CREATED 16 0000-00-00 00:00:00 NO datetime NULL NULL NULL NULL NULL NULL datetime select NULL information_schema ROUTINES LAST_ALTERED 17 0000-00-00 00:00:00 NO datetime NULL NULL NULL NULL NULL NULL datetime select -NULL information_schema ROUTINES SQL_MODE 18 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema ROUTINES SQL_MODE 18 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema ROUTINES ROUTINE_COMMENT 19 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema ROUTINES DEFINER 20 NO varchar 77 231 NULL NULL utf8 utf8_general_ci varchar(77) select NULL information_schema SCHEMATA CATALOG_NAME 1 NULL YES varchar 4096 12288 NULL NULL utf8 utf8_general_ci varchar(4096) select @@ -8820,7 +8816,7 @@ NULL information_schema TRIGGERS EVENT_OBJECT_SCHEMA 6 NO varchar 64 192 NULL N NULL information_schema TRIGGERS EVENT_OBJECT_TABLE 7 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema TRIGGERS ACTION_ORDER 8 0 NO bigint NULL NULL 19 0 NULL NULL bigint(4) select NULL information_schema TRIGGERS ACTION_CONDITION 9 NULL YES longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select -NULL information_schema TRIGGERS ACTION_STATEMENT 10 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema TRIGGERS ACTION_STATEMENT 10 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema TRIGGERS ACTION_ORIENTATION 11 NO varchar 9 27 NULL NULL utf8 utf8_general_ci varchar(9) select NULL information_schema TRIGGERS ACTION_TIMING 12 NO varchar 6 18 NULL NULL utf8 utf8_general_ci varchar(6) select NULL information_schema TRIGGERS ACTION_REFERENCE_OLD_TABLE 13 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select @@ -8828,8 +8824,8 @@ NULL information_schema TRIGGERS ACTION_REFERENCE_NEW_TABLE 14 NULL YES varchar NULL information_schema TRIGGERS ACTION_REFERENCE_OLD_ROW 15 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select NULL information_schema TRIGGERS ACTION_REFERENCE_NEW_ROW 16 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select NULL information_schema TRIGGERS CREATED 17 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select -NULL information_schema TRIGGERS SQL_MODE 18 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select -NULL information_schema TRIGGERS DEFINER 19 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema TRIGGERS SQL_MODE 18 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema TRIGGERS DEFINER 19 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema USER_PRIVILEGES GRANTEE 1 NO varchar 81 243 NULL NULL utf8 utf8_general_ci varchar(81) select NULL information_schema USER_PRIVILEGES TABLE_CATALOG 2 NULL YES varchar 4096 12288 NULL NULL utf8 utf8_general_ci varchar(4096) select NULL information_schema USER_PRIVILEGES PRIVILEGE_TYPE 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select @@ -8837,7 +8833,7 @@ NULL information_schema USER_PRIVILEGES IS_GRANTABLE 4 NO varchar 3 9 NULL NULL NULL information_schema VIEWS TABLE_CATALOG 1 NULL YES varchar 4096 12288 NULL NULL utf8 utf8_general_ci varchar(4096) select NULL information_schema VIEWS TABLE_SCHEMA 2 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema VIEWS TABLE_NAME 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select -NULL information_schema VIEWS VIEW_DEFINITION 4 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema VIEWS VIEW_DEFINITION 4 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema VIEWS CHECK_OPTION 5 NO varchar 8 24 NULL NULL utf8 utf8_general_ci varchar(8) select NULL information_schema VIEWS IS_UPDATABLE 6 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select NULL information_schema VIEWS DEFINER 7 NO varchar 77 231 NULL NULL utf8 utf8_general_ci varchar(77) select @@ -9332,7 +9328,7 @@ NULL information_schema COLUMNS NUMERIC_PRECISION 11 NULL YES bigint NULL NULL 1 NULL information_schema COLUMNS NUMERIC_SCALE 12 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) select NULL information_schema COLUMNS CHARACTER_SET_NAME 13 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema COLUMNS COLLATION_NAME 14 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select -NULL information_schema COLUMNS COLUMN_TYPE 15 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema COLUMNS COLUMN_TYPE 15 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema COLUMNS COLUMN_KEY 16 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select NULL information_schema COLUMNS EXTRA 17 NO varchar 20 60 NULL NULL utf8 utf8_general_ci varchar(20) select NULL information_schema COLUMNS PRIVILEGES 18 NO varchar 80 240 NULL NULL utf8 utf8_general_ci varchar(80) select @@ -9373,7 +9369,7 @@ NULL information_schema ROUTINES SQL_PATH 14 NULL YES varchar 64 192 NULL NULL u NULL information_schema ROUTINES SECURITY_TYPE 15 NO varchar 7 21 NULL NULL utf8 utf8_general_ci varchar(7) select NULL information_schema ROUTINES CREATED 16 0000-00-00 00:00:00 NO datetime NULL NULL NULL NULL NULL NULL datetime select NULL information_schema ROUTINES LAST_ALTERED 17 0000-00-00 00:00:00 NO datetime NULL NULL NULL NULL NULL NULL datetime select -NULL information_schema ROUTINES SQL_MODE 18 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema ROUTINES SQL_MODE 18 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema ROUTINES ROUTINE_COMMENT 19 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema ROUTINES DEFINER 20 NO varchar 77 231 NULL NULL utf8 utf8_general_ci varchar(77) select NULL information_schema SCHEMATA CATALOG_NAME 1 NULL YES varchar 4096 12288 NULL NULL utf8 utf8_general_ci varchar(4096) select @@ -9443,7 +9439,7 @@ NULL information_schema TRIGGERS EVENT_OBJECT_SCHEMA 6 NO varchar 64 192 NULL N NULL information_schema TRIGGERS EVENT_OBJECT_TABLE 7 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema TRIGGERS ACTION_ORDER 8 0 NO bigint NULL NULL 19 0 NULL NULL bigint(4) select NULL information_schema TRIGGERS ACTION_CONDITION 9 NULL YES longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select -NULL information_schema TRIGGERS ACTION_STATEMENT 10 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema TRIGGERS ACTION_STATEMENT 10 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema TRIGGERS ACTION_ORIENTATION 11 NO varchar 9 27 NULL NULL utf8 utf8_general_ci varchar(9) select NULL information_schema TRIGGERS ACTION_TIMING 12 NO varchar 6 18 NULL NULL utf8 utf8_general_ci varchar(6) select NULL information_schema TRIGGERS ACTION_REFERENCE_OLD_TABLE 13 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select @@ -9451,8 +9447,8 @@ NULL information_schema TRIGGERS ACTION_REFERENCE_NEW_TABLE 14 NULL YES varchar NULL information_schema TRIGGERS ACTION_REFERENCE_OLD_ROW 15 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select NULL information_schema TRIGGERS ACTION_REFERENCE_NEW_ROW 16 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select NULL information_schema TRIGGERS CREATED 17 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select -NULL information_schema TRIGGERS SQL_MODE 18 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select -NULL information_schema TRIGGERS DEFINER 19 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema TRIGGERS SQL_MODE 18 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema TRIGGERS DEFINER 19 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema USER_PRIVILEGES GRANTEE 1 NO varchar 81 243 NULL NULL utf8 utf8_general_ci varchar(81) select NULL information_schema USER_PRIVILEGES TABLE_CATALOG 2 NULL YES varchar 4096 12288 NULL NULL utf8 utf8_general_ci varchar(4096) select NULL information_schema USER_PRIVILEGES PRIVILEGE_TYPE 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select @@ -9460,7 +9456,7 @@ NULL information_schema USER_PRIVILEGES IS_GRANTABLE 4 NO varchar 3 9 NULL NULL NULL information_schema VIEWS TABLE_CATALOG 1 NULL YES varchar 4096 12288 NULL NULL utf8 utf8_general_ci varchar(4096) select NULL information_schema VIEWS TABLE_SCHEMA 2 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema VIEWS TABLE_NAME 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select -NULL information_schema VIEWS VIEW_DEFINITION 4 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema VIEWS VIEW_DEFINITION 4 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema VIEWS CHECK_OPTION 5 NO varchar 8 24 NULL NULL utf8 utf8_general_ci varchar(8) select NULL information_schema VIEWS IS_UPDATABLE 6 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select NULL information_schema VIEWS DEFINER 7 NO varchar 77 231 NULL NULL utf8 utf8_general_ci varchar(77) select @@ -9751,7 +9747,7 @@ NULL information_schema COLUMNS NUMERIC_PRECISION 11 NULL YES bigint NULL NULL 1 NULL information_schema COLUMNS NUMERIC_SCALE 12 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) select NULL information_schema COLUMNS CHARACTER_SET_NAME 13 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema COLUMNS COLLATION_NAME 14 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select -NULL information_schema COLUMNS COLUMN_TYPE 15 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema COLUMNS COLUMN_TYPE 15 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema COLUMNS COLUMN_KEY 16 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select NULL information_schema COLUMNS EXTRA 17 NO varchar 20 60 NULL NULL utf8 utf8_general_ci varchar(20) select NULL information_schema COLUMNS PRIVILEGES 18 NO varchar 80 240 NULL NULL utf8 utf8_general_ci varchar(80) select @@ -9792,7 +9788,7 @@ NULL information_schema ROUTINES SQL_PATH 14 NULL YES varchar 64 192 NULL NULL u NULL information_schema ROUTINES SECURITY_TYPE 15 NO varchar 7 21 NULL NULL utf8 utf8_general_ci varchar(7) select NULL information_schema ROUTINES CREATED 16 0000-00-00 00:00:00 NO datetime NULL NULL NULL NULL NULL NULL datetime select NULL information_schema ROUTINES LAST_ALTERED 17 0000-00-00 00:00:00 NO datetime NULL NULL NULL NULL NULL NULL datetime select -NULL information_schema ROUTINES SQL_MODE 18 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema ROUTINES SQL_MODE 18 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema ROUTINES ROUTINE_COMMENT 19 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema ROUTINES DEFINER 20 NO varchar 77 231 NULL NULL utf8 utf8_general_ci varchar(77) select NULL information_schema SCHEMATA CATALOG_NAME 1 NULL YES varchar 4096 12288 NULL NULL utf8 utf8_general_ci varchar(4096) select @@ -9862,7 +9858,7 @@ NULL information_schema TRIGGERS EVENT_OBJECT_SCHEMA 6 NO varchar 64 192 NULL N NULL information_schema TRIGGERS EVENT_OBJECT_TABLE 7 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema TRIGGERS ACTION_ORDER 8 0 NO bigint NULL NULL 19 0 NULL NULL bigint(4) select NULL information_schema TRIGGERS ACTION_CONDITION 9 NULL YES longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select -NULL information_schema TRIGGERS ACTION_STATEMENT 10 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema TRIGGERS ACTION_STATEMENT 10 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema TRIGGERS ACTION_ORIENTATION 11 NO varchar 9 27 NULL NULL utf8 utf8_general_ci varchar(9) select NULL information_schema TRIGGERS ACTION_TIMING 12 NO varchar 6 18 NULL NULL utf8 utf8_general_ci varchar(6) select NULL information_schema TRIGGERS ACTION_REFERENCE_OLD_TABLE 13 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select @@ -9870,8 +9866,8 @@ NULL information_schema TRIGGERS ACTION_REFERENCE_NEW_TABLE 14 NULL YES varchar NULL information_schema TRIGGERS ACTION_REFERENCE_OLD_ROW 15 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select NULL information_schema TRIGGERS ACTION_REFERENCE_NEW_ROW 16 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select NULL information_schema TRIGGERS CREATED 17 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select -NULL information_schema TRIGGERS SQL_MODE 18 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select -NULL information_schema TRIGGERS DEFINER 19 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema TRIGGERS SQL_MODE 18 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema TRIGGERS DEFINER 19 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema USER_PRIVILEGES GRANTEE 1 NO varchar 81 243 NULL NULL utf8 utf8_general_ci varchar(81) select NULL information_schema USER_PRIVILEGES TABLE_CATALOG 2 NULL YES varchar 4096 12288 NULL NULL utf8 utf8_general_ci varchar(4096) select NULL information_schema USER_PRIVILEGES PRIVILEGE_TYPE 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select @@ -9879,7 +9875,7 @@ NULL information_schema USER_PRIVILEGES IS_GRANTABLE 4 NO varchar 3 9 NULL NULL NULL information_schema VIEWS TABLE_CATALOG 1 NULL YES varchar 4096 12288 NULL NULL utf8 utf8_general_ci varchar(4096) select NULL information_schema VIEWS TABLE_SCHEMA 2 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema VIEWS TABLE_NAME 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select -NULL information_schema VIEWS VIEW_DEFINITION 4 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema VIEWS VIEW_DEFINITION 4 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema VIEWS CHECK_OPTION 5 NO varchar 8 24 NULL NULL utf8 utf8_general_ci varchar(8) select NULL information_schema VIEWS IS_UPDATABLE 6 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select NULL information_schema VIEWS DEFINER 7 NO varchar 77 231 NULL NULL utf8 utf8_general_ci varchar(77) select @@ -11016,7 +11012,7 @@ SQL_PATH varchar(64) YES NULL SECURITY_TYPE varchar(7) NO CREATED datetime NO 0000-00-00 00:00:00 LAST_ALTERED datetime NO 0000-00-00 00:00:00 -SQL_MODE longtext NO +SQL_MODE longtext NO NULL ROUTINE_COMMENT varchar(64) NO DEFINER varchar(77) NO SHOW CREATE TABLE routines; @@ -11071,7 +11067,7 @@ NULL information_schema ROUTINES SQL_PATH 14 NULL YES varchar 64 192 NULL NULL u NULL information_schema ROUTINES SECURITY_TYPE 15 NO varchar 7 21 NULL NULL utf8 utf8_general_ci varchar(7) select NULL information_schema ROUTINES CREATED 16 0000-00-00 00:00:00 NO datetime NULL NULL NULL NULL NULL NULL datetime select NULL information_schema ROUTINES LAST_ALTERED 17 0000-00-00 00:00:00 NO datetime NULL NULL NULL NULL NULL NULL datetime select -NULL information_schema ROUTINES SQL_MODE 18 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema ROUTINES SQL_MODE 18 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema ROUTINES ROUTINE_COMMENT 19 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema ROUTINES DEFINER 20 NO varchar 77 231 NULL NULL utf8 utf8_general_ci varchar(77) select @@ -11922,7 +11918,7 @@ Field Type Null Key Default Extra TABLE_CATALOG varchar(4096) YES NULL TABLE_SCHEMA varchar(64) NO TABLE_NAME varchar(64) NO -VIEW_DEFINITION longtext NO +VIEW_DEFINITION longtext NO NULL CHECK_OPTION varchar(8) NO IS_UPDATABLE varchar(3) NO DEFINER varchar(77) NO @@ -11953,7 +11949,7 @@ TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION COLUMN_DEFAUL NULL information_schema VIEWS TABLE_CATALOG 1 NULL YES varchar 4096 12288 NULL NULL utf8 utf8_general_ci varchar(4096) select NULL information_schema VIEWS TABLE_SCHEMA 2 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema VIEWS TABLE_NAME 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select -NULL information_schema VIEWS VIEW_DEFINITION 4 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema VIEWS VIEW_DEFINITION 4 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema VIEWS CHECK_OPTION 5 NO varchar 8 24 NULL NULL utf8 utf8_general_ci varchar(8) select NULL information_schema VIEWS IS_UPDATABLE 6 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select NULL information_schema VIEWS DEFINER 7 NO varchar 77 231 NULL NULL utf8 utf8_general_ci varchar(77) select @@ -12711,7 +12707,7 @@ EVENT_OBJECT_SCHEMA varchar(64) NO EVENT_OBJECT_TABLE varchar(64) NO ACTION_ORDER bigint(4) NO 0 ACTION_CONDITION longtext YES NULL -ACTION_STATEMENT longtext NO +ACTION_STATEMENT longtext NO NULL ACTION_ORIENTATION varchar(9) NO ACTION_TIMING varchar(6) NO ACTION_REFERENCE_OLD_TABLE varchar(64) YES NULL @@ -12719,8 +12715,8 @@ ACTION_REFERENCE_NEW_TABLE varchar(64) YES NULL ACTION_REFERENCE_OLD_ROW varchar(3) NO ACTION_REFERENCE_NEW_ROW varchar(3) NO CREATED datetime YES NULL -SQL_MODE longtext NO -DEFINER longtext NO +SQL_MODE longtext NO NULL +DEFINER longtext NO NULL SHOW CREATE TABLE triggers; Table Create Table TRIGGERS CREATE TEMPORARY TABLE `TRIGGERS` ( @@ -12764,7 +12760,7 @@ NULL information_schema TRIGGERS EVENT_OBJECT_SCHEMA 6 NO varchar 64 192 NULL N NULL information_schema TRIGGERS EVENT_OBJECT_TABLE 7 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema TRIGGERS ACTION_ORDER 8 0 NO bigint NULL NULL 19 0 NULL NULL bigint(4) select NULL information_schema TRIGGERS ACTION_CONDITION 9 NULL YES longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select -NULL information_schema TRIGGERS ACTION_STATEMENT 10 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema TRIGGERS ACTION_STATEMENT 10 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema TRIGGERS ACTION_ORIENTATION 11 NO varchar 9 27 NULL NULL utf8 utf8_general_ci varchar(9) select NULL information_schema TRIGGERS ACTION_TIMING 12 NO varchar 6 18 NULL NULL utf8 utf8_general_ci varchar(6) select NULL information_schema TRIGGERS ACTION_REFERENCE_OLD_TABLE 13 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select @@ -12772,8 +12768,8 @@ NULL information_schema TRIGGERS ACTION_REFERENCE_NEW_TABLE 14 NULL YES varchar NULL information_schema TRIGGERS ACTION_REFERENCE_OLD_ROW 15 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select NULL information_schema TRIGGERS ACTION_REFERENCE_NEW_ROW 16 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select NULL information_schema TRIGGERS CREATED 17 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select -NULL information_schema TRIGGERS SQL_MODE 18 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select -NULL information_schema TRIGGERS DEFINER 19 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema TRIGGERS SQL_MODE 18 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema TRIGGERS DEFINER 19 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select Testcase 3.2.18.2 + 3.2.18.3: -------------------------------------------------------------------------------- diff --git a/mysql-test/suite/funcs_1/r/myisam__datadict.result b/mysql-test/suite/funcs_1/r/myisam__datadict.result index 518c7d277de..f14108d0eb9 100644 --- a/mysql-test/suite/funcs_1/r/myisam__datadict.result +++ b/mysql-test/suite/funcs_1/r/myisam__datadict.result @@ -1814,7 +1814,7 @@ NULL information_schema COLUMNS NUMERIC_PRECISION 11 NULL YES bigint NULL NULL 1 NULL information_schema COLUMNS NUMERIC_SCALE 12 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) select NULL information_schema COLUMNS CHARACTER_SET_NAME 13 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema COLUMNS COLLATION_NAME 14 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select -NULL information_schema COLUMNS COLUMN_TYPE 15 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema COLUMNS COLUMN_TYPE 15 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema COLUMNS COLUMN_KEY 16 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select NULL information_schema COLUMNS EXTRA 17 NO varchar 20 60 NULL NULL utf8 utf8_general_ci varchar(20) select NULL information_schema COLUMNS PRIVILEGES 18 NO varchar 80 240 NULL NULL utf8 utf8_general_ci varchar(80) select @@ -1855,7 +1855,7 @@ NULL information_schema ROUTINES SQL_PATH 14 NULL YES varchar 64 192 NULL NULL u NULL information_schema ROUTINES SECURITY_TYPE 15 NO varchar 7 21 NULL NULL utf8 utf8_general_ci varchar(7) select NULL information_schema ROUTINES CREATED 16 0000-00-00 00:00:00 NO datetime NULL NULL NULL NULL NULL NULL datetime select NULL information_schema ROUTINES LAST_ALTERED 17 0000-00-00 00:00:00 NO datetime NULL NULL NULL NULL NULL NULL datetime select -NULL information_schema ROUTINES SQL_MODE 18 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema ROUTINES SQL_MODE 18 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema ROUTINES ROUTINE_COMMENT 19 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema ROUTINES DEFINER 20 NO varchar 77 231 NULL NULL utf8 utf8_general_ci varchar(77) select NULL information_schema SCHEMATA CATALOG_NAME 1 NULL YES varchar 4096 12288 NULL NULL utf8 utf8_general_ci varchar(4096) select @@ -1925,7 +1925,7 @@ NULL information_schema TRIGGERS EVENT_OBJECT_SCHEMA 6 NO varchar 64 192 NULL N NULL information_schema TRIGGERS EVENT_OBJECT_TABLE 7 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema TRIGGERS ACTION_ORDER 8 0 NO bigint NULL NULL 19 0 NULL NULL bigint(4) select NULL information_schema TRIGGERS ACTION_CONDITION 9 NULL YES longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select -NULL information_schema TRIGGERS ACTION_STATEMENT 10 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema TRIGGERS ACTION_STATEMENT 10 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema TRIGGERS ACTION_ORIENTATION 11 NO varchar 9 27 NULL NULL utf8 utf8_general_ci varchar(9) select NULL information_schema TRIGGERS ACTION_TIMING 12 NO varchar 6 18 NULL NULL utf8 utf8_general_ci varchar(6) select NULL information_schema TRIGGERS ACTION_REFERENCE_OLD_TABLE 13 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select @@ -1933,8 +1933,8 @@ NULL information_schema TRIGGERS ACTION_REFERENCE_NEW_TABLE 14 NULL YES varchar NULL information_schema TRIGGERS ACTION_REFERENCE_OLD_ROW 15 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select NULL information_schema TRIGGERS ACTION_REFERENCE_NEW_ROW 16 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select NULL information_schema TRIGGERS CREATED 17 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select -NULL information_schema TRIGGERS SQL_MODE 18 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select -NULL information_schema TRIGGERS DEFINER 19 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema TRIGGERS SQL_MODE 18 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema TRIGGERS DEFINER 19 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema USER_PRIVILEGES GRANTEE 1 NO varchar 81 243 NULL NULL utf8 utf8_general_ci varchar(81) select NULL information_schema USER_PRIVILEGES TABLE_CATALOG 2 NULL YES varchar 4096 12288 NULL NULL utf8 utf8_general_ci varchar(4096) select NULL information_schema USER_PRIVILEGES PRIVILEGE_TYPE 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select @@ -1942,7 +1942,7 @@ NULL information_schema USER_PRIVILEGES IS_GRANTABLE 4 NO varchar 3 9 NULL NULL NULL information_schema VIEWS TABLE_CATALOG 1 NULL YES varchar 4096 12288 NULL NULL utf8 utf8_general_ci varchar(4096) select NULL information_schema VIEWS TABLE_SCHEMA 2 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema VIEWS TABLE_NAME 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select -NULL information_schema VIEWS VIEW_DEFINITION 4 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema VIEWS VIEW_DEFINITION 4 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema VIEWS CHECK_OPTION 5 NO varchar 8 24 NULL NULL utf8 utf8_general_ci varchar(8) select NULL information_schema VIEWS IS_UPDATABLE 6 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select NULL information_schema VIEWS DEFINER 7 NO varchar 77 231 NULL NULL utf8 utf8_general_ci varchar(77) select @@ -2510,7 +2510,7 @@ cp932 cp932_japanese_ci SJIS for Windows Japanese 2 eucjpms eucjpms_japanese_ci UJIS for Windows Japanese 3 select sum(id) from collations; sum(id) -10995 +10741 select collation_name, character_set_name into @x,@y from collation_character_set_applicability limit 1; select @x, @y; @@ -4434,10 +4434,10 @@ COUNT(*) 36 SELECT COUNT(*) FROM information_schema. collations ; COUNT(*) -127 +126 SELECT COUNT(*) FROM information_schema. collation_character_set_applicability ; COUNT(*) -127 +126 SELECT COUNT(*) FROM information_schema. routines ; COUNT(*) 1 @@ -7293,7 +7293,6 @@ utf8_roman_ci utf8 utf8_persian_ci utf8 utf8_esperanto_ci utf8 utf8_hungarian_ci utf8 -utf8_general_cs utf8 ucs2_general_ci ucs2 ucs2_bin ucs2 ucs2_unicode_ci ucs2 @@ -7942,7 +7941,6 @@ utf8_roman_ci utf8_persian_ci utf8_esperanto_ci utf8_hungarian_ci -utf8_general_cs ucs2_general_ci ucs2_bin ucs2_unicode_ci @@ -8307,7 +8305,6 @@ utf8_roman_ci utf8 207 Yes 8 utf8_persian_ci utf8 208 Yes 8 utf8_esperanto_ci utf8 209 Yes 8 utf8_hungarian_ci utf8 210 Yes 8 -utf8_general_cs utf8 254 Yes 1 ucs2_general_ci ucs2 35 Yes Yes 1 ucs2_bin ucs2 90 Yes 1 ucs2_unicode_ci ucs2 128 Yes 8 @@ -8469,7 +8466,6 @@ utf8_roman_ci utf8 utf8_persian_ci utf8 utf8_esperanto_ci utf8 utf8_hungarian_ci utf8 -utf8_general_cs utf8 ucs2_general_ci ucs2 ucs2_bin ucs2 ucs2_unicode_ci ucs2 @@ -8703,7 +8699,7 @@ NUMERIC_PRECISION bigint(21) YES NULL NUMERIC_SCALE bigint(21) YES NULL CHARACTER_SET_NAME varchar(64) YES NULL COLLATION_NAME varchar(64) YES NULL -COLUMN_TYPE longtext NO +COLUMN_TYPE longtext NO NULL COLUMN_KEY varchar(3) NO EXTRA varchar(20) NO PRIVILEGES varchar(80) NO @@ -8756,7 +8752,7 @@ NULL information_schema COLUMNS NUMERIC_PRECISION 11 NULL YES bigint NULL NULL 1 NULL information_schema COLUMNS NUMERIC_SCALE 12 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) select NULL information_schema COLUMNS CHARACTER_SET_NAME 13 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema COLUMNS COLLATION_NAME 14 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select -NULL information_schema COLUMNS COLUMN_TYPE 15 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema COLUMNS COLUMN_TYPE 15 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema COLUMNS COLUMN_KEY 16 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select NULL information_schema COLUMNS EXTRA 17 NO varchar 20 60 NULL NULL utf8 utf8_general_ci varchar(20) select NULL information_schema COLUMNS PRIVILEGES 18 NO varchar 80 240 NULL NULL utf8 utf8_general_ci varchar(80) select @@ -8811,7 +8807,7 @@ NULL information_schema COLUMNS NUMERIC_PRECISION 11 NULL YES bigint NULL NULL 1 NULL information_schema COLUMNS NUMERIC_SCALE 12 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) select NULL information_schema COLUMNS CHARACTER_SET_NAME 13 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema COLUMNS COLLATION_NAME 14 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select -NULL information_schema COLUMNS COLUMN_TYPE 15 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema COLUMNS COLUMN_TYPE 15 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema COLUMNS COLUMN_KEY 16 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select NULL information_schema COLUMNS EXTRA 17 NO varchar 20 60 NULL NULL utf8 utf8_general_ci varchar(20) select NULL information_schema COLUMNS PRIVILEGES 18 NO varchar 80 240 NULL NULL utf8 utf8_general_ci varchar(80) select @@ -8852,7 +8848,7 @@ NULL information_schema ROUTINES SQL_PATH 14 NULL YES varchar 64 192 NULL NULL u NULL information_schema ROUTINES SECURITY_TYPE 15 NO varchar 7 21 NULL NULL utf8 utf8_general_ci varchar(7) select NULL information_schema ROUTINES CREATED 16 0000-00-00 00:00:00 NO datetime NULL NULL NULL NULL NULL NULL datetime select NULL information_schema ROUTINES LAST_ALTERED 17 0000-00-00 00:00:00 NO datetime NULL NULL NULL NULL NULL NULL datetime select -NULL information_schema ROUTINES SQL_MODE 18 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema ROUTINES SQL_MODE 18 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema ROUTINES ROUTINE_COMMENT 19 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema ROUTINES DEFINER 20 NO varchar 77 231 NULL NULL utf8 utf8_general_ci varchar(77) select NULL information_schema SCHEMATA CATALOG_NAME 1 NULL YES varchar 4096 12288 NULL NULL utf8 utf8_general_ci varchar(4096) select @@ -8922,7 +8918,7 @@ NULL information_schema TRIGGERS EVENT_OBJECT_SCHEMA 6 NO varchar 64 192 NULL N NULL information_schema TRIGGERS EVENT_OBJECT_TABLE 7 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema TRIGGERS ACTION_ORDER 8 0 NO bigint NULL NULL 19 0 NULL NULL bigint(4) select NULL information_schema TRIGGERS ACTION_CONDITION 9 NULL YES longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select -NULL information_schema TRIGGERS ACTION_STATEMENT 10 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema TRIGGERS ACTION_STATEMENT 10 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema TRIGGERS ACTION_ORIENTATION 11 NO varchar 9 27 NULL NULL utf8 utf8_general_ci varchar(9) select NULL information_schema TRIGGERS ACTION_TIMING 12 NO varchar 6 18 NULL NULL utf8 utf8_general_ci varchar(6) select NULL information_schema TRIGGERS ACTION_REFERENCE_OLD_TABLE 13 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select @@ -8930,8 +8926,8 @@ NULL information_schema TRIGGERS ACTION_REFERENCE_NEW_TABLE 14 NULL YES varchar NULL information_schema TRIGGERS ACTION_REFERENCE_OLD_ROW 15 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select NULL information_schema TRIGGERS ACTION_REFERENCE_NEW_ROW 16 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select NULL information_schema TRIGGERS CREATED 17 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select -NULL information_schema TRIGGERS SQL_MODE 18 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select -NULL information_schema TRIGGERS DEFINER 19 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema TRIGGERS SQL_MODE 18 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema TRIGGERS DEFINER 19 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema USER_PRIVILEGES GRANTEE 1 NO varchar 81 243 NULL NULL utf8 utf8_general_ci varchar(81) select NULL information_schema USER_PRIVILEGES TABLE_CATALOG 2 NULL YES varchar 4096 12288 NULL NULL utf8 utf8_general_ci varchar(4096) select NULL information_schema USER_PRIVILEGES PRIVILEGE_TYPE 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select @@ -8939,7 +8935,7 @@ NULL information_schema USER_PRIVILEGES IS_GRANTABLE 4 NO varchar 3 9 NULL NULL NULL information_schema VIEWS TABLE_CATALOG 1 NULL YES varchar 4096 12288 NULL NULL utf8 utf8_general_ci varchar(4096) select NULL information_schema VIEWS TABLE_SCHEMA 2 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema VIEWS TABLE_NAME 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select -NULL information_schema VIEWS VIEW_DEFINITION 4 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema VIEWS VIEW_DEFINITION 4 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema VIEWS CHECK_OPTION 5 NO varchar 8 24 NULL NULL utf8 utf8_general_ci varchar(8) select NULL information_schema VIEWS IS_UPDATABLE 6 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select NULL information_schema VIEWS DEFINER 7 NO varchar 77 231 NULL NULL utf8 utf8_general_ci varchar(77) select @@ -9474,7 +9470,7 @@ NULL information_schema COLUMNS NUMERIC_PRECISION 11 NULL YES bigint NULL NULL 1 NULL information_schema COLUMNS NUMERIC_SCALE 12 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) select NULL information_schema COLUMNS CHARACTER_SET_NAME 13 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema COLUMNS COLLATION_NAME 14 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select -NULL information_schema COLUMNS COLUMN_TYPE 15 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema COLUMNS COLUMN_TYPE 15 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema COLUMNS COLUMN_KEY 16 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select NULL information_schema COLUMNS EXTRA 17 NO varchar 20 60 NULL NULL utf8 utf8_general_ci varchar(20) select NULL information_schema COLUMNS PRIVILEGES 18 NO varchar 80 240 NULL NULL utf8 utf8_general_ci varchar(80) select @@ -9515,7 +9511,7 @@ NULL information_schema ROUTINES SQL_PATH 14 NULL YES varchar 64 192 NULL NULL u NULL information_schema ROUTINES SECURITY_TYPE 15 NO varchar 7 21 NULL NULL utf8 utf8_general_ci varchar(7) select NULL information_schema ROUTINES CREATED 16 0000-00-00 00:00:00 NO datetime NULL NULL NULL NULL NULL NULL datetime select NULL information_schema ROUTINES LAST_ALTERED 17 0000-00-00 00:00:00 NO datetime NULL NULL NULL NULL NULL NULL datetime select -NULL information_schema ROUTINES SQL_MODE 18 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema ROUTINES SQL_MODE 18 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema ROUTINES ROUTINE_COMMENT 19 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema ROUTINES DEFINER 20 NO varchar 77 231 NULL NULL utf8 utf8_general_ci varchar(77) select NULL information_schema SCHEMATA CATALOG_NAME 1 NULL YES varchar 4096 12288 NULL NULL utf8 utf8_general_ci varchar(4096) select @@ -9585,7 +9581,7 @@ NULL information_schema TRIGGERS EVENT_OBJECT_SCHEMA 6 NO varchar 64 192 NULL N NULL information_schema TRIGGERS EVENT_OBJECT_TABLE 7 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema TRIGGERS ACTION_ORDER 8 0 NO bigint NULL NULL 19 0 NULL NULL bigint(4) select NULL information_schema TRIGGERS ACTION_CONDITION 9 NULL YES longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select -NULL information_schema TRIGGERS ACTION_STATEMENT 10 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema TRIGGERS ACTION_STATEMENT 10 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema TRIGGERS ACTION_ORIENTATION 11 NO varchar 9 27 NULL NULL utf8 utf8_general_ci varchar(9) select NULL information_schema TRIGGERS ACTION_TIMING 12 NO varchar 6 18 NULL NULL utf8 utf8_general_ci varchar(6) select NULL information_schema TRIGGERS ACTION_REFERENCE_OLD_TABLE 13 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select @@ -9593,8 +9589,8 @@ NULL information_schema TRIGGERS ACTION_REFERENCE_NEW_TABLE 14 NULL YES varchar NULL information_schema TRIGGERS ACTION_REFERENCE_OLD_ROW 15 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select NULL information_schema TRIGGERS ACTION_REFERENCE_NEW_ROW 16 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select NULL information_schema TRIGGERS CREATED 17 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select -NULL information_schema TRIGGERS SQL_MODE 18 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select -NULL information_schema TRIGGERS DEFINER 19 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema TRIGGERS SQL_MODE 18 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema TRIGGERS DEFINER 19 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema USER_PRIVILEGES GRANTEE 1 NO varchar 81 243 NULL NULL utf8 utf8_general_ci varchar(81) select NULL information_schema USER_PRIVILEGES TABLE_CATALOG 2 NULL YES varchar 4096 12288 NULL NULL utf8 utf8_general_ci varchar(4096) select NULL information_schema USER_PRIVILEGES PRIVILEGE_TYPE 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select @@ -9602,7 +9598,7 @@ NULL information_schema USER_PRIVILEGES IS_GRANTABLE 4 NO varchar 3 9 NULL NULL NULL information_schema VIEWS TABLE_CATALOG 1 NULL YES varchar 4096 12288 NULL NULL utf8 utf8_general_ci varchar(4096) select NULL information_schema VIEWS TABLE_SCHEMA 2 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema VIEWS TABLE_NAME 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select -NULL information_schema VIEWS VIEW_DEFINITION 4 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema VIEWS VIEW_DEFINITION 4 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema VIEWS CHECK_OPTION 5 NO varchar 8 24 NULL NULL utf8 utf8_general_ci varchar(8) select NULL information_schema VIEWS IS_UPDATABLE 6 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select NULL information_schema VIEWS DEFINER 7 NO varchar 77 231 NULL NULL utf8 utf8_general_ci varchar(77) select @@ -9925,7 +9921,7 @@ NULL information_schema COLUMNS NUMERIC_PRECISION 11 NULL YES bigint NULL NULL 1 NULL information_schema COLUMNS NUMERIC_SCALE 12 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) select NULL information_schema COLUMNS CHARACTER_SET_NAME 13 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema COLUMNS COLLATION_NAME 14 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select -NULL information_schema COLUMNS COLUMN_TYPE 15 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema COLUMNS COLUMN_TYPE 15 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema COLUMNS COLUMN_KEY 16 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select NULL information_schema COLUMNS EXTRA 17 NO varchar 20 60 NULL NULL utf8 utf8_general_ci varchar(20) select NULL information_schema COLUMNS PRIVILEGES 18 NO varchar 80 240 NULL NULL utf8 utf8_general_ci varchar(80) select @@ -9966,7 +9962,7 @@ NULL information_schema ROUTINES SQL_PATH 14 NULL YES varchar 64 192 NULL NULL u NULL information_schema ROUTINES SECURITY_TYPE 15 NO varchar 7 21 NULL NULL utf8 utf8_general_ci varchar(7) select NULL information_schema ROUTINES CREATED 16 0000-00-00 00:00:00 NO datetime NULL NULL NULL NULL NULL NULL datetime select NULL information_schema ROUTINES LAST_ALTERED 17 0000-00-00 00:00:00 NO datetime NULL NULL NULL NULL NULL NULL datetime select -NULL information_schema ROUTINES SQL_MODE 18 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema ROUTINES SQL_MODE 18 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema ROUTINES ROUTINE_COMMENT 19 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema ROUTINES DEFINER 20 NO varchar 77 231 NULL NULL utf8 utf8_general_ci varchar(77) select NULL information_schema SCHEMATA CATALOG_NAME 1 NULL YES varchar 4096 12288 NULL NULL utf8 utf8_general_ci varchar(4096) select @@ -10036,7 +10032,7 @@ NULL information_schema TRIGGERS EVENT_OBJECT_SCHEMA 6 NO varchar 64 192 NULL N NULL information_schema TRIGGERS EVENT_OBJECT_TABLE 7 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema TRIGGERS ACTION_ORDER 8 0 NO bigint NULL NULL 19 0 NULL NULL bigint(4) select NULL information_schema TRIGGERS ACTION_CONDITION 9 NULL YES longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select -NULL information_schema TRIGGERS ACTION_STATEMENT 10 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema TRIGGERS ACTION_STATEMENT 10 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema TRIGGERS ACTION_ORIENTATION 11 NO varchar 9 27 NULL NULL utf8 utf8_general_ci varchar(9) select NULL information_schema TRIGGERS ACTION_TIMING 12 NO varchar 6 18 NULL NULL utf8 utf8_general_ci varchar(6) select NULL information_schema TRIGGERS ACTION_REFERENCE_OLD_TABLE 13 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select @@ -10044,8 +10040,8 @@ NULL information_schema TRIGGERS ACTION_REFERENCE_NEW_TABLE 14 NULL YES varchar NULL information_schema TRIGGERS ACTION_REFERENCE_OLD_ROW 15 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select NULL information_schema TRIGGERS ACTION_REFERENCE_NEW_ROW 16 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select NULL information_schema TRIGGERS CREATED 17 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select -NULL information_schema TRIGGERS SQL_MODE 18 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select -NULL information_schema TRIGGERS DEFINER 19 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema TRIGGERS SQL_MODE 18 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema TRIGGERS DEFINER 19 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema USER_PRIVILEGES GRANTEE 1 NO varchar 81 243 NULL NULL utf8 utf8_general_ci varchar(81) select NULL information_schema USER_PRIVILEGES TABLE_CATALOG 2 NULL YES varchar 4096 12288 NULL NULL utf8 utf8_general_ci varchar(4096) select NULL information_schema USER_PRIVILEGES PRIVILEGE_TYPE 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select @@ -10053,7 +10049,7 @@ NULL information_schema USER_PRIVILEGES IS_GRANTABLE 4 NO varchar 3 9 NULL NULL NULL information_schema VIEWS TABLE_CATALOG 1 NULL YES varchar 4096 12288 NULL NULL utf8 utf8_general_ci varchar(4096) select NULL information_schema VIEWS TABLE_SCHEMA 2 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema VIEWS TABLE_NAME 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select -NULL information_schema VIEWS VIEW_DEFINITION 4 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema VIEWS VIEW_DEFINITION 4 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema VIEWS CHECK_OPTION 5 NO varchar 8 24 NULL NULL utf8 utf8_general_ci varchar(8) select NULL information_schema VIEWS IS_UPDATABLE 6 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select NULL information_schema VIEWS DEFINER 7 NO varchar 77 231 NULL NULL utf8 utf8_general_ci varchar(77) select @@ -11270,7 +11266,7 @@ SQL_PATH varchar(64) YES NULL SECURITY_TYPE varchar(7) NO CREATED datetime NO 0000-00-00 00:00:00 LAST_ALTERED datetime NO 0000-00-00 00:00:00 -SQL_MODE longtext NO +SQL_MODE longtext NO NULL ROUTINE_COMMENT varchar(64) NO DEFINER varchar(77) NO SHOW CREATE TABLE routines; @@ -11325,7 +11321,7 @@ NULL information_schema ROUTINES SQL_PATH 14 NULL YES varchar 64 192 NULL NULL u NULL information_schema ROUTINES SECURITY_TYPE 15 NO varchar 7 21 NULL NULL utf8 utf8_general_ci varchar(7) select NULL information_schema ROUTINES CREATED 16 0000-00-00 00:00:00 NO datetime NULL NULL NULL NULL NULL NULL datetime select NULL information_schema ROUTINES LAST_ALTERED 17 0000-00-00 00:00:00 NO datetime NULL NULL NULL NULL NULL NULL datetime select -NULL information_schema ROUTINES SQL_MODE 18 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema ROUTINES SQL_MODE 18 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema ROUTINES ROUTINE_COMMENT 19 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema ROUTINES DEFINER 20 NO varchar 77 231 NULL NULL utf8 utf8_general_ci varchar(77) select @@ -12176,7 +12172,7 @@ Field Type Null Key Default Extra TABLE_CATALOG varchar(4096) YES NULL TABLE_SCHEMA varchar(64) NO TABLE_NAME varchar(64) NO -VIEW_DEFINITION longtext NO +VIEW_DEFINITION longtext NO NULL CHECK_OPTION varchar(8) NO IS_UPDATABLE varchar(3) NO DEFINER varchar(77) NO @@ -12207,7 +12203,7 @@ TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION COLUMN_DEFAUL NULL information_schema VIEWS TABLE_CATALOG 1 NULL YES varchar 4096 12288 NULL NULL utf8 utf8_general_ci varchar(4096) select NULL information_schema VIEWS TABLE_SCHEMA 2 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema VIEWS TABLE_NAME 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select -NULL information_schema VIEWS VIEW_DEFINITION 4 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema VIEWS VIEW_DEFINITION 4 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema VIEWS CHECK_OPTION 5 NO varchar 8 24 NULL NULL utf8 utf8_general_ci varchar(8) select NULL information_schema VIEWS IS_UPDATABLE 6 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select NULL information_schema VIEWS DEFINER 7 NO varchar 77 231 NULL NULL utf8 utf8_general_ci varchar(77) select @@ -12965,7 +12961,7 @@ EVENT_OBJECT_SCHEMA varchar(64) NO EVENT_OBJECT_TABLE varchar(64) NO ACTION_ORDER bigint(4) NO 0 ACTION_CONDITION longtext YES NULL -ACTION_STATEMENT longtext NO +ACTION_STATEMENT longtext NO NULL ACTION_ORIENTATION varchar(9) NO ACTION_TIMING varchar(6) NO ACTION_REFERENCE_OLD_TABLE varchar(64) YES NULL @@ -12973,8 +12969,8 @@ ACTION_REFERENCE_NEW_TABLE varchar(64) YES NULL ACTION_REFERENCE_OLD_ROW varchar(3) NO ACTION_REFERENCE_NEW_ROW varchar(3) NO CREATED datetime YES NULL -SQL_MODE longtext NO -DEFINER longtext NO +SQL_MODE longtext NO NULL +DEFINER longtext NO NULL SHOW CREATE TABLE triggers; Table Create Table TRIGGERS CREATE TEMPORARY TABLE `TRIGGERS` ( @@ -13018,7 +13014,7 @@ NULL information_schema TRIGGERS EVENT_OBJECT_SCHEMA 6 NO varchar 64 192 NULL N NULL information_schema TRIGGERS EVENT_OBJECT_TABLE 7 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema TRIGGERS ACTION_ORDER 8 0 NO bigint NULL NULL 19 0 NULL NULL bigint(4) select NULL information_schema TRIGGERS ACTION_CONDITION 9 NULL YES longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select -NULL information_schema TRIGGERS ACTION_STATEMENT 10 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema TRIGGERS ACTION_STATEMENT 10 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema TRIGGERS ACTION_ORIENTATION 11 NO varchar 9 27 NULL NULL utf8 utf8_general_ci varchar(9) select NULL information_schema TRIGGERS ACTION_TIMING 12 NO varchar 6 18 NULL NULL utf8 utf8_general_ci varchar(6) select NULL information_schema TRIGGERS ACTION_REFERENCE_OLD_TABLE 13 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select @@ -13026,8 +13022,8 @@ NULL information_schema TRIGGERS ACTION_REFERENCE_NEW_TABLE 14 NULL YES varchar NULL information_schema TRIGGERS ACTION_REFERENCE_OLD_ROW 15 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select NULL information_schema TRIGGERS ACTION_REFERENCE_NEW_ROW 16 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select NULL information_schema TRIGGERS CREATED 17 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select -NULL information_schema TRIGGERS SQL_MODE 18 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select -NULL information_schema TRIGGERS DEFINER 19 NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema TRIGGERS SQL_MODE 18 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select +NULL information_schema TRIGGERS DEFINER 19 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select Testcase 3.2.18.2 + 3.2.18.3: -------------------------------------------------------------------------------- diff --git a/mysql-test/suite/funcs_2/r/innodb_charset.result b/mysql-test/suite/funcs_2/r/innodb_charset.result index 25b720af1da..09076145c44 100644 --- a/mysql-test/suite/funcs_2/r/innodb_charset.result +++ b/mysql-test/suite/funcs_2/r/innodb_charset.result @@ -737,7 +737,6 @@ a_ascii a_len 44 1 64 1 45 1 -60 1 65 1 46 1 66 1 @@ -779,17 +778,18 @@ a_ascii a_len 78 1 59 1 79 1 -7E 1 5A 1 7A 1 -5D 1 5B 1 5C 1 +5D 1 5E 1 5F 1 +60 1 7B 1 7C 1 7D 1 +7E 1 7F 1 80 1 81 1 diff --git a/mysql-test/suite/funcs_2/r/memory_charset.result b/mysql-test/suite/funcs_2/r/memory_charset.result index 073b057d733..8536ac4a9b2 100644 --- a/mysql-test/suite/funcs_2/r/memory_charset.result +++ b/mysql-test/suite/funcs_2/r/memory_charset.result @@ -737,7 +737,6 @@ a_ascii a_len 44 1 64 1 45 1 -60 1 65 1 46 1 66 1 @@ -779,17 +778,18 @@ a_ascii a_len 78 1 59 1 79 1 -7E 1 5A 1 7A 1 -5D 1 5B 1 5C 1 +5D 1 5E 1 5F 1 +60 1 7B 1 7C 1 7D 1 +7E 1 7F 1 80 1 81 1 diff --git a/mysql-test/suite/funcs_2/r/myisam_charset.result b/mysql-test/suite/funcs_2/r/myisam_charset.result index 50ed8aca2cc..698cce1be37 100644 --- a/mysql-test/suite/funcs_2/r/myisam_charset.result +++ b/mysql-test/suite/funcs_2/r/myisam_charset.result @@ -737,7 +737,6 @@ a_ascii a_len 44 1 64 1 45 1 -60 1 65 1 46 1 66 1 @@ -779,17 +778,18 @@ a_ascii a_len 78 1 59 1 79 1 -7E 1 5A 1 7A 1 -5D 1 5B 1 5C 1 +5D 1 5E 1 5F 1 +60 1 7B 1 7C 1 7D 1 +7E 1 7F 1 80 1 81 1 diff --git a/mysql-test/suite/funcs_2/r/ndb_charset.result b/mysql-test/suite/funcs_2/r/ndb_charset.result index 7a5c63f71d6..0a4dba2e302 100644 --- a/mysql-test/suite/funcs_2/r/ndb_charset.result +++ b/mysql-test/suite/funcs_2/r/ndb_charset.result @@ -737,7 +737,6 @@ a_ascii a_len 44 1 64 1 45 1 -60 1 65 1 46 1 66 1 @@ -779,17 +778,18 @@ a_ascii a_len 78 1 59 1 79 1 -7E 1 5A 1 7A 1 -5D 1 5B 1 5C 1 +5D 1 5E 1 5F 1 +60 1 7B 1 7C 1 7D 1 +7E 1 7F 1 80 1 81 1 diff --git a/mysql-test/t/almost_full.test b/mysql-test/t/almost_full.test new file mode 100644 index 00000000000..5c67ab3c088 --- /dev/null +++ b/mysql-test/t/almost_full.test @@ -0,0 +1,41 @@ +# +# Some special cases with empty tables +# + +--disable_warnings +drop table if exists t1; +--enable_warnings + +set global myisam_data_pointer_size=2; +CREATE TABLE t1 (a int auto_increment primary key not null, b longtext) ENGINE=MyISAM; + +--disable_query_log +let $1= 303; +while ($1) +{ + INSERT INTO t1 SET b=repeat('a',200); + dec $1; +} +--enable_query_log + +DELETE FROM t1 WHERE a=1 or a=5; + +--error 1114 +INSERT INTO t1 SET b=repeat('a',600); +CHECK TABLE t1 EXTENDED; + +--error 1114 +UPDATE t1 SET b=repeat('a', 800) where a=10; +CHECK TABLE t1 EXTENDED; + +INSERT INTO t1 SET b=repeat('a',400); +CHECK TABLE t1 EXTENDED; + +DELETE FROM t1 WHERE a=2 or a=6; +UPDATE t1 SET b=repeat('a', 600) where a=11; +CHECK TABLE t1 EXTENDED; +drop table t1; + +set global myisam_data_pointer_size=default; + +# End of 4.1 tests diff --git a/mysql-test/t/bdb_gis.test b/mysql-test/t/bdb_gis.test index 88dcbb7cbe9..cb6d0683874 100644 --- a/mysql-test/t/bdb_gis.test +++ b/mysql-test/t/bdb_gis.test @@ -1,3 +1,4 @@ -- source include/have_bdb.inc SET storage_engine=bdb; --source include/gis_generic.inc +--source include/gis_keys.inc diff --git a/mysql-test/t/cast.test b/mysql-test/t/cast.test index 316b79efe4d..df475b49746 100644 --- a/mysql-test/t/cast.test +++ b/mysql-test/t/cast.test @@ -246,4 +246,26 @@ INSERT INTO t1(d1) VALUES ('2007-07-19 08:30:00'), (NULL), SELECT cast(date(d1) as signed) FROM t1; drop table t1; +# +# Bug #31990: MINUTE() and SECOND() return bogus results when used on a DATE +# + +# Show that HH:MM:SS of a DATE are 0, and that it's the same for columns +# and typecasts (NULL in, NULL out). +CREATE TABLE t1 (f1 DATE); +INSERT INTO t1 VALUES ('2007-07-19'), (NULL); +SELECT HOUR(f1), + MINUTE(f1), + SECOND(f1) FROM t1; +SELECT HOUR(CAST('2007-07-19' AS DATE)), + MINUTE(CAST('2007-07-19' AS DATE)), + SECOND(CAST('2007-07-19' AS DATE)); +SELECT HOUR(CAST(NULL AS DATE)), + MINUTE(CAST(NULL AS DATE)), + SECOND(CAST(NULL AS DATE)); +SELECT HOUR(NULL), + MINUTE(NULL), + SECOND(NULL); +DROP TABLE t1; + --echo End of 5.0 tests diff --git a/mysql-test/t/csv.test b/mysql-test/t/csv.test index b724b4ce47c..db5cb92c3e6 100644 --- a/mysql-test/t/csv.test +++ b/mysql-test/t/csv.test @@ -1427,4 +1427,37 @@ insert into t1 values (0xFF,'LATIN SMALL LETTER Y WITH DIAERESIS'); select hex(c), c, name from t1 order by 1; drop table t1; +# +# Bug #31473: does not work with NULL value in datetime field +# This bug is a 5.1 but is here to prevent 5.0 regression. +# +create table t1(a datetime) engine=csv; +insert into t1 values(); +select * from t1; +drop table t1; +create table t1(a set('foo','bar')) engine=csv; +insert into t1 values(); +select * from t1; +drop table t1; +create table t1(a varchar(32)) engine=csv; +insert into t1 values(); +select * from t1; +drop table t1; +create table t1(a int) engine=csv; +insert into t1 values(); +select * from t1; +drop table t1; +create table t1(a blob) engine=csv; +insert into t1 values(); +select * from t1; +drop table t1; +create table t1(a bit(1)) engine=csv; +insert into t1 values(); +select BIN(a) from t1; +drop table t1; +create table t1(a enum('foo','bar') default 'foo') engine=csv; +insert into t1 values(); +select * from t1; +drop table t1; + --echo End of 5.0 tests diff --git a/mysql-test/t/ctype_uca.test b/mysql-test/t/ctype_uca.test index 17632e7c8fc..695a21adbf5 100644 --- a/mysql-test/t/ctype_uca.test +++ b/mysql-test/t/ctype_uca.test @@ -530,7 +530,7 @@ create table t1 ( a varchar(255), key a(a) ) character set utf8 collate utf8_czech_ci; --- In Czech 'ch' is a single letter between 'h' and 'i' +# In Czech 'ch' is a single letter between 'h' and 'i' insert into t1 values ('b'),('c'),('d'),('e'),('f'),('g'),('h'),('ch'),('i'),('j'); select * from t1 where a like 'c%'; diff --git a/mysql-test/t/ctype_ucs.test b/mysql-test/t/ctype_ucs.test index a56a8b6eeed..732ba4f2d45 100644 --- a/mysql-test/t/ctype_ucs.test +++ b/mysql-test/t/ctype_ucs.test @@ -548,6 +548,12 @@ select quote(name) from bug20536; drop table bug20536; # +# BUG#31159 - fulltext search on ucs2 column crashes server +# +CREATE TABLE t1(a TEXT CHARSET ucs2 COLLATE ucs2_unicode_ci); +INSERT INTO t1 VALUES('abcd'); +SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abcd' IN BOOLEAN MODE); +DROP TABLE t1; # Bug #31615: crash after set names ucs2 collate xxx # --error 1231 @@ -663,4 +669,9 @@ select * from t1 where a=if(b<10,_ucs2 0x00C0,_ucs2 0x0062); select * from t1 where a=if(b<10,_ucs2 0x0062,_ucs2 0x00C0); drop table t1; +# +# Bug#30981 CHAR(0x41 USING ucs2) doesn't add leading zero +# +select hex(char(0x41 using ucs2)); + --echo End of 5.0 tests diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test index f8eed0bae9a..0ae4b2be0ca 100644 --- a/mysql-test/t/ctype_utf8.test +++ b/mysql-test/t/ctype_utf8.test @@ -1403,3 +1403,30 @@ SELECT b FROM t2 UNION SELECT c FROM t1; SELECT i FROM t2 UNION SELECT c FROM t1; DROP TABLE t1, t2; + +# +# Bug#30982: CHAR(..USING..) can return a not-well-formed string +# Bug #30986: Character set introducer followed by a HEX string can return bad result +# +set sql_mode=traditional; +select hex(char(0xFF using utf8)); +select hex(convert(0xFF using utf8)); +--error ER_INVALID_CHARACTER_STRING +select hex(_utf8 0x616263FF); +--error ER_INVALID_CHARACTER_STRING +select hex(_utf8 X'616263FF'); +--error ER_INVALID_CHARACTER_STRING +select hex(_utf8 B'001111111111'); +--error ER_INVALID_CHARACTER_STRING +select (_utf8 X'616263FF'); +set sql_mode=default; +select hex(char(0xFF using utf8)); +select hex(convert(0xFF using utf8)); +--error ER_INVALID_CHARACTER_STRING +select hex(_utf8 0x616263FF); +--error ER_INVALID_CHARACTER_STRING +select hex(_utf8 X'616263FF'); +--error ER_INVALID_CHARACTER_STRING +select hex(_utf8 B'001111111111'); +--error ER_INVALID_CHARACTER_STRING +select (_utf8 X'616263FF'); diff --git a/mysql-test/t/delete.test b/mysql-test/t/delete.test index 8a03cb6c715..602e30687c8 100644 --- a/mysql-test/t/delete.test +++ b/mysql-test/t/delete.test @@ -277,3 +277,18 @@ SELECT * FROM t1; DROP TABLE t1, t2; DROP DATABASE db1; DROP DATABASE db2; + +# +# Bug 31742: delete from ... order by function call that causes an error, +# asserts server +# + +CREATE FUNCTION f1() RETURNS INT RETURN 1; +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (0); +--error 1318 +DELETE FROM t1 ORDER BY (f1(10)) LIMIT 1; +DROP TABLE t1; +DROP FUNCTION f1; + +--echo End of 5.0 tests diff --git a/mysql-test/t/derived.test b/mysql-test/t/derived.test index 4d8a8e3c3af..4e79fac584f 100644 --- a/mysql-test/t/derived.test +++ b/mysql-test/t/derived.test @@ -211,7 +211,8 @@ drop table t2; # select list counter # CREATE TABLE `t1` ( `itemid` int(11) NOT NULL default '0', `grpid` varchar(15) NOT NULL default '', `vendor` int(11) NOT NULL default '0', `date_` date NOT NULL default '0000-00-00', `price` decimal(12,2) NOT NULL default '0.00', PRIMARY KEY (`itemid`,`grpid`,`vendor`,`date_`), KEY `itemid` (`itemid`,`vendor`), KEY `itemid_2` (`itemid`,`date_`)); -insert into t1 values (128, 'rozn', 2, now(), 10),(128, 'rozn', 1, now(), 10); +insert into t1 values (128, 'rozn', 2, curdate(), 10), + (128, 'rozn', 1, curdate(), 10); SELECT MIN(price) min, MAX(price) max, AVG(price) avg FROM (SELECT SUBSTRING( MAX(concat(date_,";",price)), 12) price FROM t1 WHERE itemid=128 AND grpid='rozn' GROUP BY itemid, grpid, vendor) lastprices; DROP TABLE t1; diff --git a/mysql-test/t/fulltext.test b/mysql-test/t/fulltext.test index 44375562307..e5f1db14b7f 100644 --- a/mysql-test/t/fulltext.test +++ b/mysql-test/t/fulltext.test @@ -387,4 +387,12 @@ ALTER TABLE t1 DISABLE KEYS; SELECT * FROM t1 WHERE MATCH(a) AGAINST('test'); DROP TABLE t1; +# +# BUG#11392 - fulltext search bug +# +CREATE TABLE t1(a TEXT); +INSERT INTO t1 VALUES(' aaaaa aaaa'); +SELECT * FROM t1 WHERE MATCH(a) AGAINST ('"aaaa"' IN BOOLEAN MODE); +DROP TABLE t1; + # End of 4.1 tests diff --git a/mysql-test/t/func_gconcat.test b/mysql-test/t/func_gconcat.test index c415ca6c6eb..df8199a5bc7 100644 --- a/mysql-test/t/func_gconcat.test +++ b/mysql-test/t/func_gconcat.test @@ -590,4 +590,13 @@ select group_concat(distinct a, c order by a desc, c desc) from t1; drop table t1; +# +# Bug#30897 GROUP_CONCAT returns extra comma on empty fields +# +create table t1 (f1 char(20)); +insert into t1 values (''),(''); +select group_concat(distinct f1) from t1; +select group_concat(f1) from t1; +drop table t1; + --echo End of 5.0 tests diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test index 2293ac71454..25cb13a2f75 100644 --- a/mysql-test/t/func_group.test +++ b/mysql-test/t/func_group.test @@ -860,5 +860,46 @@ SELECT MIN(a), MIN(b) FROM t5 WHERE a = 1 and b > 1; DROP TABLE t1, t2, t3, t4, t5; +# +# Bug #31156: mysqld: item_sum.cc:918: +# virtual bool Item_sum_distinct::setup(THD*): Assertion +# + +CREATE TABLE t1 (a INT); +INSERT INTO t1 values (),(),(); +SELECT (SELECT SLEEP(0) FROM t1 ORDER BY AVG(DISTINCT a) ) as x FROM t1 + GROUP BY x; +SELECT 1 FROM t1 GROUP BY (SELECT SLEEP(0) FROM t1 ORDER BY AVG(DISTINCT a) ); + +DROP TABLE t1; + +# +# Bug #30715: Assertion failed: item_field->field->real_maybe_null(), file +# .\opt_sum.cc, line +# + +CREATE TABLE t1 (a int, b date NOT NULL, KEY k1 (a,b)); +SELECT MIN(b) FROM t1 WHERE a=1 AND b>'2007-08-01'; +DROP TABLE t1; + +# +# Bug #31794: no syntax error on SELECT id FROM t HAVING count(*)>2; +# + +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2),(3),(4); + +SET SQL_MODE=ONLY_FULL_GROUP_BY; +--error ER_MIX_OF_GROUP_FUNC_AND_FIELDS +SELECT a FROM t1 HAVING COUNT(*)>2; +--error ER_MIX_OF_GROUP_FUNC_AND_FIELDS +SELECT COUNT(*), a FROM t1; + +SET SQL_MODE=DEFAULT; +SELECT a FROM t1 HAVING COUNT(*)>2; +SELECT COUNT(*), a FROM t1; + +DROP TABLE t1; + ### --echo End of 5.0 tests diff --git a/mysql-test/t/func_math.test b/mysql-test/t/func_math.test index 2ba07dfc581..9f12fdd696e 100644 --- a/mysql-test/t/func_math.test +++ b/mysql-test/t/func_math.test @@ -205,4 +205,29 @@ select mod(cast(-2 as unsigned), 3), mod(18446744073709551614, 3), mod(-2, 3); select mod(5, cast(-2 as unsigned)), mod(5, 18446744073709551614), mod(5, -2); select pow(cast(-2 as unsigned), 5), pow(18446744073709551614, 5), pow(-2, 5); +# +# Bug #30587: mysql crashes when trying to group by TIME div NUMBER +# + +CREATE TABLE t1 (a timestamp, b varchar(20), c bit(1)); +INSERT INTO t1 VALUES('1998-09-23', 'str1', 1), ('2003-03-25', 'str2', 0); +SELECT a DIV 900 y FROM t1 GROUP BY y; +SELECT DISTINCT a DIV 900 y FROM t1; +SELECT b DIV 900 y FROM t1 GROUP BY y; +SELECT c DIV 900 y FROM t1 GROUP BY y; +DROP TABLE t1; + +CREATE TABLE t1(a LONGBLOB); +INSERT INTO t1 VALUES('1'),('2'),('3'); +SELECT DISTINCT (a DIV 254576881) FROM t1; +SELECT (a DIV 254576881) FROM t1 UNION ALL + SELECT (a DIV 254576881) FROM t1; +DROP TABLE t1; + +CREATE TABLE t1(a SET('a','b','c')); +INSERT INTO t1 VALUES ('a'); +SELECT a DIV 2 FROM t1 UNION SELECT a DIV 2 FROM t1; +DROP TABLE t1; + + --echo End of 5.0 tests diff --git a/mysql-test/t/func_misc.test b/mysql-test/t/func_misc.test index 5a70daa50e8..ae0dc3f20ea 100644 --- a/mysql-test/t/func_misc.test +++ b/mysql-test/t/func_misc.test @@ -196,5 +196,19 @@ create table t1 (a int not null); insert into t1 values (-1), (-2); select min(a) from t1 group by inet_ntoa(a); drop table t1; +# Bug #30832: Assertion + crash with select name_const('test',now()); +# +--error ER_WRONG_ARGUMENTS +SELECT NAME_CONST('test', NOW()); +--error ER_WRONG_ARGUMENTS +SELECT NAME_CONST('test', UPPER('test')); + +SELECT NAME_CONST('test', NULL); +SELECT NAME_CONST('test', 1); +SELECT NAME_CONST('test', -1); +SELECT NAME_CONST('test', 1.0); +SELECT NAME_CONST('test', -1.0); +SELECT NAME_CONST('test', 'test'); --echo End of 5.0 tests + diff --git a/mysql-test/t/func_regexp.test b/mysql-test/t/func_regexp.test index 23070c71fe9..5eff404bc0f 100644 --- a/mysql-test/t/func_regexp.test +++ b/mysql-test/t/func_regexp.test @@ -74,4 +74,13 @@ execute stmt1 using @a; deallocate prepare stmt1; drop table t1; -# End of 4.1 tests +--echo End of 4.1 tests + + +# +# Bug #31440: 'select 1 regex null' asserts debug server +# + +SELECT 1 REGEXP NULL; + +--echo End of 5.0 tests diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test index 1a32580aa0f..1ca2bbfaf4c 100644 --- a/mysql-test/t/func_str.test +++ b/mysql-test/t/func_str.test @@ -738,6 +738,19 @@ explain extended select encode(f1,'zxcv') as 'enc' from t1; explain extended select decode(f1,'zxcv') as 'enc' from t1; drop table t1; +# +# Bug #31758 inet_ntoa, oct, crashes server with null + filesort +# +create table t1 (a bigint not null)engine=myisam; +insert into t1 set a = 1024*1024*1024*4; +delete from t1 order by (inet_ntoa(a)) desc limit 10; +drop table t1; +create table t1 (a char(36) not null)engine=myisam; +insert ignore into t1 set a = ' '; +insert ignore into t1 set a = ' '; +select * from t1 order by (oct(a)); +drop table t1; + --echo End of 4.1 tests # @@ -1124,4 +1137,16 @@ SELECT SUBSTR(a,1,len) FROM t1; DROP TABLE t1; +# +# Bug #28850: Potential bugs related to the return type of the CHAR function +# + +CREATE TABLE t1 AS SELECT CHAR(0x414243) as c1; +SELECT HEX(c1) from t1; +DROP TABLE t1; + +CREATE VIEW v1 AS SELECT CHAR(0x414243) as c1; +SELECT HEX(c1) from v1; +DROP VIEW v1; + --echo End of 5.0 tests diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test index 86c848983fa..c0a449ac3f4 100644 --- a/mysql-test/t/func_time.test +++ b/mysql-test/t/func_time.test @@ -545,6 +545,16 @@ DROP TABLE testBug8868; SET NAMES DEFAULT; +# +# Bug #31160: MAKETIME() crashes server when returning NULL in ORDER BY using +# filesort +# +CREATE TABLE t1 ( + a TIMESTAMP +); +INSERT INTO t1 VALUES (now()), (now()); +SELECT 1 FROM t1 ORDER BY MAKETIME(1, 1, a); +DROP TABLE t1; # # Bug #19844 time_format in Union truncates values diff --git a/mysql-test/t/gis-rtree.test b/mysql-test/t/gis-rtree.test index 74b12caca41..e68e5039adf 100644 --- a/mysql-test/t/gis-rtree.test +++ b/mysql-test/t/gis-rtree.test @@ -797,6 +797,42 @@ UPDATE t1 set spatial_point=GeomFromText('POINT(41 46)') where c1 like 'f%'; CHECK TABLE t1 EXTENDED; DROP TABLE t1; +# +# Bug #30286 spatial index cause corruption and server crash! +# + +create table t1 (a geometry not null, spatial index(a)); +insert into t1 values (PointFromWKB(POINT(1.1517219314031e+164, 131072))); +insert into t1 values (PointFromWKB(POINT(9.1248812352444e+192, 2.9740338169556e+284))); +insert into t1 values (PointFromWKB(POINT(4.7783097267365e-299, -0))); +insert into t1 values (PointFromWKB(POINT(1.49166814624e-154, 2.0880974297595e-53))); +insert into t1 values (PointFromWKB(POINT(4.0917382598702e+149, 1.2024538023802e+111))); +insert into t1 values (PointFromWKB(POINT(2.0349165139404e+236, 2.9993936277913e-241))); +insert into t1 values (PointFromWKB(POINT(2.5243548967072e-29, 1.2024538023802e+111))); +insert into t1 values (PointFromWKB(POINT(0, 6.9835074892995e-251))); +insert into t1 values (PointFromWKB(POINT(2.0880974297595e-53, 3.1050361846014e+231))); +insert into t1 values (PointFromWKB(POINT(2.8728483499323e-188, 2.4600631144627e+260))); +insert into t1 values (PointFromWKB(POINT(3.0517578125e-05, 2.0349165139404e+236))); +insert into t1 values (PointFromWKB(POINT(1.1517219314031e+164, 1.1818212630766e-125))); +insert into t1 values (PointFromWKB(POINT(2.481040258324e-265, 5.7766220027675e-275))); +insert into t1 values (PointFromWKB(POINT(2.0880974297595e-53, 2.5243548967072e-29))); +insert into t1 values (PointFromWKB(POINT(5.7766220027675e-275, 9.9464647281957e+86))); +insert into t1 values (PointFromWKB(POINT(2.2181357552967e+130, 3.7857669957337e-270))); +insert into t1 values (PointFromWKB(POINT(4.5767114681874e-246, 3.6893488147419e+19))); +insert into t1 values (PointFromWKB(POINT(4.5767114681874e-246, 3.7537584144024e+255))); +insert into t1 values (PointFromWKB(POINT(3.7857669957337e-270, 1.8033161362863e-130))); +insert into t1 values (PointFromWKB(POINT(0, 5.8774717541114e-39))); +insert into t1 values (PointFromWKB(POINT(1.1517219314031e+164, 2.2761049594727e-159))); +insert into t1 values (PointFromWKB(POINT(6.243497100632e+144, 3.7857669957337e-270))); +insert into t1 values (PointFromWKB(POINT(3.7857669957337e-270, 2.6355494858076e-82))); +insert into t1 values (PointFromWKB(POINT(2.0349165139404e+236, 3.8518598887745e-34))); +insert into t1 values (PointFromWKB(POINT(4.6566128730774e-10, 2.0880974297595e-53))); +insert into t1 values (PointFromWKB(POINT(2.0880974297595e-53, 1.8827498946116e-183))); +insert into t1 values (PointFromWKB(POINT(1.8033161362863e-130, 9.1248812352444e+192))); +insert into t1 values (PointFromWKB(POINT(4.7783097267365e-299, 2.2761049594727e-159))); +insert into t1 values (PointFromWKB(POINT(1.94906280228e+289, 1.2338789709327e-178))); +drop table t1; + # End of 4.1 tests # diff --git a/mysql-test/t/gis.test b/mysql-test/t/gis.test index 79743a0b8f4..b7da7db1d76 100644 --- a/mysql-test/t/gis.test +++ b/mysql-test/t/gis.test @@ -431,6 +431,14 @@ INSERT INTO t1 VALUES (NULL); SELECT * FROM t1; DROP TABLE t1; +# +# Bug #30955 geomfromtext() crasher +# +CREATE TABLE `t1` ( `col9` set('a'), `col89` date); +INSERT INTO `t1` VALUES ('','0000-00-00'); +select geomfromtext(col9,col89) as a from t1; +DROP TABLE t1; + --echo End of 4.1 tests # @@ -590,4 +598,6 @@ SELECT AsText(GeometryFromText(CONCAT( --enable_query_log SELECT 1; +-- source include/gis_keys.inc + --echo End of 5.0 tests diff --git a/mysql-test/t/grant2.test b/mysql-test/t/grant2.test index a3a8e2d5d53..e2d92ee58d4 100644 --- a/mysql-test/t/grant2.test +++ b/mysql-test/t/grant2.test @@ -585,5 +585,37 @@ drop user mysqltest_1@localhost; drop user mysqltest_2@localhost; +# +# Bug #30468: column level privileges not respected when joining tables +# +CREATE DATABASE db1; + +USE db1; +CREATE TABLE t1 (a INT, b INT); +INSERT INTO t1 VALUES (1,1),(2,2); + +CREATE TABLE t2 (b INT, c INT); +INSERT INTO t2 VALUES (1,100),(2,200); + +GRANT SELECT ON t1 TO mysqltest1@localhost; +GRANT SELECT (b) ON t2 TO mysqltest1@localhost; + +connect (conn1,localhost,mysqltest1,,); +connection conn1; +USE db1; +--error ER_COLUMNACCESS_DENIED_ERROR +SELECT c FROM t2; +--error ER_COLUMNACCESS_DENIED_ERROR +SELECT * FROM t2; +--error ER_COLUMNACCESS_DENIED_ERROR +SELECT * FROM t1 JOIN t2 USING (b); + +connection default; +disconnect conn1; +DROP TABLE db1.t1, db1.t2; +DROP USER mysqltest1@localhost; +DROP DATABASE db1; + + --echo End of 5.0 tests diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test index b7c28cada46..b150db6dafe 100644 --- a/mysql-test/t/group_by.test +++ b/mysql-test/t/group_by.test @@ -815,3 +815,38 @@ EXPLAIN SELECT c,b FROM t1 GROUP BY c,b; SELECT c,b FROM t1 GROUP BY c,b; DROP TABLE t1; + +# +# Bug #32202: ORDER BY not working with GROUP BY +# + +CREATE TABLE t1( + id INT AUTO_INCREMENT PRIMARY KEY, + c1 INT NOT NULL, + c2 INT NOT NULL, + UNIQUE KEY (c2,c1)); + +INSERT INTO t1(c1,c2) VALUES (5,1), (4,1), (3,5), (2,3), (1,3); + +# Show that the test cases from the bug report pass +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t1 GROUP BY id ORDER BY c1; + +# Show that DESC is handled correctly +SELECT * FROM t1 GROUP BY id ORDER BY id DESC; + +# Show that results are correctly ordered when ORDER BY fields +# are a subset of GROUP BY ones +SELECT * FROM t1 GROUP BY c2 ,c1, id ORDER BY c2, c1; +SELECT * FROM t1 GROUP BY c2, c1, id ORDER BY c2 DESC, c1; +SELECT * FROM t1 GROUP BY c2, c1, id ORDER BY c2 DESC, c1 DESC; + +# Show that results are correctly ordered when GROUP BY fields +# are a subset of ORDER BY ones +SELECT * FROM t1 GROUP BY c2 ORDER BY c2, c1; +SELECT * FROM t1 GROUP BY c2 ORDER BY c2 DESC, c1; +SELECT * FROM t1 GROUP BY c2 ORDER BY c2 DESC, c1 DESC; + +DROP TABLE t1; + +--echo End of 5.0 tests diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test index e9a06c7186e..3d3310e389e 100644 --- a/mysql-test/t/information_schema.test +++ b/mysql-test/t/information_schema.test @@ -1088,4 +1088,33 @@ select column_default from information_schema.columns where table_name= 't1'; show columns from t1; drop table t1; +# +# Bug#31633 Information schema = NULL queries crash the server +# +select * from information_schema.columns where table_schema = NULL; +select * from `information_schema`.`COLUMNS` where `TABLE_NAME` = NULL; +select * from `information_schema`.`KEY_COLUMN_USAGE` where `TABLE_SCHEMA` = NULL; +select * from `information_schema`.`KEY_COLUMN_USAGE` where `TABLE_NAME` = NULL; +select * from information_schema.schemata where schema_name = NULL; +select * from `information_schema`.`STATISTICS` where `TABLE_SCHEMA` = NULL; +select * from `information_schema`.`STATISTICS` where `TABLE_NAME` = NULL; +select * from information_schema.tables where table_schema = NULL; +select * from information_schema.tables where table_catalog = NULL; +select * from information_schema.tables where table_name = NULL; +select * from `information_schema`.`TABLE_CONSTRAINTS` where `TABLE_SCHEMA` = NULL; +select * from `information_schema`.`TABLE_CONSTRAINTS` where `TABLE_NAME` = NULL; +select * from `information_schema`.`TRIGGERS` where `EVENT_OBJECT_SCHEMA` = NULL; +select * from `information_schema`.`TRIGGERS` where `EVENT_OBJECT_TABLE` = NULL; +select * from `information_schema`.`VIEWS` where `TABLE_SCHEMA` = NULL; +select * from `information_schema`.`VIEWS` where `TABLE_NAME` = NULL; + --echo End of 5.0 tests. + +# +# Bug#30079 A check for "hidden" I_S tables is flawed +# +--error 1109 +show fields from information_schema.table_names; +--error 1109 +show keys from information_schema.table_names; + diff --git a/mysql-test/t/innodb_gis.test b/mysql-test/t/innodb_gis.test index 142b526af92..024d17c5363 100644 --- a/mysql-test/t/innodb_gis.test +++ b/mysql-test/t/innodb_gis.test @@ -1,3 +1,4 @@ --source include/have_innodb.inc SET storage_engine=innodb; --source include/gis_generic.inc +--source include/gis_keys.inc diff --git a/mysql-test/t/insert_select.test b/mysql-test/t/insert_select.test index fcd07a21821..78a903e0d18 100644 --- a/mysql-test/t/insert_select.test +++ b/mysql-test/t/insert_select.test @@ -385,3 +385,15 @@ INSERT INTO t1 (prev_id) SELECT id SELECT * FROM t1; DROP TABLE t1,t2; + +--echo # +--echo # Bug#30384: Having SQL_BUFFER_RESULT option in the +--echo # CREATE .. KEY(..) .. SELECT led to creating corrupted index. +--echo # +create table t1(f1 int); +insert into t1 values(1),(2),(3); +create table t2 (key(f1)) engine=myisam select sql_buffer_result f1 from t1; +check table t2 extended; +drop table t1,t2; +--echo ################################################################## + diff --git a/mysql-test/t/lowercase_view.test b/mysql-test/t/lowercase_view.test index e9cc26bec18..d6612b3e6b9 100644 --- a/mysql-test/t/lowercase_view.test +++ b/mysql-test/t/lowercase_view.test @@ -138,3 +138,26 @@ create view v1Aa as select AaA.col1 from t1Aa as AaA; show create view v1AA; drop view v1AA; drop table t1Aa; + + +# +# Bug #31562: HAVING and lower case +# + +CREATE TABLE t1 (a int, b int); + +select X.a from t1 AS X group by X.b having (X.a = 1); +select X.a from t1 AS X group by X.b having (x.a = 1); +select X.a from t1 AS X group by X.b having (x.b = 1); + +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; + +SELECT * FROM v1; + +DROP VIEW v1; +DROP TABLE t1; + +--echo End of 5.0 tests. diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test index d5f403616c8..ad223dc2664 100644 --- a/mysql-test/t/myisam.test +++ b/mysql-test/t/myisam.test @@ -1161,4 +1161,30 @@ ALTER TABLE t1 ENABLE KEYS; SELECT a FROM t1 FORCE INDEX (inx) WHERE a=1; DROP TABLE t1; +# +# Bug#4692 - DISABLE/ENABLE KEYS waste a space +# +CREATE TABLE t1 (c1 INT, c2 INT, UNIQUE INDEX (c1), INDEX (c2)) ENGINE=MYISAM; +--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 # +SHOW TABLE STATUS LIKE 't1'; +INSERT INTO t1 VALUES (1,1); +--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 # +SHOW TABLE STATUS LIKE 't1'; +ALTER TABLE t1 DISABLE KEYS; +--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 # +SHOW TABLE STATUS LIKE 't1'; +ALTER TABLE t1 ENABLE KEYS; +--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 # +SHOW TABLE STATUS LIKE 't1'; +ALTER TABLE t1 DISABLE KEYS; +--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 # +SHOW TABLE STATUS LIKE 't1'; +ALTER TABLE t1 ENABLE KEYS; +--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 # +SHOW TABLE STATUS LIKE 't1'; +#--exec ls -log var/master-data/test/t1.MYI +#--exec myisamchk -dvv var/master-data/test/t1.MYI +#--exec myisamchk -iev var/master-data/test/t1.MYI +DROP TABLE t1; + --echo End of 5.0 tests diff --git a/mysql-test/t/mysql_comments.sql b/mysql-test/t/mysql_comments.sql new file mode 100644 index 00000000000..60b223a240f --- /dev/null +++ b/mysql-test/t/mysql_comments.sql @@ -0,0 +1,177 @@ +##============================================================================ +## Notes +##============================================================================ + +# Test case for Bug#11230 + +# The point of this test is to make sure that '#', '-- ' and '/* ... */' +# comments, as well as empty lines, are sent from the client to the server. +# This is to ensure better error reporting, and to keep comments in the code +# for stored procedures / functions / triggers (Bug#11230). +# As a result, be careful when editing comments in this script, they do +# matter. +# +# Also, note that this is a script for **mysql**, not mysqltest. +# This is critical, as the mysqltest client interprets comments differently. + +##============================================================================ +## Setup +##============================================================================ + +## See mysql_comments.test for initial cleanup + +# Test tables +# +# t1 is reused throughout the file, and dropped at the end. +# +drop table if exists t1; +create table t1 ( + id char(16) not null default '', + data int not null +); + +##============================================================================ +## Comments outside statements +##============================================================================ + +# Ignored 1a +-- Ignored 1b +/* + Ignored 1c +*/ + +select 1; + +##============================================================================ +## Comments inside statements +##============================================================================ + +select # comment 1a +# comment 2a +-- comment 2b +/* + comment 2c +*/ +2 +; # not strictly inside, but on same line +# ignored + +##============================================================================ +## Comments inside functions +##============================================================================ + +drop function if exists foofct ; + +create function foofct (x char(20)) +returns char(20) +/* not inside the body yet */ +return +-- comment 1a +# comment 1b +/* comment 1c */ +x; # after body, on same line + +select foofct("call 1"); + +show create function foofct; +drop function foofct; + +delimiter | + +create function foofct(x char(20)) +returns char(20) +begin + -- comment 1a + # comment 1b + /* + comment 1c + */ + + -- empty line below + + -- empty line above + return x; +end| + +delimiter ; + +select foofct("call 2"); + +show create function foofct; +drop function foofct; + +##============================================================================ +## Comments inside stored procedures +##============================================================================ + +# Empty statement +drop procedure if exists empty; +create procedure empty() +begin +end; + +call empty(); +show create procedure empty; +drop procedure empty; + +drop procedure if exists foosp; + +## These comments are before the create, and will be lost +# Comment 1a +-- Comment 1b +/* + Comment 1c + */ +create procedure foosp() +/* Comment not quiet in the body yet */ + insert into test.t1 +## These comments are part of the procedure body, and should be kept. +# Comment 2a +-- Comment 2b +/* Comment 2c */ + -- empty line below + + -- empty line above + values ("foo", 42); # comment 3, still part of the body +## After the ';', therefore not part of the body +# comment 4a +-- Comment 4b +/* + Comment 4c + */ + +call foosp(); +select * from t1; +delete from t1; +show create procedure foosp; +drop procedure foosp; + +drop procedure if exists nicesp; + +delimiter | + +create procedure nicesp(a int) +begin + -- declare some variables here + declare b int; + declare c float; + + -- do more stuff here + -- commented nicely and so on + + -- famous last words ... +end| + +delimiter ; + +show create procedure nicesp; +drop procedure nicesp; + +# Triggers can be tested only in 5.1, since 5.0 does not have +# SHOW CREATE TRIGGER + +##============================================================================ +## Cleanup +##============================================================================ + +drop table t1; diff --git a/mysql-test/t/mysql_comments.test b/mysql-test/t/mysql_comments.test new file mode 100644 index 00000000000..1f997aeb1ab --- /dev/null +++ b/mysql-test/t/mysql_comments.test @@ -0,0 +1,37 @@ +# This test should work in embedded server after we fix mysqltest +-- source include/not_embedded.inc +###################### mysql_comments.test ############################# +# # +# Testing of comments handling by the command line client (mysql) # +# # +# Creation: # +# 2007-10-29 akopytov Implemented this test as a part of fixes for # +# bug #26215 and bug #11230 # +# # +######################################################################## + +# +# Bug #11230: Keeping comments when storing stored procedures +# + +# See the content of mysql_comments.sql +# Set the test database to a known state before running the tests. +--disable_warnings +drop table if exists t1; +drop function if exists foofct; +drop procedure if exists empty; +drop procedure if exists foosp; +drop procedure if exists nicesp; +drop trigger if exists t1_empty; +drop trigger if exists t1_bi; +--enable_warnings + +# Test without comments +--echo "Pass 1 : --disable-comments" +--exec $MYSQL --disable-comments test 2>&1 < "./t/mysql_comments.sql" + +# Test with comments +--echo "Pass 2 : --enable-comments" +--exec $MYSQL --enable-comments test 2>&1 < "./t/mysql_comments.sql" + +--echo End of 5.0 tests diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test index 3c62577e781..6dba0a590d0 100644 --- a/mysql-test/t/mysqldump.test +++ b/mysql-test/t/mysqldump.test @@ -1576,6 +1576,23 @@ SELECT * FROM t2; DROP TABLE t1,t2; +--echo # +--echo # Bug#29815: new option for suppressing last line of mysqldump: +--echo # "Dump completed on" +--echo # + +--echo # --skip-dump-date: +--replace_regex /-- [^D][^u][^m][^p].*// /\/\*!.*// +--exec $MYSQL_DUMP --skip-dump-date test + +--echo # --dump-date: +--replace_regex /-- [^D][^u][^m][^p].*// /\/\*!.*// / on [0-9 :-]+/ on DATE/ +--exec $MYSQL_DUMP --dump-date test + +--echo # --dump-date (default): +--replace_regex /-- [^D][^u][^m][^p].*// /\/\*!.*// / on [0-9 :-]+/ on DATE/ +--exec $MYSQL_DUMP test + --echo # --echo # End of 5.0 tests --echo # diff --git a/mysql-test/t/ndb_condition_pushdown.test b/mysql-test/t/ndb_condition_pushdown.test index 748c26e2a9a..b5b7e41fb21 100644 --- a/mysql-test/t/ndb_condition_pushdown.test +++ b/mysql-test/t/ndb_condition_pushdown.test @@ -1718,5 +1718,1030 @@ SELECT fname, lname FROM t1 WHERE (fname like 'Y%') or (lname like 'F%'); set engine_condition_pushdown = 1; SELECT fname, lname FROM t1 WHERE (fname like 'Y%') or (lname like 'F%'); +# bug#29390 (scan filter is too large, discarded) + +drop table t1; + +create table t1 (a int, b int, c int, d int, primary key using hash(a)) + engine=ndbcluster; + +insert into t1 values (10,1,100,0+0x1111); +insert into t1 values (20,2,200,0+0x2222); +insert into t1 values (30,3,300,0+0x3333); +insert into t1 values (40,4,400,0+0x4444); +insert into t1 values (50,5,500,0+0x5555); + +set engine_condition_pushdown = on; + +select a,b,d from t1 + where b in (0,1,2,5) + order by b; + +--disable_query_log +select a,b,d from t1 + where b in ( +0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2, +0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2, +0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2, +0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2, +0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2, +0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2, +0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2, +0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2, +0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2, +0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2, +0,1,2,5,0,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,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2, +0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2, +0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2, +0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2, +0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2,5,0,1,2) + order by b; +--enable_query_log + set engine_condition_pushdown = @old_ecpd; DROP TABLE t1,t2,t3,t4,t5; diff --git a/mysql-test/t/ndb_update.test b/mysql-test/t/ndb_update.test index ebcc6995d74..0f8793300e0 100644 --- a/mysql-test/t/ndb_update.test +++ b/mysql-test/t/ndb_update.test @@ -33,6 +33,11 @@ UPDATE IGNORE t1 set pk1 = 1, c = 2 where pk1 = 4; select * from t1 order by pk1; UPDATE t1 set pk1 = pk1 + 10; select * from t1 order by pk1; +# bug#25817 +create unique index ib on t1(b); +update t1 set c = 4 where pk1 = 12; +update ignore t1 set b = 55 where pk1 = 14; +select * from t1 order by pk1; --disable_warnings DROP TABLE IF EXISTS t1; diff --git a/mysql-test/t/null.test b/mysql-test/t/null.test index 65e09b006ec..2878b54c357 100644 --- a/mysql-test/t/null.test +++ b/mysql-test/t/null.test @@ -1,6 +1,6 @@ # Initialise --disable_warnings -drop table if exists t1; +drop table if exists t1, t2; --enable_warnings # @@ -231,4 +231,27 @@ drop table bug19145a; drop table bug19145b; drop table bug19145c; -# End of 4.1 tests +--echo # End of 4.1 tests + +--echo # +--echo # Bug #31471: decimal_bin_size: Assertion `scale >= 0 && +--echo # precision > 0 && scale <= precision' +--echo # + +CREATE TABLE t1 (a DECIMAL (1, 0) ZEROFILL, b DECIMAL (1, 0) ZEROFILL); +INSERT INTO t1 (a, b) VALUES (0, 0); + +CREATE TABLE t2 SELECT IFNULL(a, b) FROM t1; +DESCRIBE t2; +DROP TABLE t2; + +CREATE TABLE t2 SELECT IFNULL(a, NULL) FROM t1; +DESCRIBE t2; +DROP TABLE t2; + +CREATE TABLE t2 SELECT IFNULL(NULL, b) FROM t1; +DESCRIBE t2; + +DROP TABLE t1, t2; + +--echo # End of 5.0 tests diff --git a/mysql-test/t/olap.test b/mysql-test/t/olap.test index 05934bff492..1ac99d9c39f 100644 --- a/mysql-test/t/olap.test +++ b/mysql-test/t/olap.test @@ -358,3 +358,12 @@ SELECT * FROM (SELECT a, SUM(a) FROM t1 GROUP BY a WITH ROLLUP) as t; DROP TABLE t1; +--echo # +--echo # Bug#31095: Unexpected NULL constant caused server crash. +--echo # +create table t1(a int); +insert into t1 values (1),(2),(3); +select count(a) from t1 group by null with rollup; +drop table t1; +--echo ############################################################## + diff --git a/mysql-test/t/outfile_loaddata.test b/mysql-test/t/outfile_loaddata.test new file mode 100644 index 00000000000..2f6ac998b3d --- /dev/null +++ b/mysql-test/t/outfile_loaddata.test @@ -0,0 +1,89 @@ +--disable_warnings +DROP TABLE IF EXISTS t1, t2; +--enable_warnings + +--echo # +--echo # Bug#31663 FIELDS TERMINATED BY special character +--echo # + +CREATE TABLE t1 (i1 int, i2 int, c1 VARCHAR(256), c2 VARCHAR(256)); +INSERT INTO t1 VALUES (101, 202, '-r-', '=raker='); + +--let $fields=* +--let $clauses=FIELDS TERMINATED BY 'raker' +--echo # $clauses, warning: + +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--eval SELECT $fields INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' $clauses FROM t1 +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--eval SELECT LOAD_FILE('$MYSQLTEST_VARDIR/tmp/bug31663.txt') +--eval CREATE TABLE t2 SELECT $fields FROM t1 +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' INTO TABLE t2 $clauses +--eval SELECT $fields FROM t2 +--remove_file $MYSQLTEST_VARDIR/tmp/bug31663.txt +DROP TABLE t2; + +--let $fields=i1, i2 +--let $clauses=FIELDS TERMINATED BY 'r' +--echo # Only numeric fields, $clauses, no warnings: + +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--eval SELECT $fields INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' $clauses FROM t1 +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--eval SELECT LOAD_FILE('$MYSQLTEST_VARDIR/tmp/bug31663.txt') +--eval CREATE TABLE t2 SELECT $fields FROM t1 +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' INTO TABLE t2 $clauses +--eval SELECT $fields FROM t2 +--remove_file $MYSQLTEST_VARDIR/tmp/bug31663.txt +DROP TABLE t2; + +--let $fields=* +--let $clauses=FIELDS TERMINATED BY '0' +--echo # $clauses, warning: + +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--eval SELECT $fields INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' $clauses FROM t1 +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--eval SELECT LOAD_FILE('$MYSQLTEST_VARDIR/tmp/bug31663.txt') +--eval CREATE TABLE t2 SELECT $fields FROM t1 +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' INTO TABLE t2 $clauses +--eval SELECT $fields FROM t2 +--remove_file $MYSQLTEST_VARDIR/tmp/bug31663.txt +DROP TABLE t2; + +--let $fields=* +--let $clauses=FIELDS OPTIONALLY ENCLOSED BY '"' TERMINATED BY '0' +--echo # $clauses, warning: + +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--eval SELECT $fields INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' $clauses FROM t1 +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--eval SELECT LOAD_FILE('$MYSQLTEST_VARDIR/tmp/bug31663.txt') +--eval CREATE TABLE t2 SELECT $fields FROM t1 +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' INTO TABLE t2 $clauses +--eval SELECT $fields FROM t2 +--remove_file $MYSQLTEST_VARDIR/tmp/bug31663.txt +DROP TABLE t2; + +--let $fields=c1, c2 +--let $clauses=FIELDS OPTIONALLY ENCLOSED BY '"' TERMINATED BY '0' +--echo # Only string fields, $clauses, no warnings: + +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--eval SELECT $fields INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' $clauses FROM t1 +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--eval SELECT LOAD_FILE('$MYSQLTEST_VARDIR/tmp/bug31663.txt') +--eval CREATE TABLE t2 SELECT $fields FROM t1 +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' INTO TABLE t2 $clauses +--eval SELECT $fields FROM t2 +--remove_file $MYSQLTEST_VARDIR/tmp/bug31663.txt +DROP TABLE t2; + +DROP TABLE t1; + +--echo # End of 5.0 tests. diff --git a/mysql-test/t/rpl_flush_log_loop.test b/mysql-test/t/rpl_flush_log_loop.test index 6e45047bd30..f0b368c285b 100644 --- a/mysql-test/t/rpl_flush_log_loop.test +++ b/mysql-test/t/rpl_flush_log_loop.test @@ -3,6 +3,9 @@ source include/master-slave.inc; +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +show variables like 'relay_log%'; + connection slave; stop slave; --replace_result $MASTER_MYPORT MASTER_PORT diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test index 5c30a17e08e..31c8a3f7d11 100644 --- a/mysql-test/t/select.test +++ b/mysql-test/t/select.test @@ -2360,6 +2360,27 @@ insert into t1 values (0xfffffffffffffffff, 0xfffffffffffffffff), select hex(a), hex(b) from t1; drop table t1; +# +# Bug #32103: optimizer crash when join on int and mediumint with variable in +# where clause +# + +CREATE TABLE t1 (c0 int); +CREATE TABLE t2 (c0 int); + +# We need any variable that: +# 1. has integer type, +# 2. can be used with the "@@name" syntax +# 3. available in every server build +INSERT INTO t1 VALUES(@@connect_timeout); +INSERT INTO t2 VALUES(@@connect_timeout); + +# We only need to ensure 1 row is returned to validate the results +--replace_column 1 X 2 X +SELECT * FROM t1 JOIN t2 ON t1.c0 = t2.c0 WHERE (t1.c0 <=> @@connect_timeout); + +DROP TABLE t1, t2; + --echo End of 4.1 tests # @@ -2742,14 +2763,14 @@ create table t1(f1 int, f2 date); insert into t1 values(1,'2005-01-01'),(2,'2005-09-01'),(3,'2005-09-30'), (4,'2005-10-01'),(5,'2005-12-30'); # should return all records -select * from t1 where f2 >= 0; -select * from t1 where f2 >= '0000-00-00'; +select * from t1 where f2 >= 0 order by f2; +select * from t1 where f2 >= '0000-00-00' order by f2; # should return 4,5 -select * from t1 where f2 >= '2005-09-31'; -select * from t1 where f2 >= '2005-09-3a'; +select * from t1 where f2 >= '2005-09-31' order by f2; +select * from t1 where f2 >= '2005-09-3a' order by f2; # should return 1,2,3 -select * from t1 where f2 <= '2005-09-31'; -select * from t1 where f2 <= '2005-09-3a'; +select * from t1 where f2 <= '2005-09-31' order by f2; +select * from t1 where f2 <= '2005-09-3a' order by f2; drop table t1; # @@ -3466,22 +3487,178 @@ DROP TABLE t1; # --disable_ps_protocol - SELECT 1 AS ` `; SELECT 1 AS ` `; SELECT 1 AS ` x`; - -CREATE VIEW v1 AS SELECT 1 AS ` `; -SELECT `` FROM v1; - -CREATE VIEW v2 AS SELECT 1 AS ` `; -SELECT `` FROM v2; - -CREATE VIEW v3 AS SELECT 1 AS ` x`; -SELECT `x` FROM v3; - -DROP VIEW v1, v2, v3; - --enable_ps_protocol +--error 1166 +CREATE VIEW v1 AS SELECT 1 AS ``; + +--error 1166 +CREATE VIEW v1 AS SELECT 1 AS ` `; + +--error 1166 +CREATE VIEW v1 AS SELECT 1 AS ` `; + +--error 1166 +CREATE VIEW v1 AS SELECT (SELECT 1 AS ` `); + +CREATE VIEW v1 AS SELECT 1 AS ` x`; +SELECT `x` FROM v1; + +--error 1166 +ALTER VIEW v1 AS SELECT 1 AS ` `; + +DROP VIEW v1; + +# +# Bug#31800: Date comparison fails with timezone and slashes for greater +# than comparison +# + +# On DATETIME-like literals with trailing garbage, BETWEEN fudged in a +# DATETIME comparator, while greater/less-than used bin-string comparisons. +# Should correctly be compared as DATE or DATETIME, but throw a warning: + +select str_to_date('2007-10-09','%Y-%m-%d') between '2007/10/01 00:00:00 GMT' + and '2007/10/20 00:00:00 GMT'; +select str_to_date('2007-10-09','%Y-%m-%d') > '2007/10/01 00:00:00 GMT-6'; +select str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/2000:00:00 GMT-6'; + +# We have all we need -- and trailing garbage: +# (leaving out a leading zero in first example to prove it's a +# value-comparison, not a string-comparison!) +select str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-1 00:00:00 GMT-6'; +select str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-01 x00:00:00 GMT-6'; +select str_to_date('2007-10-01','%Y-%m-%d %H:%i:%s') = '2007-10-01 00:00:00 GMT-6'; +select str_to_date('2007-10-01','%Y-%m-%d %H:%i:%s') = '2007-10-01 00:x00:00 GMT-6'; +# no time at all: +select str_to_date('2007-10-01','%Y-%m-%d %H:%i:%s') = '2007-10-01 x12:34:56 GMT-6'; +# partial time: +select str_to_date('2007-10-01 12:34:00','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34x:56 GMT-6'; +# fail, different second part: +select str_to_date('2007-10-01 12:34:56','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34x:56 GMT-6'; +# correct syntax, no trailing nonsense -- this one must throw no warning: +select str_to_date('2007-10-01 12:34:56','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34:56'; +# no warning, but failure (different hour parts): +select str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-01 12:00:00'; +# succeed: +select str_to_date('2007-10-01 12','%Y-%m-%d %H') = '2007-10-01 12:00:00'; +# succeed, but warn for "trailing garbage" (":34"): +select str_to_date('2007-10-01 12:34','%Y-%m-%d %H') = '2007-10-01 12:00:00'; +# invalid date (Feb 30) succeeds +select str_to_date('2007-02-30 12:34','%Y-%m-%d %H:%i') = '2007-02-30 12:34'; +# 0-day for both, just works in default SQL mode. +select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34'; +# 0-day, succeed +select str_to_date('2007-10-00','%Y-%m-%d') between '2007/09/01 00:00:00' + and '2007/10/20 00:00:00'; +set SQL_MODE=TRADITIONAL; +# 0-day throws warning in traditional mode, and fails +select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34'; +select str_to_date('2007-10-01 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34'; +# different code-path: get_datetime_value() with 0-day +select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-01 12:34'; +select str_to_date('2007-10-00','%Y-%m-%d') between '2007/09/01' + and '2007/10/20'; +set SQL_MODE=DEFAULT; +select str_to_date('2007-10-00','%Y-%m-%d') between '' and '2007/10/20'; +select str_to_date('','%Y-%m-%d') between '2007/10/01' and '2007/10/20'; +select str_to_date('','%Y-%m-%d %H:%i') = '2007-10-01 12:34'; +select str_to_date(NULL,'%Y-%m-%d %H:%i') = '2007-10-01 12:34'; +select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = ''; + +select str_to_date('1','%Y-%m-%d') = '1'; +select str_to_date('1','%Y-%m-%d') = '1'; +select str_to_date('','%Y-%m-%d') = ''; + +# these three should work! +select str_to_date('1000-01-01','%Y-%m-%d') between '0000-00-00' and NULL; +select str_to_date('1000-01-01','%Y-%m-%d') between NULL and '2000-00-00'; +select str_to_date('1000-01-01','%Y-%m-%d') between NULL and NULL; + +# +# Bug #30666: Incorrect order when using range conditions on 2 tables or more +# + +CREATE TABLE t1 (c11 INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY); +CREATE TABLE t2 (c21 INT UNSIGNED NOT NULL, + c22 INT DEFAULT NULL, + KEY(c21, c22)); +CREATE TABLE t3 (c31 INT UNSIGNED NOT NULL DEFAULT 0, + c32 INT DEFAULT NULL, + c33 INT NOT NULL, + c34 INT UNSIGNED DEFAULT 0, + KEY (c33, c34, c32)); + +INSERT INTO t1 values (),(),(),(),(); +INSERT INTO t2 SELECT a.c11, b.c11 FROM t1 a, t1 b; +INSERT INTO t3 VALUES (1, 1, 1, 0), + (2, 2, 0, 0), + (3, 3, 1, 0), + (4, 4, 0, 0), + (5, 5, 1, 0); + +# Show that ORDER BY produces the correct results order +SELECT c32 FROM t1, t2, t3 WHERE t1.c11 IN (1, 3, 5) AND + t3.c31 = t1.c11 AND t2.c21 = t1.c11 AND + t3.c33 = 1 AND t2.c22 in (1, 3) + ORDER BY c32; + +# Show that ORDER BY DESC produces the correct results order +SELECT c32 FROM t1, t2, t3 WHERE t1.c11 IN (1, 3, 5) AND + t3.c31 = t1.c11 AND t2.c21 = t1.c11 AND + t3.c33 = 1 AND t2.c22 in (1, 3) + ORDER BY c32 DESC; + +DROP TABLE t1, t2, t3; +########################################################################### + +--echo +--echo # +--echo # Bug#30736: Row Size Too Large Error Creating a Table and +--echo # Inserting Data. +--echo # + +--disable_warnings +DROP TABLE IF EXISTS t1; +DROP TABLE IF EXISTS t2; +--enable_warnings + +--echo + +CREATE TABLE t1( + c1 DECIMAL(10, 2), + c2 FLOAT); + +--echo + +INSERT INTO t1 VALUES (0, 1), (2, 3), (4, 5); + +--echo + +CREATE TABLE t2( + c3 DECIMAL(10, 2)) + SELECT + c1 * c2 AS c3 + FROM t1; + +--echo + +SELECT * FROM t1; + +--echo + +SELECT * FROM t2; + +--echo + +DROP TABLE t1; +DROP TABLE t2; + +--echo + +########################################################################### + --echo End of 5.0 tests diff --git a/mysql-test/t/skip_grants.test b/mysql-test/t/skip_grants.test index 75694672a17..02a381063ee 100644 --- a/mysql-test/t/skip_grants.test +++ b/mysql-test/t/skip_grants.test @@ -116,3 +116,15 @@ select count(*) from information_schema.COLUMN_PRIVILEGES; select count(*) from information_schema.SCHEMA_PRIVILEGES; select count(*) from information_schema.TABLE_PRIVILEGES; select count(*) from information_schema.USER_PRIVILEGES; + +# +# Bug #32020: loading udfs while --skip-grant-tables is enabled causes out of +# memory errors +# + +--error ER_CANT_INITIALIZE_UDF +CREATE FUNCTION a RETURNS STRING SONAME ''; +--error ER_SP_DOES_NOT_EXIST +DROP FUNCTION a; + +--echo End of 5.0 tests diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index d076ca6bd33..06a64f518fb 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -2970,7 +2970,7 @@ DROP TABLE t1,t2; CREATE TABLE t1 (a INT, b INT); INSERT INTO t1 VALUES (1, 2), (1,3), (1,4), (2,1), (2,2); --- returns no rows, when it should +# returns no rows, when it should SELECT a1.a, COUNT(*) FROM t1 a1 WHERE a1.a = 1 AND EXISTS( SELECT a2.a FROM t1 a2 WHERE a2.a = a1.a) GROUP BY a1.a; @@ -2987,4 +2987,61 @@ SELECT (SELECT SUM(t1.a) FROM t2 WHERE a!=0) FROM t1; SELECT (SELECT SUM(t1.a) FROM t2 WHERE a=1) FROM t1; DROP TABLE t1,t2; +# +# Bug #31884: Assertion + crash in subquery in the SELECT clause. +# + +CREATE TABLE t1 (a1 INT, a2 INT); +CREATE TABLE t2 (b1 INT, b2 INT); + +INSERT INTO t1 VALUES (100, 200); +INSERT INTO t1 VALUES (101, 201); +INSERT INTO t2 VALUES (101, 201); +INSERT INTO t2 VALUES (103, 203); + +SELECT ((a1,a2) IN (SELECT * FROM t2 WHERE b2 > 0)) IS NULL FROM t1; +DROP TABLE t1, t2; + +# +# Bug #28076: inconsistent binary/varbinary comparison +# + +CREATE TABLE t1 (s1 BINARY(5), s2 VARBINARY(5)); +INSERT INTO t1 VALUES (0x41,0x41), (0x42,0x42), (0x43,0x43); + +SELECT s1, s2 FROM t1 WHERE s2 IN (SELECT s1 FROM t1); +SELECT s1, s2 FROM t1 WHERE (s2, 10) IN (SELECT s1, 10 FROM t1); + +CREATE INDEX I1 ON t1 (s1); +CREATE INDEX I2 ON t1 (s2); + +SELECT s1, s2 FROM t1 WHERE s2 IN (SELECT s1 FROM t1); +SELECT s1, s2 FROM t1 WHERE (s2, 10) IN (SELECT s1, 10 FROM t1); + +TRUNCATE t1; +INSERT INTO t1 VALUES (0x41,0x41); +SELECT * FROM t1 WHERE s1 = (SELECT s2 FROM t1); + +DROP TABLE t1; + +CREATE TABLE t1 (a1 VARBINARY(2) NOT NULL DEFAULT '0', PRIMARY KEY (a1)); +CREATE TABLE t2 (a2 BINARY(2) default '0', INDEX (a2)); +CREATE TABLE t3 (a3 BINARY(2) default '0'); +INSERT INTO t1 VALUES (1),(2),(3),(4); +INSERT INTO t2 VALUES (1),(2),(3); +INSERT INTO t3 VALUES (1),(2),(3); +SELECT LEFT(t2.a2, 1) FROM t2,t3 WHERE t3.a3=t2.a2; +SELECT t1.a1, t1.a1 in (SELECT t2.a2 FROM t2,t3 WHERE t3.a3=t2.a2) FROM t1; +DROP TABLE t1,t2,t3; + +CREATE TABLE t1 (a1 BINARY(3) PRIMARY KEY, b1 VARBINARY(3)); +CREATE TABLE t2 (a2 VARBINARY(3) PRIMARY KEY); +CREATE TABLE t3 (a3 VARBINARY(3) PRIMARY KEY); +INSERT INTO t1 VALUES (1,10), (2,20), (3,30), (4,40); +INSERT INTO t2 VALUES (2), (3), (4), (5); +INSERT INTO t3 VALUES (10), (20), (30); +SELECT LEFT(t1.a1,1) FROM t1,t3 WHERE t1.b1=t3.a3; +SELECT a2 FROM t2 WHERE t2.a2 IN (SELECT t1.a1 FROM t1,t3 WHERE t1.b1=t3.a3); +DROP TABLE t1, t2, t3; + --echo End of 5.0 tests. diff --git a/mysql-test/t/symlink.test b/mysql-test/t/symlink.test index 8c67a4c1048..7eaeaa00c0a 100644 --- a/mysql-test/t/symlink.test +++ b/mysql-test/t/symlink.test @@ -124,6 +124,18 @@ enable_query_log; show create table t1; drop table t1; +# +# BUG#32111 - Security Breach via DATA/INDEX DIRECORY and RENAME TABLE +# +--replace_result $MYSQLTEST_VARDIR TEST_DIR +eval CREATE TABLE t1(a INT) +DATA DIRECTORY='$MYSQLTEST_VARDIR/master-data/mysql' +INDEX DIRECTORY='$MYSQLTEST_VARDIR/master-data/mysql'; +--replace_result $MYSQLTEST_VARDIR TEST_DIR +--error 1 +RENAME TABLE t1 TO user; +DROP TABLE t1; + # # Test specifying DATA DIRECTORY that is the same as what would normally # have been chosen. (Bug #8707) diff --git a/mysql-test/t/type_date.test b/mysql-test/t/type_date.test index 02cd07e3c16..507537457d3 100644 --- a/mysql-test/t/type_date.test +++ b/mysql-test/t/type_date.test @@ -136,3 +136,58 @@ insert into t1 values (9912101,9912101,9912101); insert into t1 values (11111,11111,11111); select * from t1; drop table t1; + +# +# Bug #30942: select str_to_date from derived table returns varying results +# +CREATE TABLE t1 ( + a INT +); + +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (NULL); + +SELECT str_to_date( '', a ) FROM t1; +DROP TABLE t1; + + +# +# Bug #31221: Optimizer incorrectly identifies impossible WHERE clause +# + +CREATE TABLE t1 (a DATE, b int, PRIMARY KEY (a,b)); +INSERT INTO t1 VALUES (DATE(NOW()), 1); +SELECT COUNT(*) FROM t1 WHERE a = NOW(); +EXPLAIN SELECT COUNT(*) FROM t1 WHERE a = NOW(); +INSERT INTO t1 VALUES (DATE(NOW()), 2); +SELECT COUNT(*) FROM t1 WHERE a = NOW(); +EXPLAIN SELECT COUNT(*) FROM t1 WHERE a = NOW(); +SELECT COUNT(*) FROM t1 WHERE a = NOW() AND b = 1; +EXPLAIN SELECT COUNT(*) FROM t1 WHERE a = NOW() AND b = 1; +ALTER TABLE t1 DROP PRIMARY KEY; +SELECT COUNT(*) FROM t1 WHERE a = NOW(); +EXPLAIN SELECT COUNT(*) FROM t1 WHERE a = NOW(); + +DROP TABLE t1; + +# +# Bug #28687: Search fails on '0000-00-00' date after sql_mode change +# + +CREATE TABLE t1 (a DATE); +CREATE TABLE t2 (a DATE); +CREATE INDEX i ON t1 (a); +INSERT INTO t1 VALUES ('0000-00-00'),('0000-00-00'); +INSERT INTO t2 VALUES ('0000-00-00'),('0000-00-00'); +SELECT * FROM t1 WHERE a = '0000-00-00'; +SELECT * FROM t2 WHERE a = '0000-00-00'; +SET SQL_MODE=TRADITIONAL; +EXPLAIN SELECT * FROM t1 WHERE a = '0000-00-00'; +SELECT * FROM t1 WHERE a = '0000-00-00'; +SELECT * FROM t2 WHERE a = '0000-00-00'; +--error ER_TRUNCATED_WRONG_VALUE +INSERT INTO t1 VALUES ('0000-00-00'); +SET SQL_MODE=DEFAULT; +DROP TABLE t1,t2; + +--echo End of 5.0 tests diff --git a/mysql-test/t/type_datetime.test b/mysql-test/t/type_datetime.test index 20733a14d46..08a94384aec 100644 --- a/mysql-test/t/type_datetime.test +++ b/mysql-test/t/type_datetime.test @@ -283,6 +283,43 @@ select * from t1 where f1 between 2002010 and 20070101000000; select * from t1 where f1 between 20020101 and 2007010100000; drop table t1; +--echo # +--echo # Bug#27216: functions with parameters of different date types may +--echo # return wrong type of the result. +--echo # +create table t1 (f1 date, f2 datetime, f3 varchar(20)); +create table t2 as select coalesce(f1,f1) as f4 from t1; +desc t2; +create table t3 as select coalesce(f1,f2) as f4 from t1; +desc t3; +create table t4 as select coalesce(f2,f2) as f4 from t1; +desc t4; +create table t5 as select coalesce(f1,f3) as f4 from t1; +desc t5; +create table t6 as select coalesce(f2,f3) as f4 from t1; +desc t6; +create table t7 as select coalesce(makedate(1997,1),f2) as f4 from t1; +desc t7; +create table t8 as select coalesce(cast('01-01-01' as datetime),f2) as f4 + from t1; +desc t8; +create table t9 as select case when 1 then cast('01-01-01' as date) + when 0 then cast('01-01-01' as date) end as f4 from t1; +desc t9; +create table t10 as select case when 1 then cast('01-01-01' as datetime) + when 0 then cast('01-01-01' as datetime) end as f4 from t1; +desc t10; +create table t11 as select if(1, cast('01-01-01' as datetime), + cast('01-01-01' as date)) as f4 from t1; +desc t11; +create table t12 as select least(cast('01-01-01' as datetime), + cast('01-01-01' as date)) as f4 from t1; +desc t12; +create table t13 as select ifnull(cast('01-01-01' as datetime), + cast('01-01-01' as date)) as f4 from t1; +desc t13; +drop tables t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13; +--echo ################################################################### # # Bug #31253: crash comparing datetime to double # Should return 1st row only. Crashes if NULL propagation fails. diff --git a/mysql-test/t/type_decimal.test b/mysql-test/t/type_decimal.test index 458583fca81..807d1e6b01e 100644 --- a/mysql-test/t/type_decimal.test +++ b/mysql-test/t/type_decimal.test @@ -410,6 +410,13 @@ SELECT ROUND(qty,3), dps, ROUND(qty,dps) FROM t1; DROP TABLE t1; # +# Bug#31019: MOD() function and operator crashes MySQL when +# divisor is very long and < 1 +# + +SELECT 1 % .123456789123456789123456789123456789123456789123456789123456789123456789123456789 AS '%'; +SELECT MOD(1, .123456789123456789123456789123456789123456789123456789123456789123456789123456789) AS 'MOD()'; + # Bug #31227: memory overrun with decimal (6,6) and zerofill and group_concat # valgrind will complain about this (the group_concat(f2)) on unpatched mysqld. # @@ -418,4 +425,57 @@ insert into t1 values (-0.123456,0.123456); select group_concat(f1),group_concat(f2) from t1; drop table t1; +# +# BUG#31450 "Query causes error 1048" +# +create table t1 ( + ua_id decimal(22,0) not null, + ua_invited_by_id decimal(22,0) default NULL, + primary key(ua_id) +); +insert into t1 values (123, NULL), (456, NULL); + +--echo this must not produce error 1048: +select * from t1 where ua_invited_by_id not in (select ua_id from t1); + +drop table t1; + +# +# Bug #30889: filesort and order by with float/numeric crashes server +# +--disable_warnings +DROP TABLE IF EXISTS t3; +DROP TABLE IF EXISTS t4; +--enable_warnings +CREATE TABLE t1( a NUMERIC, b INT ); +INSERT INTO t1 VALUES (123456, 40), (123456, 40); +SELECT TRUNCATE( a, b ) AS c FROM t1 ORDER BY c; +SELECT ROUND( a, b ) AS c FROM t1 ORDER BY c; +SELECT ROUND( a, 100 ) AS c FROM t1 ORDER BY c; + +CREATE TABLE t2( a NUMERIC, b INT ); +INSERT INTO t2 VALUES (123456, 100); +SELECT TRUNCATE( a, b ) AS c FROM t2 ORDER BY c; +SELECT ROUND( a, b ) AS c FROM t2 ORDER BY c; + +CREATE TABLE t3( a DECIMAL, b INT ); +INSERT INTO t3 VALUES (123456, 40), (123456, 40); +SELECT TRUNCATE( a, b ) AS c FROM t3 ORDER BY c; +SELECT ROUND( a, b ) AS c FROM t3 ORDER BY c; +SELECT ROUND( a, 100 ) AS c FROM t3 ORDER BY c; + +CREATE TABLE t4( a DECIMAL, b INT ); +INSERT INTO t4 VALUES (123456, 40), (123456, 40); +SELECT TRUNCATE( a, b ) AS c FROM t4 ORDER BY c; +SELECT ROUND( a, b ) AS c FROM t4 ORDER BY c; +SELECT ROUND( a, 100 ) AS c FROM t4 ORDER BY c; + +delete from t1; +INSERT INTO t1 VALUES (1234567890, 20), (999.99, 5); +show create table t1; + +select round(a,b) as c from t1 order by c; + +DROP TABLE t1, t2, t3, t4; + --echo End of 5.0 tests diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test index ccd487a72ea..a8f0a3425df 100644 --- a/mysql-test/t/variables.test +++ b/mysql-test/t/variables.test @@ -139,7 +139,7 @@ show global variables like 'net_%'; show session variables like 'net_%'; set net_buffer_length=1; show variables like 'net_buffer_length'; ---warning 1292 +#warning 1292 set net_buffer_length=2000000000; show variables like 'net_buffer_length'; @@ -536,7 +536,14 @@ set @test = @@query_prealloc_size; set @@query_prealloc_size = @test; select @@query_prealloc_size = @test; -# End of 4.1 tests +# +# Bug#31588 buffer overrun when setting variables +# +# Buffer-size Off By One. Should throw valgrind-warning without fix #31588. +--error 1231 +set global sql_mode=repeat('a',80); + +--echo End of 4.1 tests # # Bug#6282 Packet error with SELECT INTO @@ -675,6 +682,20 @@ set @@hostname= "anothername"; --replace_column 2 # show variables like 'hostname'; +# +# Bug #29131: SHOW VARIABLES reports variable 'log' but SET doesn't recognize it +# + +SHOW VARIABLES LIKE 'log'; +SELECT @@log; +--error 1238 +SET GLOBAL log=0; + +SHOW VARIABLES LIKE 'log_slow_queries'; +SELECT @@log_slow_queries; +--error 1238 +SET GLOBAL log_slow_queries=0; + --echo End of 5.0 tests # This is at the very after the versioned tests, since it involves doing diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index fc3fdc932ba..0faa8e7a785 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -510,7 +510,7 @@ drop table t1; # create table t1 (a int, b int); create view v1 as select a, sum(b) from t1 group by a; --- error 1176 +--error ER_WRONG_USAGE select b from v1 use index (some_index) where b=1; drop view v1; drop table t1; @@ -2548,19 +2548,20 @@ CREATE TABLE t1( fName varchar(25) NOT NULL, lName varchar(25) NOT NULL, DOB date NOT NULL, + test_date date NOT NULL, uID int unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY); -INSERT INTO t1(fName, lName, DOB) VALUES - ('Hank', 'Hill', '1964-09-29'), - ('Tom', 'Adams', '1908-02-14'), - ('Homer', 'Simpson', '1968-03-05'); +INSERT INTO t1(fName, lName, DOB, test_date) VALUES + ('Hank', 'Hill', '1964-09-29', '2007-01-01'), + ('Tom', 'Adams', '1908-02-14', '2007-01-01'), + ('Homer', 'Simpson', '1968-03-05', '2007-01-01'); CREATE VIEW v1 AS - SELECT (year(now())-year(DOB)) AS Age + SELECT (year(test_date)-year(DOB)) AS Age FROM t1 HAVING Age < 75; SHOW CREATE VIEW v1; -SELECT (year(now())-year(DOB)) AS Age FROM t1 HAVING Age < 75; +SELECT (year(test_date)-year(DOB)) AS Age FROM t1 HAVING Age < 75; SELECT * FROM v1; DROP VIEW v1; @@ -3415,5 +3416,45 @@ select table_name, is_updatable from information_schema.views drop view v1; drop table t1; +# +# Bug #28701: SELECTs from VIEWs completely ignore USE/FORCE KEY, allowing +# invalid statements +# + +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2); +CREATE VIEW v1 AS SELECT * FROM t1; +--error ER_WRONG_USAGE +SELECT * FROM v1 USE KEY(non_existant); +--error ER_WRONG_USAGE +SELECT * FROM v1 FORCE KEY(non_existant); +--error ER_WRONG_USAGE +SELECT * FROM v1 IGNORE KEY(non_existant); + +DROP VIEW v1; +DROP TABLE t1; + + +# +# Bug #28702: VIEWs defined with USE/FORCE KEY ignore that request +# +CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT, b INT NOT NULL DEFAULT 0, + PRIMARY KEY(a), KEY (b)); +INSERT INTO t1 VALUES (),(),(),(),(),(),(),(),(),(),(),(),(),(),(); +CREATE VIEW v1 AS SELECT * FROM t1 FORCE KEY (PRIMARY,b) ORDER BY a; +SHOW CREATE VIEW v1; +EXPLAIN SELECT * FROM v1; +CREATE VIEW v2 AS SELECT * FROM t1 USE KEY () ORDER BY a; +SHOW CREATE VIEW v2; +EXPLAIN SELECT * FROM v2; +CREATE VIEW v3 AS SELECT * FROM t1 IGNORE KEY (b) ORDER BY a; +SHOW CREATE VIEW v3; +EXPLAIN SELECT * FROM v3; + +DROP VIEW v1; +DROP VIEW v2; +DROP VIEW v3; +DROP TABLE t1; + --echo End of 5.0 tests. diff --git a/mysql-test/t/view_grant.test b/mysql-test/t/view_grant.test index a102f87c4e8..7f9eb4e1cff 100644 --- a/mysql-test/t/view_grant.test +++ b/mysql-test/t/view_grant.test @@ -1034,10 +1034,11 @@ GRANT SELECT ON db26813.t1 TO u26813@localhost; connect (u1,localhost,u26813,,db26813); connection u1; ---error 1142 +--error ER_SPECIFIC_ACCESS_DENIED_ERROR ALTER VIEW v1 AS SELECT f2 FROM t1; ---error 1142 +--error ER_SPECIFIC_ACCESS_DENIED_ERROR ALTER VIEW v2 AS SELECT f2 FROM t1; +--error ER_SPECIFIC_ACCESS_DENIED_ERROR ALTER VIEW v3 AS SELECT f2 FROM t1; connection root; @@ -1047,6 +1048,51 @@ DROP USER u26813@localhost; DROP DATABASE db26813; disconnect u1; +--echo # +--echo # Bug#29908: A user can gain additional access through the ALTER VIEW. +--echo # +connection root; +CREATE DATABASE mysqltest_29908; +USE mysqltest_29908; +CREATE TABLE t1(f1 INT, f2 INT); +CREATE USER u29908_1@localhost; +CREATE DEFINER = u29908_1@localhost VIEW v1 AS SELECT f1 FROM t1; +CREATE DEFINER = u29908_1@localhost SQL SECURITY INVOKER VIEW v2 AS + SELECT f1 FROM t1; +GRANT DROP, CREATE VIEW, SHOW VIEW ON mysqltest_29908.v1 TO u29908_1@localhost; +GRANT DROP, CREATE VIEW, SHOW VIEW ON mysqltest_29908.v2 TO u29908_1@localhost; +GRANT SELECT ON mysqltest_29908.t1 TO u29908_1@localhost; +CREATE USER u29908_2@localhost; +GRANT DROP, CREATE VIEW ON mysqltest_29908.v1 TO u29908_2@localhost; +GRANT DROP, CREATE VIEW, SHOW VIEW ON mysqltest_29908.v2 TO u29908_2@localhost; +GRANT SELECT ON mysqltest_29908.t1 TO u29908_2@localhost; + +connect (u2,localhost,u29908_2,,mysqltest_29908); +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +ALTER VIEW v1 AS SELECT f2 FROM t1; +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +ALTER VIEW v2 AS SELECT f2 FROM t1; +SHOW CREATE VIEW v2; + +connect (u1,localhost,u29908_1,,mysqltest_29908); +ALTER VIEW v1 AS SELECT f2 FROM t1; +SHOW CREATE VIEW v1; +ALTER VIEW v2 AS SELECT f2 FROM t1; +SHOW CREATE VIEW v2; + +connection root; +ALTER VIEW v1 AS SELECT f1 FROM t1; +SHOW CREATE VIEW v1; +ALTER VIEW v2 AS SELECT f1 FROM t1; +SHOW CREATE VIEW v2; + +DROP USER u29908_1@localhost; +DROP USER u29908_2@localhost; +DROP DATABASE mysqltest_29908; +disconnect u1; +disconnect u2; +--echo ####################################################################### + # # BUG#24040: Create View don't succed with "all privileges" on a database. # diff --git a/mysys/charset.c b/mysys/charset.c index 4c3f2d0ab71..d1cca150308 100644 --- a/mysys/charset.c +++ b/mysys/charset.c @@ -810,3 +810,43 @@ ulong escape_quotes_for_mysql(CHARSET_INFO *charset_info, *to= 0; return overflow ? (ulong)~0 : (ulong) (to - to_start); } + + +/** + @brief Find compatible character set with ctype. + + @param[in] original_cs Original character set + + @note + 128 my_charset_ucs2_general_uca ->192 my_charset_utf8_general_uca_ci + 129 my_charset_ucs2_icelandic_uca_ci ->193 my_charset_utf8_icelandic_uca_ci + 130 my_charset_ucs2_latvian_uca_ci ->194 my_charset_utf8_latvian_uca_ci + 131 my_charset_ucs2_romanian_uca_ci ->195 my_charset_utf8_romanian_uca_ci + 132 my_charset_ucs2_slovenian_uca_ci ->196 my_charset_utf8_slovenian_uca_ci + 133 my_charset_ucs2_polish_uca_ci ->197 my_charset_utf8_polish_uca_ci + 134 my_charset_ucs2_estonian_uca_ci ->198 my_charset_utf8_estonian_uca_ci + 135 my_charset_ucs2_spanish_uca_ci ->199 my_charset_utf8_spanish_uca_ci + 136 my_charset_ucs2_swedish_uca_ci ->200 my_charset_utf8_swedish_uca_ci + 137 my_charset_ucs2_turkish_uca_ci ->201 my_charset_utf8_turkish_uca_ci + 138 my_charset_ucs2_czech_uca_ci ->202 my_charset_utf8_czech_uca_ci + 139 my_charset_ucs2_danish_uca_ci ->203 my_charset_utf8_danish_uca_ci + 140 my_charset_ucs2_lithuanian_uca_ci->204 my_charset_utf8_lithuanian_uca_ci + 141 my_charset_ucs2_slovak_uca_ci ->205 my_charset_utf8_slovak_uca_ci + 142 my_charset_ucs2_spanish2_uca_ci ->206 my_charset_utf8_spanish2_uca_ci + 143 my_charset_ucs2_roman_uca_ci ->207 my_charset_utf8_roman_uca_ci + 144 my_charset_ucs2_persian_uca_ci ->208 my_charset_utf8_persian_uca_ci + + @return Compatible character set or NULL. +*/ + +CHARSET_INFO *get_compatible_charset_with_ctype(CHARSET_INFO *original_cs) +{ + CHARSET_INFO *compatible_cs= 0; + DBUG_ENTER("get_compatible_charset_with_ctype"); + if (!strcmp(original_cs->csname, "ucs2") && + (compatible_cs= get_charset(original_cs->number + 64, MYF(0))) && + (!compatible_cs->ctype || + strcmp(original_cs->name + 4, compatible_cs->name + 4))) + compatible_cs= 0; + DBUG_RETURN(compatible_cs); +} diff --git a/mysys/my_symlink2.c b/mysys/my_symlink2.c index e2493874097..ee0a45cf93b 100644 --- a/mysys/my_symlink2.c +++ b/mysys/my_symlink2.c @@ -126,6 +126,7 @@ int my_rename_with_symlink(const char *from, const char *to, myf MyFlags) int was_symlink= (!my_disable_symlinks && !my_readlink(link_name, from, MYF(0))); int result=0; + int name_is_different; DBUG_ENTER("my_rename_with_symlink"); if (!was_symlink) @@ -134,6 +135,14 @@ int my_rename_with_symlink(const char *from, const char *to, myf MyFlags) /* Change filename that symlink pointed to */ strmov(tmp_name, to); fn_same(tmp_name,link_name,1); /* Copy dir */ + name_is_different= strcmp(link_name, tmp_name); + if (name_is_different && !access(tmp_name, F_OK)) + { + my_errno= EEXIST; + if (MyFlags & MY_WME) + my_error(EE_CANTCREATEFILE, MYF(0), tmp_name, EEXIST); + DBUG_RETURN(1); + } /* Create new symlink */ if (my_symlink(tmp_name, to, MyFlags)) @@ -145,7 +154,7 @@ int my_rename_with_symlink(const char *from, const char *to, myf MyFlags) the same basename and different directories. */ - if (strcmp(link_name, tmp_name) && my_rename(link_name, tmp_name, MyFlags)) + if (name_is_different && my_rename(link_name, tmp_name, MyFlags)) { int save_errno=my_errno; my_delete(to, MyFlags); /* Remove created symlink */ diff --git a/ndb/include/kernel/AttributeHeader.hpp b/ndb/include/kernel/AttributeHeader.hpp index 448952a0780..1d07d8fef2d 100644 --- a/ndb/include/kernel/AttributeHeader.hpp +++ b/ndb/include/kernel/AttributeHeader.hpp @@ -41,8 +41,7 @@ public: STATIC_CONST( FRAGMENT_MEMORY= 0xFFF9 ); /** Initialize AttributeHeader at location aHeaderPtr */ - static AttributeHeader& init(void* aHeaderPtr, Uint32 anAttributeId, - Uint32 aDataSize); + static void init(Uint32* aHeaderPtr, Uint32 anAttributeId, Uint32 aDataSize); /** Returns size of AttributeHeader (usually one or two words) */ Uint32 getHeaderSize() const; // In 32-bit words @@ -100,10 +99,11 @@ public: */ inline -AttributeHeader& AttributeHeader::init(void* aHeaderPtr, Uint32 anAttributeId, - Uint32 aDataSize) +void AttributeHeader::init(Uint32* aHeaderPtr, Uint32 anAttributeId, + Uint32 aDataSize) { - return * new (aHeaderPtr) AttributeHeader(anAttributeId, aDataSize); + AttributeHeader ah(anAttributeId, aDataSize); + *aHeaderPtr = ah.m_value; } inline diff --git a/ndb/include/kernel/signaldata/ScanTab.hpp b/ndb/include/kernel/signaldata/ScanTab.hpp index 15a022e2cba..38ec4cccf7b 100644 --- a/ndb/include/kernel/signaldata/ScanTab.hpp +++ b/ndb/include/kernel/signaldata/ScanTab.hpp @@ -46,6 +46,7 @@ public: * Length of signal */ STATIC_CONST( StaticLength = 11 ); + STATIC_CONST( MaxTotalAttrInfo = 0xFFFF ); private: diff --git a/ndb/include/ndbapi/Ndb.hpp b/ndb/include/ndbapi/Ndb.hpp index dbbf11612ed..5f0da6ea83d 100644 --- a/ndb/include/ndbapi/Ndb.hpp +++ b/ndb/include/ndbapi/Ndb.hpp @@ -1052,6 +1052,7 @@ class Ndb friend class NdbDictInterface; friend class NdbBlob; friend class NdbImpl; + friend class NdbScanFilterImpl; #endif public: diff --git a/ndb/include/ndbapi/NdbScanFilter.hpp b/ndb/include/ndbapi/NdbScanFilter.hpp index 1ef62558560..02fcb6215ba 100644 --- a/ndb/include/ndbapi/NdbScanFilter.hpp +++ b/ndb/include/ndbapi/NdbScanFilter.hpp @@ -17,6 +17,7 @@ #define NDB_SCAN_FILTER_HPP #include +#include /** * @class NdbScanFilter @@ -31,8 +32,13 @@ public: /** * Constructor * @param op The NdbOperation that the filter belongs to (is applied to). + * @param abort_on_too_large abort transaction on filter too large + * default: true + * @param max_size Maximum size of generated filter in words */ - NdbScanFilter(class NdbOperation * op); + NdbScanFilter(class NdbOperation * op, + bool abort_on_too_large = true, + Uint32 max_size = NDB_MAX_SCANFILTER_SIZE_IN_WORDS); ~NdbScanFilter(); /** @@ -166,6 +172,25 @@ public: /** @} *********************************************************************/ #endif + enum Error { + FilterTooLarge = 4294 + }; + + /** + * Get filter level error. + * + * Most errors are set only on operation level, and they abort the + * transaction. The error FilterTooLarge is set on filter level and + * by default it propagates to operation level and also aborts the + * transaction. + * + * If option abort_on_too_large is set to false, then FilterTooLarge + * does not propagate. One can then either ignore this error (in + * which case no filtering is done) or try to define a new filter + * immediately. + */ + const class NdbError & getNdbError() const; + private: #ifndef DOXYGEN_SHOULD_SKIP_INTERNAL friend class NdbScanFilterImpl; diff --git a/ndb/include/ndbapi/ndbapi_limits.h b/ndb/include/ndbapi/ndbapi_limits.h index 63399e4bd0a..e283913d059 100644 --- a/ndb/include/ndbapi/ndbapi_limits.h +++ b/ndb/include/ndbapi/ndbapi_limits.h @@ -26,4 +26,6 @@ #define NDB_MAX_TUPLE_SIZE (NDB_MAX_TUPLE_SIZE_IN_WORDS*4) #define NDB_MAX_ACTIVE_EVENTS 100 +#define NDB_MAX_SCANFILTER_SIZE_IN_WORDS 50000 + #endif diff --git a/ndb/include/util/ndb_rand.h b/ndb/include/util/ndb_rand.h new file mode 100644 index 00000000000..1521ca9c4ff --- /dev/null +++ b/ndb/include/util/ndb_rand.h @@ -0,0 +1,33 @@ +/* Copyright (C) 2003 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifndef NDB_RAND_H +#define NDB_RAND_H + +#define NDB_RAND_MAX 32767 + +#ifdef __cplusplus +extern "C" { +#endif + +int ndb_rand(void); + +void ndb_srand(unsigned seed); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/ndb/src/common/util/Makefile.am b/ndb/src/common/util/Makefile.am index 4cc2e49f9ec..dc83a70990f 100644 --- a/ndb/src/common/util/Makefile.am +++ b/ndb/src/common/util/Makefile.am @@ -24,7 +24,8 @@ libgeneral_la_SOURCES = \ uucode.c random.c version.c \ strdup.c \ ConfigValues.cpp ndb_init.c basestring_vsnprintf.c \ - Bitmask.cpp + Bitmask.cpp \ + ndb_rand.c EXTRA_PROGRAMS = testBitmask testBitmask_SOURCES = testBitmask.cpp diff --git a/ndb/src/common/util/ndb_rand.c b/ndb/src/common/util/ndb_rand.c new file mode 100644 index 00000000000..4fcc483cd49 --- /dev/null +++ b/ndb/src/common/util/ndb_rand.c @@ -0,0 +1,40 @@ +/* Copyright (C) 2003 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include + +static unsigned long next= 1; + +/** + * ndb_rand + * + * constant time, cheap, pseudo-random number generator. + * + * NDB_RAND_MAX assumed to be 32767 + * + * This is the POSIX example for "generating the same sequence on + * different machines". Although that is not one of our requirements. + */ +int ndb_rand(void) +{ + next= next * 1103515245 + 12345; + return((unsigned)(next/65536) % 32768); +} + +void ndb_srand(unsigned seed) +{ + next= seed; +} + diff --git a/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp b/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp index 60024e82978..91adae183f4 100644 --- a/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp +++ b/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -6278,7 +6279,7 @@ void Dbtc::timeOutLoopStartLab(Signal* signal, Uint32 api_con_ptr) jam(); if (api_timer != 0) { Uint32 error= ZTIME_OUT_ERROR; - time_out_value= time_out_param + (api_con_ptr & mask_value); + time_out_value= time_out_param + (ndb_rand() & mask_value); if (unlikely(old_mask_value)) // abort during single user mode { apiConnectptr.i = api_con_ptr; diff --git a/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp b/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp index 28f3b987e7b..298fb183bc3 100644 --- a/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp +++ b/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp @@ -1138,7 +1138,8 @@ Dbtup::updateStartLab(Signal* signal, regOperPtr->attrinbufLen); } else { jam(); - if (interpreterStartLab(signal, pagePtr, regOperPtr->pageOffset) == -1) + retValue = interpreterStartLab(signal, pagePtr, regOperPtr->pageOffset); + if (retValue == -1) { jam(); return -1; @@ -1577,8 +1578,8 @@ int Dbtup::interpreterNextLab(Signal* signal, Uint32 TdataForUpdate[3]; Uint32 Tlen; - AttributeHeader& ah = AttributeHeader::init(&TdataForUpdate[0], - TattrId, TattrNoOfWords); + AttributeHeader ah(TattrId, TattrNoOfWords); + TdataForUpdate[0] = ah.m_value; TdataForUpdate[1] = TregMemBuffer[theRegister + 2]; TdataForUpdate[2] = TregMemBuffer[theRegister + 3]; Tlen = TattrNoOfWords + 1; @@ -1594,6 +1595,7 @@ int Dbtup::interpreterNextLab(Signal* signal, // Write a NULL value into the attribute /* --------------------------------------------------------- */ ah.setNULL(); + TdataForUpdate[0] = ah.m_value; Tlen = 1; }//if int TnoDataRW= updateAttributes(pagePtr, diff --git a/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp b/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp index ae3bb0dcd7c..d8036dc0dee 100644 --- a/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp +++ b/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp @@ -676,8 +676,6 @@ bool Dbtup::checkUpdateOfPrimaryKey(Uint32* updateBuffer, Tablerec* const regTabPtr) { Uint32 keyReadBuffer[MAX_KEY_SIZE_IN_WORDS]; - Uint32 attributeHeader; - AttributeHeader* ahOut = (AttributeHeader*)&attributeHeader; AttributeHeader ahIn(*updateBuffer); Uint32 attributeId = ahIn.getAttributeId(); Uint32 attrDescriptorIndex = regTabPtr->tabDescriptor + (attributeId << ZAD_LOG_SIZE); @@ -700,16 +698,17 @@ Dbtup::checkUpdateOfPrimaryKey(Uint32* updateBuffer, Tablerec* const regTabPtr) ReadFunction f = regTabPtr->readFunctionArray[attributeId]; - AttributeHeader::init(&attributeHeader, attributeId, 0); + AttributeHeader attributeHeader(attributeId, 0); tOutBufIndex = 0; tMaxRead = MAX_KEY_SIZE_IN_WORDS; bool tmp = tXfrmFlag; tXfrmFlag = true; - ndbrequire((this->*f)(&keyReadBuffer[0], ahOut, attrDescriptor, attributeOffset)); + ndbrequire((this->*f)(&keyReadBuffer[0], &attributeHeader, attrDescriptor, + attributeOffset)); tXfrmFlag = tmp; - ndbrequire(tOutBufIndex == ahOut->getDataSize()); - if (ahIn.getDataSize() != ahOut->getDataSize()) { + ndbrequire(tOutBufIndex == attributeHeader.getDataSize()); + if (ahIn.getDataSize() != attributeHeader.getDataSize()) { ljam(); return true; }//if diff --git a/ndb/src/kernel/blocks/dbutil/DbUtil.cpp b/ndb/src/kernel/blocks/dbutil/DbUtil.cpp index 55d36124476..3bc95d1eba8 100644 --- a/ndb/src/kernel/blocks/dbutil/DbUtil.cpp +++ b/ndb/src/kernel/blocks/dbutil/DbUtil.cpp @@ -1168,9 +1168,7 @@ DbUtil::prepareOperation(Signal* signal, PreparePtr prepPtr) /************************************************************** * Attribute found - store in mapping (AttributeId, Position) **************************************************************/ - AttributeHeader & attrMap = - AttributeHeader::init(attrMappingIt.data, - attrDesc.AttributeId, // 1. Store AttrId + AttributeHeader attrMap(attrDesc.AttributeId, // 1. Store AttrId 0); if (attrDesc.AttributeKeyFlag) { @@ -1199,6 +1197,7 @@ DbUtil::prepareOperation(Signal* signal, PreparePtr prepPtr) return; } } + *(attrMappingIt.data) = attrMap.m_value; #if 0 ndbout << "BEFORE: attrLength: " << attrLength << endl; #endif diff --git a/ndb/src/mgmsrv/MgmtSrvr.cpp b/ndb/src/mgmsrv/MgmtSrvr.cpp index 409694fead1..d68f42cbbb4 100644 --- a/ndb/src/mgmsrv/MgmtSrvr.cpp +++ b/ndb/src/mgmsrv/MgmtSrvr.cpp @@ -227,10 +227,10 @@ MgmtSrvr::startEventLog() } } -void -MgmtSrvr::stopEventLog() +void +MgmtSrvr::stopEventLog() { - // Nothing yet + g_eventLogger.close(); } class ErrorItem diff --git a/ndb/src/ndbapi/NdbOperationDefine.cpp b/ndb/src/ndbapi/NdbOperationDefine.cpp index 95e90609f9b..aaaf64b2986 100644 --- a/ndb/src/ndbapi/NdbOperationDefine.cpp +++ b/ndb/src/ndbapi/NdbOperationDefine.cpp @@ -392,9 +392,8 @@ NdbOperation::getValue_impl(const NdbColumnImpl* tAttrInfo, char* aValue) return NULL; }//if }//if - Uint32 ah; - AttributeHeader::init(&ah, tAttrInfo->m_attrId, 0); - if (insertATTRINFO(ah) != -1) { + AttributeHeader ah(tAttrInfo->m_attrId, 0); + if (insertATTRINFO(ah.m_value) != -1) { // Insert Attribute Id into ATTRINFO part. /************************************************************************ @@ -525,12 +524,11 @@ NdbOperation::setValue( const NdbColumnImpl* tAttrInfo, tAttrId = tAttrInfo->m_attrId; const char *aValue = aValuePassed; - Uint32 ahValue; if (aValue == NULL) { if (tAttrInfo->m_nullable) { - AttributeHeader& ah = AttributeHeader::init(&ahValue, tAttrId, 0); + AttributeHeader ah(tAttrId, 0); ah.setNULL(); - insertATTRINFO(ahValue); + insertATTRINFO(ah.m_value); // Insert Attribute Id with the value // NULL into ATTRINFO part. DBUG_RETURN(0); @@ -563,8 +561,8 @@ NdbOperation::setValue( const NdbColumnImpl* tAttrInfo, }//if const Uint32 totalSizeInWords = (sizeInBytes + 3)/4; // Including bits in last word const Uint32 sizeInWords = sizeInBytes / 4; // Excluding bits in last word - (void) AttributeHeader::init(&ahValue, tAttrId, totalSizeInWords); - insertATTRINFO( ahValue ); + AttributeHeader ah(tAttrId, totalSizeInWords); + insertATTRINFO( ah.m_value ); /*********************************************************************** * Check if the pointer of the value passed is aligned on a 4 byte boundary. diff --git a/ndb/src/ndbapi/NdbScanFilter.cpp b/ndb/src/ndbapi/NdbScanFilter.cpp index fb47772fdea..58e9f180119 100644 --- a/ndb/src/ndbapi/NdbScanFilter.cpp +++ b/ndb/src/ndbapi/NdbScanFilter.cpp @@ -14,11 +14,15 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include +#include #include #include "NdbDictionaryImpl.hpp" #include #include #include +#include +#include "NdbApiSignal.hpp" +#include "NdbUtil.hpp" #ifdef VM_TRACE #include @@ -52,14 +56,37 @@ public: int cond_col_const(Interpreter::BinaryCondition, Uint32 attrId, const void * value, Uint32 len); + + bool m_abort_on_too_large; + + NdbOperation::OperationStatus m_initial_op_status; + Uint32 m_initial_AI_size; + Uint32 m_max_size; + + Uint32 get_size() { + assert(m_operation->theTotalCurrAI_Len >= m_initial_AI_size); + return m_operation->theTotalCurrAI_Len - m_initial_AI_size; + } + bool check_size() { + if (get_size() <= m_max_size) + return true; + handle_filter_too_large(); + return false; + } + void handle_filter_too_large(); + + NdbError m_error; }; const Uint32 LabelExit = ~0; -NdbScanFilter::NdbScanFilter(class NdbOperation * op) +NdbScanFilter::NdbScanFilter(class NdbOperation * op, + bool abort_on_too_large, + Uint32 max_size) : m_impl(* new NdbScanFilterImpl()) { + DBUG_ENTER("NdbScanFilter::NdbScanFilter"); m_impl.m_current.m_group = (NdbScanFilter::Group)0; m_impl.m_current.m_popCount = 0; m_impl.m_current.m_ownLabel = 0; @@ -69,6 +96,21 @@ NdbScanFilter::NdbScanFilter(class NdbOperation * op) m_impl.m_latestAttrib = ~0; m_impl.m_operation = op; m_impl.m_negative = 0; + + DBUG_PRINT("info", ("op status: %d tot AI: %u in curr: %u", + op->theStatus, + op->theTotalCurrAI_Len, op->theAI_LenInCurrAI)); + + m_impl.m_abort_on_too_large = abort_on_too_large; + + m_impl.m_initial_op_status = op->theStatus; + m_impl.m_initial_AI_size = op->theTotalCurrAI_Len; + if (max_size > NDB_MAX_SCANFILTER_SIZE_IN_WORDS) + max_size = NDB_MAX_SCANFILTER_SIZE_IN_WORDS; + m_impl.m_max_size = max_size; + + m_impl.m_error.code = 0; + DBUG_VOID_RETURN; } NdbScanFilter::~NdbScanFilter(){ @@ -200,30 +242,38 @@ NdbScanFilter::end(){ switch(tmp.m_group){ case NdbScanFilter::AND: if(tmp.m_trueLabel == (Uint32)~0){ - m_impl.m_operation->interpret_exit_ok(); + if (m_impl.m_operation->interpret_exit_ok() == -1) + return -1; } else { - m_impl.m_operation->branch_label(tmp.m_trueLabel); + if (m_impl.m_operation->branch_label(tmp.m_trueLabel) == -1) + return -1; } break; case NdbScanFilter::NAND: if(tmp.m_trueLabel == (Uint32)~0){ - m_impl.m_operation->interpret_exit_nok(); + if (m_impl.m_operation->interpret_exit_nok() == -1) + return -1; } else { - m_impl.m_operation->branch_label(tmp.m_falseLabel); + if (m_impl.m_operation->branch_label(tmp.m_falseLabel) == -1) + return -1; } break; case NdbScanFilter::OR: if(tmp.m_falseLabel == (Uint32)~0){ - m_impl.m_operation->interpret_exit_nok(); + if (m_impl.m_operation->interpret_exit_nok() == -1) + return -1; } else { - m_impl.m_operation->branch_label(tmp.m_falseLabel); + if (m_impl.m_operation->branch_label(tmp.m_falseLabel) == -1) + return -1; } break; case NdbScanFilter::NOR: if(tmp.m_falseLabel == (Uint32)~0){ - m_impl.m_operation->interpret_exit_ok(); + if (m_impl.m_operation->interpret_exit_ok() == -1) + return -1; } else { - m_impl.m_operation->branch_label(tmp.m_trueLabel); + if (m_impl.m_operation->branch_label(tmp.m_trueLabel) == -1) + return -1; } break; default: @@ -231,24 +281,29 @@ NdbScanFilter::end(){ return -1; } - m_impl.m_operation->def_label(tmp.m_ownLabel); + if (m_impl.m_operation->def_label(tmp.m_ownLabel) == -1) + return -1; if(m_impl.m_stack.size() == 0){ switch(tmp.m_group){ case NdbScanFilter::AND: case NdbScanFilter::NOR: - m_impl.m_operation->interpret_exit_nok(); + if (m_impl.m_operation->interpret_exit_nok() == -1) + return -1; break; case NdbScanFilter::OR: case NdbScanFilter::NAND: - m_impl.m_operation->interpret_exit_ok(); + if (m_impl.m_operation->interpret_exit_ok() == -1) + return -1; break; default: m_impl.m_operation->setErrorCodeAbort(4260); return -1; } } - + + if (!m_impl.check_size()) + return -1; return 0; } @@ -261,10 +316,16 @@ NdbScanFilter::istrue(){ } if(m_impl.m_current.m_trueLabel == (Uint32)~0){ - return m_impl.m_operation->interpret_exit_ok(); + if (m_impl.m_operation->interpret_exit_ok() == -1) + return -1; } else { - return m_impl.m_operation->branch_label(m_impl.m_current.m_trueLabel); + if (m_impl.m_operation->branch_label(m_impl.m_current.m_trueLabel) == -1) + return -1; } + + if (!m_impl.check_size()) + return -1; + return 0; } int @@ -276,10 +337,16 @@ NdbScanFilter::isfalse(){ } if(m_impl.m_current.m_falseLabel == (Uint32)~0){ - return m_impl.m_operation->interpret_exit_nok(); + if (m_impl.m_operation->interpret_exit_nok() == -1) + return -1; } else { - return m_impl.m_operation->branch_label(m_impl.m_current.m_falseLabel); + if (m_impl.m_operation->branch_label(m_impl.m_current.m_falseLabel) == -1) + return -1; } + + if (!m_impl.check_size()) + return -1; + return 0; } @@ -330,7 +397,11 @@ NdbScanFilterImpl::cond_col(Interpreter::UnaryCondition op, Uint32 AttrId){ } Branch1 branch = table2[op].m_branches[m_current.m_group]; - (m_operation->* branch)(AttrId, m_current.m_ownLabel); + if ((m_operation->* branch)(AttrId, m_current.m_ownLabel) == -1) + return -1; + + if (!check_size()) + return -1; return 0; } @@ -463,8 +534,12 @@ NdbScanFilterImpl::cond_col_const(Interpreter::BinaryCondition op, return -1; } - int ret = (m_operation->* branch)(AttrId, value, len, false, m_current.m_ownLabel); - return ret; + if ((m_operation->* branch)(AttrId, value, len, false, m_current.m_ownLabel) == -1) + return -1; + + if (!check_size()) + return -1; + return 0; } int @@ -490,7 +565,130 @@ NdbScanFilter::cmp(BinaryCondition cond, int ColId, return m_impl.cond_col_const(Interpreter::NOT_LIKE, ColId, val, len); } return -1; -} +} + +void +NdbScanFilterImpl::handle_filter_too_large() +{ + DBUG_ENTER("NdbScanFilterImpl::handle_filter_too_large"); + + NdbOperation* const op = m_operation; + m_error.code = NdbScanFilter::FilterTooLarge; + if (m_abort_on_too_large) + op->setErrorCodeAbort(m_error.code); + + /* + * Possible interpreted parts at this point are: + * + * 1. initial read + * 2. interpreted program + * + * It is assumed that NdbScanFilter has created all of 2 + * so that we don't have to save interpreter state. + */ + + const Uint32 size = get_size(); + assert(size != 0); + + // new ATTRINFO size + const Uint32 new_size = m_initial_AI_size; + + // find last signal for new size + assert(op->theFirstATTRINFO != NULL); + NdbApiSignal* lastSignal = op->theFirstATTRINFO; + Uint32 n = 0; + while (n + AttrInfo::DataLength < new_size) { + lastSignal = lastSignal->next(); + assert(lastSignal != NULL); + n += AttrInfo::DataLength; + } + assert(n < size); + + // release remaining signals + NdbApiSignal* tSignal = lastSignal->next(); + op->theNdb->releaseSignalsInList(&tSignal); + lastSignal->next(NULL); + + // length of lastSignal + const Uint32 new_curr = AttrInfo::HeaderLength + new_size - n; + assert(new_curr <= 25); + + DBUG_PRINT("info", ("op status: %d->%d tot AI: %u->%u in curr: %u->%u", + op->theStatus, m_initial_op_status, + op->theTotalCurrAI_Len, new_size, + op->theAI_LenInCurrAI, new_curr)); + + // reset op state + op->theStatus = m_initial_op_status; + + // reset interpreter state to initial + + NdbBranch* tBranch = op->theFirstBranch; + while (tBranch != NULL) { + NdbBranch* tmp = tBranch; + tBranch = tBranch->theNext; + op->theNdb->releaseNdbBranch(tmp); + } + op->theFirstBranch = NULL; + op->theLastBranch = NULL; + + NdbLabel* tLabel = op->theFirstLabel; + while (tLabel != NULL) { + NdbLabel* tmp = tLabel; + tLabel = tLabel->theNext; + op->theNdb->releaseNdbLabel(tmp); + } + op->theFirstLabel = NULL; + op->theLastLabel = NULL; + + NdbCall* tCall = op->theFirstCall; + while (tCall != NULL) { + NdbCall* tmp = tCall; + tCall = tCall->theNext; + op->theNdb->releaseNdbCall(tmp); + } + op->theFirstCall = NULL; + op->theLastCall = NULL; + + NdbSubroutine* tSubroutine = op->theFirstSubroutine; + while (tSubroutine != NULL) { + NdbSubroutine* tmp = tSubroutine; + tSubroutine = tSubroutine->theNext; + op->theNdb->releaseNdbSubroutine(tmp); + } + op->theFirstSubroutine = NULL; + op->theLastSubroutine = NULL; + + op->theNoOfLabels = 0; + op->theNoOfSubroutines = 0; + + // reset AI size + op->theTotalCurrAI_Len = new_size; + op->theAI_LenInCurrAI = new_curr; + + // reset signal pointers + op->theCurrentATTRINFO = lastSignal; + op->theATTRINFOptr = &lastSignal->getDataPtrSend()[new_curr]; + + // interpreter sizes are set later somewhere + + DBUG_VOID_RETURN; +} + +static void +update(const NdbError & _err){ + NdbError & error = (NdbError &) _err; + ndberror_struct ndberror = (ndberror_struct)error; + ndberror_update(&ndberror); + error = NdbError(ndberror); +} + +const NdbError & +NdbScanFilter::getNdbError() const +{ + update(m_impl.m_error); + return m_impl.m_error; +} #if 0 diff --git a/ndb/src/ndbapi/NdbScanOperation.cpp b/ndb/src/ndbapi/NdbScanOperation.cpp index aec98a7f5d5..9176fb47297 100644 --- a/ndb/src/ndbapi/NdbScanOperation.cpp +++ b/ndb/src/ndbapi/NdbScanOperation.cpp @@ -849,6 +849,10 @@ NdbScanOperation::doSendScan(int aProcessorId) // sending it. This could not be done in openScan because // we created the ATTRINFO signals after the SCAN_TABREQ signal. ScanTabReq * const req = CAST_PTR(ScanTabReq, tSignal->getDataPtrSend()); + if (unlikely(theTotalCurrAI_Len > ScanTabReq::MaxTotalAttrInfo)) { + setErrorCode(4257); + return -1; + } req->attrLenKeyLen = (tupKeyLen << 16) | theTotalCurrAI_Len; Uint32 tmp = req->requestInfo; ScanTabReq::setDistributionKeyFlag(tmp, theDistrKeyIndicator_); diff --git a/ndb/src/ndbapi/ndberror.c b/ndb/src/ndbapi/ndberror.c index 24ccb1d07c2..56eb2c0f8bd 100644 --- a/ndb/src/ndbapi/ndberror.c +++ b/ndb/src/ndbapi/ndberror.c @@ -527,7 +527,8 @@ ErrorBundle ErrorCodes[] = { { 4270, IE, "Unknown blob error" }, { 4335, AE, "Only one autoincrement column allowed per table. Having a table without primary key uses an autoincremented hidden key, i.e. a table without a primary key can not have an autoincremented column" }, { 4271, AE, "Invalid index object, not retrieved via getIndex()" }, - { 4275, AE, "The blob method is incompatible with operation type or lock mode" } + { 4275, AE, "The blob method is incompatible with operation type or lock mode" }, + { 4294, AE, "Scan filter is too large, discarded" } }; static diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 182076b32b6..5db5fdd550f 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -149,13 +149,19 @@ SUFFIXES = .sh -e 's!@''CC''@!@CC@!'\ -e 's!@''CXX''@!@CXX@!'\ -e 's!@''GXX''@!@GXX@!'\ + -e 's!@''SAVE_CC''@!@SAVE_CC@!'\ + -e 's!@''SAVE_CXX''@!@SAVE_CXX@!'\ -e 's!@''CC_VERSION''@!@CC_VERSION@!'\ -e 's!@''CXX_VERSION''@!@CXX_VERSION@!'\ -e 's!@''PERL''@!@PERL@!' \ - -e 's!@''ASFLAGS''@!@SAVE_ASFLAGS@!'\ - -e 's!@''CFLAGS''@!@SAVE_CFLAGS@!'\ - -e 's!@''CXXFLAGS''@!@SAVE_CXXFLAGS@!'\ - -e 's!@''LDFLAGS''@!@SAVE_LDFLAGS@!'\ + -e 's!@''SAVE_ASFLAGS''@!@SAVE_ASFLAGS@!'\ + -e 's!@''SAVE_CFLAGS''@!@SAVE_CFLAGS@!'\ + -e 's!@''SAVE_CXXFLAGS''@!@SAVE_CXXFLAGS@!'\ + -e 's!@''SAVE_LDFLAGS''@!@SAVE_LDFLAGS@!'\ + -e 's!@''ASFLAGS''@!@ASFLAGS@!'\ + -e 's!@''CFLAGS''@!@CFLAGS@!'\ + -e 's!@''CXXFLAGS''@!@CXXFLAGS@!'\ + -e 's!@''LDFLAGS''@!@LDFLAGS@!'\ -e 's!@''CLIENT_LIBS''@!@CLIENT_LIBS@!' \ -e 's!@''ZLIB_LIBS''@!@ZLIB_LIBS@!' \ -e 's!@''LIBS''@!@LIBS@!' \ diff --git a/scripts/mysqlbug.sh b/scripts/mysqlbug.sh index 69ea82e8794..64804b5de19 100644 --- a/scripts/mysqlbug.sh +++ b/scripts/mysqlbug.sh @@ -23,7 +23,8 @@ VERSION="@VERSION@@MYSQL_SERVER_SUFFIX@" COMPILATION_COMMENT="@COMPILATION_COMMENT@" BUGmysql="mysql@lists.mysql.com" # This is set by configure -COMP_ENV_INFO="CC='@CC@' CFLAGS='@CFLAGS@' CXX='@CXX@' CXXFLAGS='@CXXFLAGS@' LDFLAGS='@LDFLAGS@' ASFLAGS='@ASFLAGS@'" +COMP_CALL_INFO="CC='@SAVE_CC@' CFLAGS='@SAVE_CFLAGS@' CXX='@SAVE_CXX@' CXXFLAGS='@SAVE_CXXFLAGS@' LDFLAGS='@SAVE_LDFLAGS@' ASFLAGS='@SAVE_ASFLAGS@'" +COMP_RUN_INFO="CC='@CC@' CFLAGS='@CFLAGS@' CXX='@CXX@' CXXFLAGS='@CXXFLAGS@' LDFLAGS='@LDFLAGS@' ASFLAGS='@ASFLAGS@'" CONFIGURE_LINE="@CONF_COMMAND@" LIBC_INFO="" @@ -261,7 +262,8 @@ ${ORGANIZATION- $ORGANIZATION_C} `test -n "$MACHINE" && echo "Machine: $MACHINE"` `test -n "$FILE_PATHS" && echo "Some paths: $FILE_PATHS"` `test -n "$GCC_INFO" && echo "GCC: $GCC_INFO"` -`test -n "$COMP_ENV_INFO" && echo "Compilation info: $COMP_ENV_INFO"` +`test -n "$COMP_CALL_INFO" && echo "Compilation info (call): $COMP_CALL_INFO"` +`test -n "$COMP_RUN_INFO" && echo "Compilation info (used): $COMP_RUN_INFO"` `test -n "$LIBC_INFO" && echo "LIBC: $LIBC_INFO"` `test -n "$CONFIGURE_LINE" && echo "Configure command: $CONFIGURE_LINE"` `test -n "$PERL_INFO" && echo "Perl: $PERL_INFO"` diff --git a/sql-common/my_time.c b/sql-common/my_time.c index 3c08db6bf97..453c7b73008 100644 --- a/sql-common/my_time.c +++ b/sql-common/my_time.c @@ -54,24 +54,24 @@ uint calc_days_in_year(uint year) 366 : 365); } -/* - Check datetime value for validity according to flags. +/** + @brief Check datetime value for validity according to flags. - SYNOPSIS - check_date() - ltime Date to check. - not_zero_date ltime is not the zero date - flags flags to check - was_cut set to 2 if value was truncated. - NOTE: This is not touched if value was not truncated - NOTES - Here we assume that year and month is ok ! + @param[in] ltime Date to check. + @param[in] not_zero_date ltime is not the zero date + @param[in] flags flags to check + (see str_to_datetime() flags in my_time.h) + @param[out] was_cut set to 2 if value was invalid according to flags. + (Feb 29 in non-leap etc.) This remains unchanged + if value is not invalid. + + @details Here we assume that year and month is ok! If month is 0 we allow any date. (This only happens if we allow zero date parts in str_to_datetime()) Disallow dates with zero year and non-zero month and/or day. - RETURN - 0 ok + @return + 0 OK 1 error */ @@ -117,9 +117,9 @@ my_bool check_date(const MYSQL_TIME *ltime, my_bool not_zero_date, TIME_NO_ZERO_IN_DATE Don't allow partial dates TIME_NO_ZERO_DATE Don't allow 0000-00-00 date TIME_INVALID_DATES Allow 2000-02-31 - was_cut 0 Value ok + was_cut 0 Value OK 1 If value was cut during conversion - 2 Date part was within ranges but date was wrong + 2 check_date(date,flags) considers date invalid DESCRIPTION At least the following formats are recogniced (based on number of digits) @@ -1087,7 +1087,7 @@ int my_TIME_to_str(const MYSQL_TIME *l_time, char *to) flags - flags to use in validating date, as in str_to_datetime() was_cut 0 Value ok 1 If value was cut during conversion - 2 Date part was within ranges but date was wrong + 2 check_date(date,flags) considers date invalid DESCRIPTION Convert a datetime value of formats YYMMDD, YYYYMMDD, YYMMDDHHMSS, diff --git a/sql/field.cc b/sql/field.cc index 8191d885a27..86853389c64 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -1356,15 +1356,25 @@ void Field_num::add_zerofill_and_unsigned(String &res) const void Field::make_field(Send_field *field) { - if (orig_table->s->table_cache_key && *(orig_table->s->table_cache_key)) + if (orig_table && orig_table->s->table_cache_key && + *(orig_table->s->table_cache_key)) { field->org_table_name= orig_table->s->table_name; field->db_name= orig_table->s->table_cache_key; } else field->org_table_name= field->db_name= ""; - field->table_name= orig_table->alias; - field->col_name= field->org_col_name= field_name; + if (orig_table) + { + field->table_name= orig_table->alias; + field->org_col_name= field_name; + } + else + { + field->table_name= ""; + field->org_col_name= ""; + } + field->col_name= field_name; field->charsetnr= charset()->number; field->length=field_length; field->type=type(); @@ -5272,7 +5282,7 @@ int Field_newdate::store(const char *from,uint len,CHARSET_INFO *cs) { tmp= l_time.day + l_time.month*32 + l_time.year*16*32; if (!error && (ret != MYSQL_TIMESTAMP_DATE) && - thd->count_cuted_fields != CHECK_FIELD_IGNORE) + (l_time.hour || l_time.minute || l_time.second || l_time.second_part)) error= 3; // Datetime was cut (note) } @@ -5319,10 +5329,16 @@ int Field_newdate::store(longlong nr, bool unsigned_val) else tmp= l_time.day + l_time.month*32 + l_time.year*16*32; + if (!error && l_time.time_type != MYSQL_TIMESTAMP_DATE && + (l_time.hour || l_time.minute || l_time.second || l_time.second_part)) + error= 3; + if (error) - set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN, - error == 2 ? ER_WARN_DATA_OUT_OF_RANGE : - WARN_DATA_TRUNCATED,nr,MYSQL_TIMESTAMP_DATE, 1); + set_datetime_warning(error == 3 ? MYSQL_ERROR::WARN_LEVEL_NOTE : + MYSQL_ERROR::WARN_LEVEL_WARN, + error == 2 ? + ER_WARN_DATA_OUT_OF_RANGE : WARN_DATA_TRUNCATED, + nr,MYSQL_TIMESTAMP_DATE, 1); int3store(ptr,tmp); return error; @@ -5349,6 +5365,17 @@ int Field_newdate::store_time(MYSQL_TIME *ltime, timestamp_type time_type) set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, str.ptr(), str.length(), MYSQL_TIMESTAMP_DATE, 1); } + if (!error && ltime->time_type != MYSQL_TIMESTAMP_DATE && + (ltime->hour || ltime->minute || ltime->second || ltime->second_part)) + { + char buff[MAX_DATE_STRING_REP_LENGTH]; + String str(buff, sizeof(buff), &my_charset_latin1); + make_datetime((DATE_TIME_FORMAT *) 0, ltime, &str); + set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_NOTE, + WARN_DATA_TRUNCATED, + str.ptr(), str.length(), MYSQL_TIMESTAMP_DATE, 1); + error= 3; + } } else { @@ -7406,36 +7433,6 @@ uint Field_blob::max_packed_col_length(uint max_length) #ifdef HAVE_SPATIAL -uint Field_geom::get_key_image(char *buff, uint length, imagetype type) -{ - char *blob; - const char *dummy; - MBR mbr; - ulong blob_length= get_length(ptr); - Geometry_buffer buffer; - Geometry *gobj; - const uint image_length= SIZEOF_STORED_DOUBLE*4; - - if (blob_length < SRID_SIZE) - { - bzero(buff, image_length); - return image_length; - } - get_ptr(&blob); - gobj= Geometry::construct(&buffer, blob, blob_length); - if (!gobj || gobj->get_mbr(&mbr, &dummy)) - bzero(buff, image_length); - else - { - float8store(buff, mbr.xmin); - float8store(buff + 8, mbr.xmax); - float8store(buff + 16, mbr.ymin); - float8store(buff + 24, mbr.ymax); - } - return image_length; -} - - void Field_geom::sql_type(String &res) const { CHARSET_INFO *cs= &my_charset_latin1; diff --git a/sql/field.h b/sql/field.h index 4fcdb50f8c7..8c01931fa21 100644 --- a/sql/field.h +++ b/sql/field.h @@ -1326,7 +1326,6 @@ public: int store(double nr); int store(longlong nr, bool unsigned_val); int store_decimal(const my_decimal *); - uint get_key_image(char *buff,uint length,imagetype type); uint size_of() const { return sizeof(*this); } int reset(void) { return !maybe_null() || Field_blob::reset(); } geometry_type get_geometry_type() { return geom_type; }; diff --git a/sql/filesort.cc b/sql/filesort.cc index db73ede99b0..08ffa2211fa 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -534,7 +534,7 @@ static ha_rows find_all_keys(SORTPARAM *param, SQL_SELECT *select, file->unlock_row(); /* It does not make sense to read more keys in case of a fatal error */ if (thd->net.report_error) - DBUG_RETURN(HA_POS_ERROR); + break; } if (quick_select) { @@ -551,6 +551,9 @@ static ha_rows find_all_keys(SORTPARAM *param, SQL_SELECT *select, file->ha_rnd_end(); } + if (thd->net.report_error) + DBUG_RETURN(HA_POS_ERROR); + DBUG_PRINT("test",("error: %d indexpos: %d",error,indexpos)); if (error != HA_ERR_END_OF_FILE) { diff --git a/sql/gstream.cc b/sql/gstream.cc index 46e12b6ef3b..0c8011549f3 100644 --- a/sql/gstream.cc +++ b/sql/gstream.cc @@ -44,7 +44,7 @@ bool Gis_read_stream::get_next_word(LEX_STRING *res) skip_space(); res->str= (char*) m_cur; /* The following will also test for \0 */ - if (!my_isvar_start(&my_charset_bin, *m_cur)) + if ((m_cur >= m_limit) || !my_isvar_start(&my_charset_bin, *m_cur)) return 1; /* diff --git a/sql/ha_federated.cc b/sql/ha_federated.cc index d8ffd6c55f8..d7f2309657b 100644 --- a/sql/ha_federated.cc +++ b/sql/ha_federated.cc @@ -2528,7 +2528,12 @@ int ha_federated::info(uint flag) status_query_string.length(0); result= mysql_store_result(mysql); - if (!result) + + /* + We're going to use fields num. 4, 12 and 13 of the resultset, + so make sure we have these fields. + */ + if (!result || (mysql_num_fields(result) < 14)) goto error; if (!mysql_num_rows(result)) @@ -2557,9 +2562,9 @@ int ha_federated::info(uint flag) data_file_length= records * mean_rec_length; if (row[12] != NULL) - update_time= (ha_rows) my_strtoll10(row[12], (char**) 0, &error); + update_time= (time_t) my_strtoll10(row[12], (char**) 0, &error); if (row[13] != NULL) - check_time= (ha_rows) my_strtoll10(row[13], (char**) 0, &error); + check_time= (time_t) my_strtoll10(row[13], (char**) 0, &error); } /* diff --git a/sql/ha_heap.cc b/sql/ha_heap.cc index bf807407df1..4b96e5b5744 100644 --- a/sql/ha_heap.cc +++ b/sql/ha_heap.cc @@ -175,7 +175,7 @@ void ha_heap::update_key_stats() else { ha_rows hash_buckets= file->s->keydef[i].hash_buckets; - uint no_records= hash_buckets ? file->s->records/hash_buckets : 2; + uint no_records= hash_buckets ? (uint) (file->s->records/hash_buckets) : 2; if (no_records < 2) no_records= 2; key->rec_per_key[key->key_parts-1]= no_records; diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index 86d3e930122..6b5e89848c3 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -5477,7 +5477,7 @@ ha_innobase::info( table->key_info[i].rec_per_key[j]= rec_per_key >= ~(ulong) 0 ? ~(ulong) 0 : - rec_per_key; + (ulong) rec_per_key; } index = dict_table_get_next_index_noninline(index); diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc index 66f66dccd99..a24486385fd 100644 --- a/sql/ha_myisam.cc +++ b/sql/ha_myisam.cc @@ -1412,7 +1412,7 @@ void ha_myisam::start_bulk_insert(ha_rows rows) DBUG_ENTER("ha_myisam::start_bulk_insert"); THD *thd= current_thd; ulong size= min(thd->variables.read_buff_size, - table->s->avg_row_length*rows); + (ulong) (table->s->avg_row_length*rows)); DBUG_PRINT("info",("start_bulk_insert: rows %lu size %lu", (ulong) rows, size)); diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index 05e35bd0157..d2c580a61de 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -1356,6 +1356,30 @@ int ha_ndbcluster::set_primary_key_from_record(NdbOperation *op, const byte *rec DBUG_RETURN(0); } +bool ha_ndbcluster::check_index_fields_in_write_set(uint keyno) +{ + KEY* key_info= table->key_info + keyno; + KEY_PART_INFO* key_part= key_info->key_part; + KEY_PART_INFO* end= key_part+key_info->key_parts; + uint i; + DBUG_ENTER("check_index_fields_in_write_set"); + + if (m_retrieve_all_fields) + { + DBUG_RETURN(true); + } + for (i= 0; key_part != end; key_part++, i++) + { + Field* field= key_part->field; + if (field->query_id != current_thd->query_id) + { + DBUG_RETURN(false); + } + } + + DBUG_RETURN(true); +} + int ha_ndbcluster::set_index_key_from_record(NdbOperation *op, const byte *record, uint keyno) { KEY* key_info= table->key_info + keyno; @@ -1643,7 +1667,8 @@ check_null_in_record(const KEY* key_info, const byte *record) * primary key or unique index values */ -int ha_ndbcluster::peek_indexed_rows(const byte *record, bool check_pk) +int ha_ndbcluster::peek_indexed_rows(const byte *record, + NDB_WRITE_OP write_op) { NdbTransaction *trans= m_active_trans; NdbOperation *op; @@ -1656,7 +1681,7 @@ int ha_ndbcluster::peek_indexed_rows(const byte *record, bool check_pk) (NdbOperation::LockMode)get_ndb_lock_type(m_lock.type); first= NULL; - if (check_pk && table->s->primary_key != MAX_KEY) + if (write_op != NDB_UPDATE && table->s->primary_key != MAX_KEY) { /* * Fetch any row with colliding primary key @@ -1687,9 +1712,15 @@ int ha_ndbcluster::peek_indexed_rows(const byte *record, bool check_pk) */ if (check_null_in_record(key_info, record)) { - DBUG_PRINT("info", ("skipping check for key with NULL")); + DBUG_PRINT("info", ("skipping check for key with NULL")); continue; } + if (write_op != NDB_INSERT && !check_index_fields_in_write_set(i)) + { + DBUG_PRINT("info", ("skipping check for key %u not in write_set", i)); + continue; + } + NdbIndexOperation *iop; NDBINDEX *unique_index = (NDBINDEX *) m_index[i].unique_index; key_part= key_info->key_part; @@ -2268,7 +2299,7 @@ int ha_ndbcluster::write_row(byte *record) start_bulk_insert will set parameters to ensure that each write_row is committed individually */ - int peek_res= peek_indexed_rows(record, true); + int peek_res= peek_indexed_rows(record, NDB_INSERT); if (!peek_res) { @@ -2302,7 +2333,7 @@ int ha_ndbcluster::write_row(byte *record) auto_value, 1) == -1) { if (--retries && - ndb->getNdbError().status == NdbError::TemporaryError); + ndb->getNdbError().status == NdbError::TemporaryError) { my_sleep(retry_sleep); continue; @@ -2456,7 +2487,8 @@ int ha_ndbcluster::update_row(const byte *old_data, byte *new_data) if (m_ignore_dup_key && (thd->lex->sql_command == SQLCOM_UPDATE || thd->lex->sql_command == SQLCOM_UPDATE_MULTI)) { - int peek_res= peek_indexed_rows(new_data, pk_update); + NDB_WRITE_OP write_op= (pk_update) ? NDB_PK_UPDATE : NDB_UPDATE; + int peek_res= peek_indexed_rows(new_data, write_op); if (!peek_res) { @@ -4862,7 +4894,7 @@ ulonglong ha_ndbcluster::get_auto_increment() auto_value, cache_size, step, start)) { if (--retries && - ndb->getNdbError().status == NdbError::TemporaryError); + ndb->getNdbError().status == NdbError::TemporaryError) { my_sleep(retry_sleep); continue; diff --git a/sql/ha_ndbcluster.h b/sql/ha_ndbcluster.h index 81cbdcd8fea..324969ad374 100644 --- a/sql/ha_ndbcluster.h +++ b/sql/ha_ndbcluster.h @@ -59,6 +59,12 @@ typedef struct ndb_index_data { bool null_in_unique_index; } NDB_INDEX_DATA; +typedef enum ndb_write_op { + NDB_INSERT = 0, + NDB_UPDATE = 1, + NDB_PK_UPDATE = 2 +} NDB_WRITE_OP; + typedef struct st_ndbcluster_share { THR_LOCK lock; pthread_mutex_t mutex; @@ -251,7 +257,7 @@ private: const NdbOperation *first, const NdbOperation *last, uint errcode); - int peek_indexed_rows(const byte *record, bool check_pk); + int peek_indexed_rows(const byte *record, NDB_WRITE_OP write_op); int unique_index_read(const byte *key, uint key_len, byte *buf); int ordered_index_scan(const key_range *start_key, @@ -286,6 +292,7 @@ private: int get_ndb_blobs_value(NdbBlob *last_ndb_blob, my_ptrdiff_t ptrdiff); int set_primary_key(NdbOperation *op, const byte *key); int set_primary_key_from_record(NdbOperation *op, const byte *record); + bool check_index_fields_in_write_set(uint keyno); int set_index_key_from_record(NdbOperation *op, const byte *record, uint keyno); int set_bounds(NdbIndexScanOperation*, const key_range *keys[2], uint= 0); diff --git a/sql/ha_ndbcluster_cond.cc b/sql/ha_ndbcluster_cond.cc index ea3f8a7683a..c7b185a92f0 100644 --- a/sql/ha_ndbcluster_cond.cc +++ b/sql/ha_ndbcluster_cond.cc @@ -1338,9 +1338,23 @@ ha_ndbcluster_cond::generate_scan_filter(NdbScanOperation *op) if (m_cond_stack) { - NdbScanFilter filter(op); + NdbScanFilter filter(op, false); // don't abort on too large - DBUG_RETURN(generate_scan_filter_from_cond(filter)); + int ret=generate_scan_filter_from_cond(filter); + if (ret != 0) + { + const NdbError& err=filter.getNdbError(); + if (err.code == NdbScanFilter::FilterTooLarge) + { + // err.message has static storage + DBUG_PRINT("info", ("%s", err.message)); + push_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, + err.code, err.message); + ret=0; + } + } + if (ret != 0) + DBUG_RETURN(ret); } else { @@ -1391,7 +1405,7 @@ int ha_ndbcluster_cond::generate_scan_filter_from_key(NdbScanOperation *op, { KEY_PART_INFO* key_part= key_info->key_part; KEY_PART_INFO* end= key_part+key_info->key_parts; - NdbScanFilter filter(op); + NdbScanFilter filter(op, true); // abort on too large int res; DBUG_ENTER("generate_scan_filter_from_key"); diff --git a/sql/item.cc b/sql/item.cc index c451fe94b29..431d82af331 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -939,9 +939,12 @@ int Item::save_in_field_no_warnings(Field *field, bool no_conversions) int res; THD *thd= field->table->in_use; enum_check_fields tmp= thd->count_cuted_fields; + ulong sql_mode= thd->variables.sql_mode; + thd->variables.sql_mode&= ~(MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE); thd->count_cuted_fields= CHECK_FIELD_IGNORE; res= save_in_field(field, no_conversions); thd->count_cuted_fields= tmp; + thd->variables.sql_mode= sql_mode; return res; } @@ -3304,7 +3307,7 @@ static Item** find_field_in_group_list(Item *find_item, ORDER *group_list) if (cur_field->table_name && table_name) { /* If field_name is qualified by a table name. */ - if (strcmp(cur_field->table_name, table_name)) + if (my_strcasecmp(table_alias_charset, cur_field->table_name, table_name)) /* Same field names, different tables. */ return NULL; @@ -4248,6 +4251,47 @@ bool Item::is_datetime() } +String *Item::check_well_formed_result(String *str, bool send_error) +{ + /* Check whether we got a well-formed string */ + CHARSET_INFO *cs= str->charset(); + int well_formed_error; + uint wlen= cs->cset->well_formed_len(cs, + str->ptr(), str->ptr() + str->length(), + str->length(), &well_formed_error); + if (wlen < str->length()) + { + THD *thd= current_thd; + char hexbuf[7]; + enum MYSQL_ERROR::enum_warning_level level; + uint diff= str->length() - wlen; + set_if_smaller(diff, 3); + octet2hex(hexbuf, str->ptr() + wlen, diff); + if (send_error) + { + my_error(ER_INVALID_CHARACTER_STRING, MYF(0), + cs->csname, hexbuf); + return 0; + } + if ((thd->variables.sql_mode & + (MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES))) + { + level= MYSQL_ERROR::WARN_LEVEL_ERROR; + null_value= 1; + str= 0; + } + else + { + level= MYSQL_ERROR::WARN_LEVEL_WARN; + str->length(wlen); + } + push_warning_printf(thd, level, ER_INVALID_CHARACTER_STRING, + ER(ER_INVALID_CHARACTER_STRING), cs->csname, hexbuf); + } + return str; +} + + /* Create a field to hold a string value from an item @@ -4366,11 +4410,8 @@ Field *Item::tmp_table_field_from_field_type(TABLE *table) break; // Blob handled outside of case #ifdef HAVE_SPATIAL case MYSQL_TYPE_GEOMETRY: - return new Field_geom(max_length, maybe_null, name, table, - (Field::geometry_type) - ((type() == Item::TYPE_HOLDER) ? - ((Item_type_holder *)this)->get_geometry_type() : - ((Item_geometry_func *)this)->get_geometry_type())); + return new Field_geom(max_length, maybe_null, + name, table, get_geometry_type()); #endif /* HAVE_SPATIAL */ } } @@ -4510,7 +4551,7 @@ int Item::save_in_field(Field *field, bool no_conversions) my_decimal decimal_value; my_decimal *value= val_decimal(&decimal_value); if (null_value) - return set_field_to_null(field); + return set_field_to_null_with_conversions(field, no_conversions); field->set_notnull(); error=field->store_decimal(value); } @@ -4772,6 +4813,19 @@ warn: } +void Item_hex_string::print(String *str) +{ + char *end= (char*) str_value.ptr() + str_value.length(), + *ptr= end - min(str_value.length(), sizeof(longlong)); + str->append("0x"); + for (; ptr != end ; ptr++) + { + str->append(_dig_vec_lower[((uchar) *ptr) >> 4]); + str->append(_dig_vec_lower[((uchar) *ptr) & 0x0F]); + } +} + + bool Item_hex_string::eq(const Item *arg, bool binary_cmp) const { if (arg->basic_const_item() && arg->type() == type()) @@ -6205,9 +6259,9 @@ bool field_is_equal_to_item(Field *field,Item *item) return result == field->val_real(); } -Item_cache* Item_cache::get_cache(Item_result type) +Item_cache* Item_cache::get_cache(const Item *item) { - switch (type) { + switch (item->result_type()) { case INT_RESULT: return new Item_cache_int(); case REAL_RESULT: @@ -6215,7 +6269,7 @@ Item_cache* Item_cache::get_cache(Item_result type) case DECIMAL_RESULT: return new Item_cache_decimal(); case STRING_RESULT: - return new Item_cache_str(); + return new Item_cache_str(item); case ROW_RESULT: return new Item_cache_row(); default: @@ -6393,6 +6447,14 @@ my_decimal *Item_cache_str::val_decimal(my_decimal *decimal_val) } +int Item_cache_str::save_in_field(Field *field, bool no_conversions) +{ + int res= Item_cache::save_in_field(field, no_conversions); + return (is_varbinary && field->type() == MYSQL_TYPE_STRING && + value->length() < field->field_length) ? 1 : res; +} + + bool Item_cache_row::allocate(uint num) { item_count= num; @@ -6411,7 +6473,7 @@ bool Item_cache_row::setup(Item * item) { Item *el= item->element_index(i); Item_cache *tmp; - if (!(tmp= values[i]= Item_cache::get_cache(el->result_type()))) + if (!(tmp= values[i]= Item_cache::get_cache(el))) return 1; tmp->setup(el); } @@ -6493,9 +6555,7 @@ Item_type_holder::Item_type_holder(THD *thd, Item *item) prev_decimal_int_part= item->decimal_int_part(); #ifdef HAVE_SPATIAL if (item->field_type() == MYSQL_TYPE_GEOMETRY) - geometry_type= (item->type() == Item::FIELD_ITEM) ? - ((Item_field *)item)->get_geometry_type() : - (Field::geometry_type)((Item_geometry_func *)item)->get_geometry_type(); + geometry_type= item->get_geometry_type(); #endif /* HAVE_SPATIAL */ } diff --git a/sql/item.h b/sql/item.h index 3c699c0eda3..a1135c2c725 100644 --- a/sql/item.h +++ b/sql/item.h @@ -870,6 +870,9 @@ public: */ virtual bool result_as_longlong() { return FALSE; } bool is_datetime(); + virtual Field::geometry_type get_geometry_type() const + { return Field::GEOM_GEOMETRY; }; + String *check_well_formed_result(String *str, bool send_error= 0); }; @@ -1112,6 +1115,8 @@ public: Item_name_const(Item *name_arg, Item *val): value_item(val), name_item(name_arg) { + if(!value_item->basic_const_item()) + my_error(ER_WRONG_ARGUMENTS, MYF(0), "NAME_CONST"); Item::maybe_null= TRUE; } @@ -1335,7 +1340,7 @@ public: int fix_outer_field(THD *thd, Field **field, Item **reference); virtual Item *update_value_transformer(byte *select_arg); void print(String *str); - Field::geometry_type get_geometry_type() + Field::geometry_type get_geometry_type() const { DBUG_ASSERT(field_type() == MYSQL_TYPE_GEOMETRY); return field->get_geometry_type(); @@ -1579,7 +1584,7 @@ public: double val_real() { DBUG_ASSERT(fixed == 1); return ulonglong2double((ulonglong)value); } String *val_str(String*); - Item *clone_item() { return new Item_uint(name,max_length); } + Item *clone_item() { return new Item_uint(name, value, max_length); } int save_in_field(Field *field, bool no_conversions); void print(String *str); Item_num *neg (); @@ -1853,6 +1858,7 @@ public: enum_field_types field_type() const { return MYSQL_TYPE_VARCHAR; } // to prevent drop fixed flag (no need parent cleanup call) void cleanup() {} + void print(String *str); bool eq(const Item *item, bool binary_cmp) const; virtual Item *safe_charset_converter(CHARSET_INFO *tocs); }; @@ -2463,7 +2469,7 @@ public: }; virtual void store(Item *)= 0; enum Type type() const { return CACHE_ITEM; } - static Item_cache* get_cache(Item_result type); + static Item_cache* get_cache(const Item *item); table_map used_tables() const { return used_table_map; } virtual void keep_array() {} // to prevent drop fixed flag (no need parent cleanup call) @@ -2525,9 +2531,16 @@ class Item_cache_str: public Item_cache { char buffer[STRING_BUFFER_USUAL_SIZE]; String *value, value_buff; + bool is_varbinary; + public: - Item_cache_str(): Item_cache(), value(0) { } - + Item_cache_str(const Item *item) : + Item_cache(), value(0), + is_varbinary(item->type() == FIELD_ITEM && + ((const Item_field *) item)->field->type() == + MYSQL_TYPE_VARCHAR && + !((const Item_field *) item)->field->has_charset()) + {} void store(Item *item); double val_real(); longlong val_int(); @@ -2535,6 +2548,7 @@ public: my_decimal *val_decimal(my_decimal *); enum Item_result result_type() const { return STRING_RESULT; } CHARSET_INFO *charset() const { return value->charset(); }; + int save_in_field(Field *field, bool no_conversions); }; class Item_cache_row: public Item_cache @@ -2637,7 +2651,7 @@ public: Field *make_field_by_type(TABLE *table); static uint32 display_length(Item *item); static enum_field_types get_real_type(Item *); - Field::geometry_type get_geometry_type() { return geometry_type; }; + Field::geometry_type get_geometry_type() const { return geometry_type; }; }; diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 0e718eb52bd..b0a7b661c0d 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -147,6 +147,36 @@ static int agg_cmp_type(THD *thd, Item_result *type, Item **items, uint nitems) } +/** + @brief Aggregates field types from the array of items. + + @param[in] items array of items to aggregate the type from + @paran[in] nitems number of items in the array + + @details This function aggregates field types from the array of items. + Found type is supposed to be used later as the result field type + of a multi-argument function. + Aggregation itself is performed by the Field::field_type_merge() + function. + + @note The term "aggregation" is used here in the sense of inferring the + result type of a function from its argument types. + + @return aggregated field type. +*/ + +enum_field_types agg_field_type(Item **items, uint nitems) +{ + uint i; + if (!nitems || items[0]->result_type() == ROW_RESULT ) + return (enum_field_types)-1; + enum_field_types res= items[0]->field_type(); + for (i= 1 ; i < nitems ; i++) + res= Field::field_type_merge(res, items[i]->field_type()); + return res; +} + + static void my_coll_agg_error(DTCollation &c1, DTCollation &c2, const char *fname) { @@ -522,26 +552,26 @@ int Arg_comparator::set_compare_func(Item_bool_func2 *item, Item_result type) } -/* - Convert date provided in a string to the int representation. +/** + @brief Convert date provided in a string to the int representation. - SYNOPSIS - get_date_from_str() - thd Thread handle - str a string to convert - warn_type type of the timestamp for issuing the warning - warn_name field name for issuing the warning - error_arg [out] TRUE if string isn't a DATETIME or clipping occur + @param[in] thd thread handle + @param[in] str a string to convert + @param[in] warn_type type of the timestamp for issuing the warning + @param[in] warn_name field name for issuing the warning + @param[out] error_arg could not extract a DATE or DATETIME - DESCRIPTION - Convert date provided in the string str to the int representation. - if the string contains wrong date or doesn't contain it at all - then the warning is issued and TRUE returned in the error_arg argument. - The warn_type and the warn_name arguments are used as the name and the - type of the field when issuing the warning. + @details Convert date provided in the string str to the int + representation. If the string contains wrong date or doesn't + contain it at all then a warning is issued. The warn_type and + the warn_name arguments are used as the name and the type of the + field when issuing the warning. If any input was discarded + (trailing or non-timestampy characters), was_cut will be non-zero. + was_type will return the type str_to_datetime() could correctly + extract. - RETURN - converted value. + @return + converted value. 0 on error and on zero-dates -- check 'failure' */ static ulonglong @@ -552,26 +582,33 @@ get_date_from_str(THD *thd, String *str, timestamp_type warn_type, int error; MYSQL_TIME l_time; enum_mysql_timestamp_type ret; - *error_arg= TRUE; ret= str_to_datetime(str->ptr(), str->length(), &l_time, (TIME_FUZZY_DATE | MODE_INVALID_DATES | (thd->variables.sql_mode & (MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE))), &error); - if ((ret == MYSQL_TIMESTAMP_DATETIME || ret == MYSQL_TIMESTAMP_DATE)) + + if (ret == MYSQL_TIMESTAMP_DATETIME || ret == MYSQL_TIMESTAMP_DATE) { - value= TIME_to_ulonglong_datetime(&l_time); + /* + Do not return yet, we may still want to throw a "trailing garbage" + warning. + */ *error_arg= FALSE; + value= TIME_to_ulonglong_datetime(&l_time); + } + else + { + *error_arg= TRUE; + error= 1; /* force warning */ } - if (error || *error_arg) - { + if (error > 0) make_truncated_value_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, str->ptr(), str->length(), warn_type, warn_name); - *error_arg= TRUE; - } + return value; } @@ -872,6 +909,12 @@ get_datetime_value(THD *thd, Item ***item_arg, Item **cache_arg, timestamp_type t_type= f_type == MYSQL_TYPE_DATE ? MYSQL_TIMESTAMP_DATE : MYSQL_TIMESTAMP_DATETIME; value= get_date_from_str(thd, str, t_type, warn_item->name, &error); + /* + If str did not contain a valid date according to the current + SQL_MODE, get_date_from_str() has already thrown a warning, + and we don't want to throw NULL on invalid date (see 5.2.6 + "SQL modes" in the manual), so we're done here. + */ } /* Do not cache GET_USER_VAR() function as its const_item() may return TRUE @@ -1343,7 +1386,7 @@ longlong Item_func_truth::val_int() bool Item_in_optimizer::fix_left(THD *thd, Item **ref) { if (!args[0]->fixed && args[0]->fix_fields(thd, args) || - !cache && !(cache= Item_cache::get_cache(args[0]->result_type()))) + !cache && !(cache= Item_cache::get_cache(args[0]))) return 1; cache->setup(args[0]); @@ -1990,10 +2033,20 @@ Item_func_ifnull::fix_length_and_dec() agg_result_type(&hybrid_type, args, 2); maybe_null=args[1]->maybe_null; decimals= max(args[0]->decimals, args[1]->decimals); - max_length= (hybrid_type == DECIMAL_RESULT || hybrid_type == INT_RESULT) ? - (max(args[0]->max_length - args[0]->decimals, - args[1]->max_length - args[1]->decimals) + decimals) : - max(args[0]->max_length, args[1]->max_length); + unsigned_flag= args[0]->unsigned_flag && args[1]->unsigned_flag; + + if (hybrid_type == DECIMAL_RESULT || hybrid_type == INT_RESULT) + { + int len0= args[0]->max_length - args[0]->decimals + - (args[0]->unsigned_flag ? 0 : 1); + + int len1= args[1]->max_length - args[1]->decimals + - (args[1]->unsigned_flag ? 0 : 1); + + max_length= max(len0, len1) + decimals + (unsigned_flag ? 0 : 1); + } + else + max_length= max(args[0]->max_length, args[1]->max_length); switch (hybrid_type) { case STRING_RESULT: @@ -2009,9 +2062,7 @@ Item_func_ifnull::fix_length_and_dec() default: DBUG_ASSERT(0); } - cached_field_type= args[0]->field_type(); - if (cached_field_type != args[1]->field_type()) - cached_field_type= Item_func::field_type(); + cached_field_type= agg_field_type(args, 2); } @@ -2159,11 +2210,13 @@ Item_func_if::fix_length_and_dec() { cached_result_type= arg2_type; collation.set(args[2]->collation.collation); + cached_field_type= args[2]->field_type(); } else if (null2) { cached_result_type= arg1_type; collation.set(args[1]->collation.collation); + cached_field_type= args[1]->field_type(); } else { @@ -2177,6 +2230,7 @@ Item_func_if::fix_length_and_dec() { collation.set(&my_charset_bin); // Number } + cached_field_type= agg_field_type(args + 1, 2); } if ((cached_result_type == DECIMAL_RESULT ) @@ -2573,7 +2627,7 @@ void Item_func_case::fix_length_and_dec() agg_arg_charsets(collation, agg, nagg, MY_COLL_ALLOW_CONV, 1)) return; - + cached_field_type= agg_field_type(agg, nagg); /* Aggregate first expression and all THEN expression types and collations when string comparison @@ -2719,6 +2773,7 @@ my_decimal *Item_func_coalesce::decimal_op(my_decimal *decimal_value) void Item_func_coalesce::fix_length_and_dec() { + cached_field_type= agg_field_type(args, arg_count); agg_result_type(&hybrid_type, args, arg_count); switch (hybrid_type) { case STRING_RESULT: @@ -4277,6 +4332,7 @@ Item_func_regex::fix_fields(THD *thd, Item **ref) if (args[1]->null_value) { // Will always return NULL maybe_null=1; + fixed= 1; return FALSE; } int error; diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 1f4359c454b..d23427584e6 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -640,6 +640,7 @@ public: class Item_func_coalesce :public Item_func_numhybrid { protected: + enum_field_types cached_field_type; Item_func_coalesce(Item *a, Item *b) :Item_func_numhybrid(a, b) {} public: Item_func_coalesce(List &list) :Item_func_numhybrid(list) {} @@ -652,13 +653,13 @@ public: enum Item_result result_type () const { return hybrid_type; } const char *func_name() const { return "coalesce"; } table_map not_null_tables() const { return 0; } + enum_field_types field_type() const { return cached_field_type; } }; class Item_func_ifnull :public Item_func_coalesce { protected: - enum_field_types cached_field_type; bool field_type_defined; public: Item_func_ifnull(Item *a, Item *b) :Item_func_coalesce(a,b) {} @@ -677,6 +678,7 @@ public: class Item_func_if :public Item_func { enum Item_result cached_result_type; + enum_field_types cached_field_type; public: Item_func_if(Item *a,Item *b,Item *c) :Item_func(a,b,c), cached_result_type(INT_RESULT) @@ -686,6 +688,7 @@ public: String *val_str(String *str); my_decimal *val_decimal(my_decimal *); enum Item_result result_type () const { return cached_result_type; } + enum_field_types field_type() const { return cached_field_type; } bool fix_fields(THD *, Item **); void fix_length_and_dec(); uint decimal_precision() const; @@ -722,6 +725,7 @@ class Item_func_case :public Item_func uint ncases; Item_result cmp_type; DTCollation cmp_collation; + enum_field_types cached_field_type; public: Item_func_case(List &list, Item *first_expr_arg, Item *else_expr_arg) :Item_func(), first_expr_num(-1), else_expr_num(-1), @@ -749,6 +753,7 @@ public: uint decimal_precision() const; table_map not_null_tables() const { return 0; } enum Item_result result_type () const { return cached_result_type; } + enum_field_types field_type() const { return cached_field_type; } const char *func_name() const { return "case"; } void print(String *str); Item *find_item(String *str); @@ -1384,6 +1389,7 @@ public: bool subst_argument_checker(byte **arg) { return TRUE; } Item *compile(Item_analyzer analyzer, byte **arg_p, Item_transformer transformer, byte *arg_t); + enum_field_types field_type() const { return MYSQL_TYPE_LONGLONG; } }; diff --git a/sql/item_func.cc b/sql/item_func.cc index e4d370bbdf2..264d9265bca 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -1380,7 +1380,11 @@ longlong Item_func_int_div::val_int() void Item_func_int_div::fix_length_and_dec() { - max_length=args[0]->max_length - args[0]->decimals; + Item_result argtype= args[0]->result_type(); + /* use precision ony for the data type it is applicable for and valid */ + max_length=args[0]->max_length - + (argtype == DECIMAL_RESULT || argtype == INT_RESULT ? + args[0]->decimals : 0); maybe_null=1; unsigned_flag=args[0]->unsigned_flag | args[1]->unsigned_flag; } @@ -1999,6 +2003,7 @@ void Item_func_round::fix_length_and_dec() case DECIMAL_RESULT: { hybrid_type= DECIMAL_RESULT; + decimals_to_set= min(DECIMAL_MAX_SCALE, decimals_to_set); int decimals_delta= args[0]->decimals - decimals_to_set; int precision= args[0]->decimal_precision(); int length_increase= ((decimals_delta <= 0) || truncate) ? 0:1; @@ -2105,7 +2110,7 @@ my_decimal *Item_func_round::decimal_op(my_decimal *decimal_value) longlong dec= args[1]->val_int(); if (dec > 0 || (dec < 0 && args[1]->unsigned_flag)) { - dec= min((ulonglong) dec, DECIMAL_MAX_SCALE); + dec= min((ulonglong) dec, decimals); decimals= (uint8) dec; // to get correct output } else if (dec < INT_MIN) @@ -2243,6 +2248,7 @@ void Item_func_min_max::fix_length_and_dec() else if ((cmp_type == DECIMAL_RESULT) || (cmp_type == INT_RESULT)) max_length= my_decimal_precision_to_length(max_int_part+decimals, decimals, unsigned_flag); + cached_field_type= agg_field_type(args, arg_count); } @@ -4939,13 +4945,44 @@ bool Item_func_match::fix_fields(THD *thd, Item **ref) my_error(ER_WRONG_ARGUMENTS,MYF(0),"MATCH"); return TRUE; } - table=((Item_field *)item)->field->table; + /* + With prepared statements Item_func_match::fix_fields is called twice. + When it is called first time we have original item tree here and add + conversion layer for character sets that do not have ctype array a few + lines below. When it is called second time, we already have conversion + layer in item tree. + */ + table= (item->type() == Item::FIELD_ITEM) ? + ((Item_field *)item)->field->table : + ((Item_field *)((Item_func_conv *)item)->key_item())->field->table; if (!(table->file->table_flags() & HA_CAN_FULLTEXT)) { my_error(ER_TABLE_CANT_HANDLE_FT, MYF(0)); return 1; } table->fulltext_searched=1; + /* A workaround for ucs2 character set */ + if (!args[1]->collation.collation->ctype) + { + CHARSET_INFO *compatible_cs= + get_compatible_charset_with_ctype(args[1]->collation.collation); + bool rc= 1; + if (compatible_cs) + { + Item_string *conv_item= new Item_string("", 0, compatible_cs, + DERIVATION_EXPLICIT); + item= args[0]; + args[0]= conv_item; + rc= agg_item_charsets(cmp_collation, func_name(), args, arg_count, + MY_COLL_ALLOW_SUPERSET_CONV | + MY_COLL_ALLOW_COERCIBLE_CONV | + MY_COLL_DISALLOW_NONE, 1); + args[0]= item; + } + else + my_error(ER_WRONG_ARGUMENTS, MYF(0), "MATCH"); + return rc; + } return agg_arg_collations_for_comparison(cmp_collation, args+1, arg_count-1, 0); } diff --git a/sql/item_func.h b/sql/item_func.h index 56b5e75652c..a31294c0395 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -236,9 +236,40 @@ public: my_decimal *val_decimal(my_decimal *); String *val_str(String*str); + /** + @brief Performs the operation that this functions implements when the + result type is INT. + + @return The result of the operation. + */ virtual longlong int_op()= 0; + + /** + @brief Performs the operation that this functions implements when the + result type is REAL. + + @return The result of the operation. + */ virtual double real_op()= 0; + + /** + @brief Performs the operation that this functions implements when the + result type is DECIMAL. + + @param A pointer where the DECIMAL value will be allocated. + @return + - 0 If the result is NULL + - The same pointer it was given, with the area initialized to the + result of the operation. + */ virtual my_decimal *decimal_op(my_decimal *)= 0; + + /** + @brief Performs the operation that this functions implements when the + result type is a string type. + + @return The result of the operation. + */ virtual String *str_op(String *)= 0; bool is_null() { update_null_value(); return null_value; } }; @@ -435,6 +466,7 @@ public: longlong int_op(); my_decimal *decimal_op(my_decimal *); const char *func_name() const { return "-"; } + virtual bool basic_const_item() const { return args[0]->basic_const_item(); } void fix_length_and_dec(); void fix_num_length_and_dec(); uint decimal_precision() const { return args[0]->decimal_precision(); } @@ -692,7 +724,8 @@ class Item_func_min_max :public Item_func /* An item used for issuing warnings while string to DATETIME conversion. */ Item *datetime_item; THD *thd; - +protected: + enum_field_types cached_field_type; public: Item_func_min_max(List &list,int cmp_sign_arg) :Item_func(list), cmp_type(INT_RESULT), cmp_sign(cmp_sign_arg), compare_as_dates(FALSE), @@ -705,6 +738,7 @@ public: enum Item_result result_type () const { return cmp_type; } bool result_as_longlong() { return compare_as_dates; }; uint cmp_datetimes(ulonglong *value); + enum_field_types field_type() const { return cached_field_type; } }; class Item_func_min :public Item_func_min_max @@ -747,6 +781,8 @@ public: collation= args[0]->collation; max_length= args[0]->max_length; decimals=args[0]->decimals; + /* The item could be a NULL constant. */ + null_value= args[0]->null_value; } }; diff --git a/sql/item_geofunc.cc b/sql/item_geofunc.cc index 6c012277888..966cefea9fe 100644 --- a/sql/item_geofunc.cc +++ b/sql/item_geofunc.cc @@ -27,7 +27,7 @@ Field *Item_geometry_func::tmp_table_field(TABLE *t_arg) { return new Field_geom(max_length, maybe_null, name, t_arg, - (Field::geometry_type) get_geometry_type()); + get_geometry_type()); } void Item_geometry_func::fix_length_and_dec() @@ -38,10 +38,6 @@ void Item_geometry_func::fix_length_and_dec() maybe_null= 1; } -int Item_geometry_func::get_geometry_type() const -{ - return (int)Field::GEOM_GEOMETRY; -} String *Item_func_geometry_from_text::val_str(String *str) { @@ -160,9 +156,9 @@ String *Item_func_geometry_type::val_str(String *str) } -int Item_func_envelope::get_geometry_type() const +Field::geometry_type Item_func_envelope::get_geometry_type() const { - return (int) Field::GEOM_POLYGON; + return Field::GEOM_POLYGON; } @@ -190,9 +186,9 @@ String *Item_func_envelope::val_str(String *str) } -int Item_func_centroid::get_geometry_type() const +Field::geometry_type Item_func_centroid::get_geometry_type() const { - return (int) Field::GEOM_POINT; + return Field::GEOM_POINT; } @@ -330,9 +326,9 @@ err: */ -int Item_func_point::get_geometry_type() const +Field::geometry_type Item_func_point::get_geometry_type() const { - return (int) Field::GEOM_POINT; + return Field::GEOM_POINT; } diff --git a/sql/item_geofunc.h b/sql/item_geofunc.h index 9c7970f9e53..e99510f762f 100644 --- a/sql/item_geofunc.h +++ b/sql/item_geofunc.h @@ -33,7 +33,6 @@ public: void fix_length_and_dec(); enum_field_types field_type() const { return MYSQL_TYPE_GEOMETRY; } Field *tmp_table_field(TABLE *t_arg); - virtual int get_geometry_type() const; bool is_null() { (void) val_int(); return null_value; } }; @@ -92,7 +91,7 @@ public: Item_func_centroid(Item *a): Item_geometry_func(a) {} const char *func_name() const { return "centroid"; } String *val_str(String *); - int get_geometry_type() const; + Field::geometry_type get_geometry_type() const; }; class Item_func_envelope: public Item_geometry_func @@ -101,7 +100,7 @@ public: Item_func_envelope(Item *a): Item_geometry_func(a) {} const char *func_name() const { return "envelope"; } String *val_str(String *); - int get_geometry_type() const; + Field::geometry_type get_geometry_type() const; }; class Item_func_point: public Item_geometry_func @@ -111,7 +110,7 @@ public: Item_func_point(Item *a, Item *b, Item *srid): Item_geometry_func(a, b, srid) {} const char *func_name() const { return "point"; } String *val_str(String *); - int get_geometry_type() const; + Field::geometry_type get_geometry_type() const; }; class Item_func_spatial_decomp: public Item_geometry_func diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 0c11c9eece8..4e72f117869 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -38,36 +38,6 @@ C_MODE_END String my_empty_string("",default_charset_info); -String *Item_str_func::check_well_formed_result(String *str) -{ - /* Check whether we got a well-formed string */ - CHARSET_INFO *cs= str->charset(); - int well_formed_error; - uint wlen= cs->cset->well_formed_len(cs, - str->ptr(), str->ptr() + str->length(), - str->length(), &well_formed_error); - if (wlen < str->length()) - { - THD *thd= current_thd; - char hexbuf[7]; - enum MYSQL_ERROR::enum_warning_level level; - uint diff= str->length() - wlen; - set_if_smaller(diff, 3); - octet2hex(hexbuf, str->ptr() + wlen, diff); - if (thd->variables.sql_mode & - (MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES)) - { - level= MYSQL_ERROR::WARN_LEVEL_ERROR; - null_value= 1; - str= 0; - } - else - level= MYSQL_ERROR::WARN_LEVEL_WARN; - push_warning_printf(thd, level, ER_INVALID_CHARACTER_STRING, - ER(ER_INVALID_CHARACTER_STRING), cs->csname, hexbuf); - } - return str; -} bool Item_str_func::fix_fields(THD *thd, Item **ref) @@ -2229,11 +2199,13 @@ String *Item_func_char::val_str(String *str) { DBUG_ASSERT(fixed == 1); str->length(0); + str->set_charset(collation.collation); for (uint i=0 ; i < arg_count ; i++) { int32 num=(int32) args[i]->val_int(); if (!args[i]->null_value) { + char char_num= (char) num; if (num&0xFF000000L) { str->append((char)(num>>24)); goto b2; @@ -2243,10 +2215,9 @@ String *Item_func_char::val_str(String *str) } else if (num&0xFF00L) { b1: str->append((char)(num>>8)); } - str->append((char) num); + str->append(&char_num, 1); } } - str->set_charset(collation.collation); str->realloc(str->length()); // Add end 0 (for Purify) return check_well_formed_result(str); } diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h index 4ffd8125422..3648438a69b 100644 --- a/sql/item_strfunc.h +++ b/sql/item_strfunc.h @@ -35,7 +35,6 @@ public: my_decimal *val_decimal(my_decimal *); enum Item_result result_type () const { return STRING_RESULT; } void left_right_max_length(); - String *check_well_formed_result(String *str); bool fix_fields(THD *thd, Item **ref); }; @@ -535,7 +534,7 @@ public: String *val_str(String *); void fix_length_and_dec() { - max_length= arg_count * collation.collation->mbmaxlen; + max_length= arg_count * 4; } const char *func_name() const { return "char"; } }; @@ -585,7 +584,8 @@ public: void fix_length_and_dec() { collation.set(default_charset()); - max_length= 64; + max_length=64; + maybe_null= 1; } }; diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index 0020dd35c61..57c3b391507 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -1717,7 +1717,7 @@ void subselect_engine::set_row(List &item_list, Item_cache **row) item->decimals= sel_item->decimals; item->unsigned_flag= sel_item->unsigned_flag; maybe_null= sel_item->maybe_null; - if (!(row[i]= Item_cache::get_cache(res_type))) + if (!(row[i]= Item_cache::get_cache(sel_item))) return; row[i]->setup(sel_item); } @@ -2178,6 +2178,7 @@ int subselect_indexsubquery_engine::exec() ((Item_in_subselect *) item)->value= 0; empty_result_set= TRUE; null_keypart= 0; + table->status= 0; if (check_null) { @@ -2190,6 +2191,16 @@ int subselect_indexsubquery_engine::exec() if (copy_ref_key()) DBUG_RETURN(1); + if (table->status) + { + /* + We know that there will be no rows even if we scan. + Can be set in copy_ref_key. + */ + ((Item_in_subselect *) item)->value= 0; + DBUG_RETURN(0); + } + if (null_keypart) DBUG_RETURN(scan_table()); diff --git a/sql/item_subselect.h b/sql/item_subselect.h index 118609671b8..51dcd3ca175 100644 --- a/sql/item_subselect.h +++ b/sql/item_subselect.h @@ -306,6 +306,7 @@ public: double val_real(); String *val_str(String*); my_decimal *val_decimal(my_decimal *); + void update_null_value () { (void) val_bool(); } bool val_bool(); void top_level_item() { abort_on_null=1; } inline bool is_top_level_item() { return abort_on_null; } diff --git a/sql/item_sum.cc b/sql/item_sum.cc index 48ad53fbf75..ad8ebd0791c 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -905,7 +905,9 @@ bool Item_sum_distinct::setup(THD *thd) List field_list; create_field field_def; /* field definition */ DBUG_ENTER("Item_sum_distinct::setup"); - DBUG_ASSERT(tree == 0); + /* It's legal to call setup() more than once when in a subquery */ + if (tree) + DBUG_RETURN(FALSE); /* Virtual table and the tree are created anew on each re-execution of @@ -913,7 +915,7 @@ bool Item_sum_distinct::setup(THD *thd) mem_root. */ if (field_list.push_back(&field_def)) - return TRUE; + DBUG_RETURN(TRUE); null_value= maybe_null= 1; quick_group= 0; @@ -925,7 +927,7 @@ bool Item_sum_distinct::setup(THD *thd) args[0]->unsigned_flag); if (! (table= create_virtual_tmp_table(thd, field_list))) - return TRUE; + DBUG_RETURN(TRUE); /* XXX: check that the case of CHAR(0) works OK */ tree_key_length= table->s->reclength - table->s->null_bytes; @@ -2443,6 +2445,7 @@ bool Item_sum_count_distinct::setup(THD *thd) /* Setup can be called twice for ROLLUP items. This is a bug. Please add DBUG_ASSERT(tree == 0) here when it's fixed. + It's legal to call setup() more than once when in a subquery */ if (tree || table || tmp_table_param) return FALSE; @@ -3403,7 +3406,7 @@ String* Item_func_group_concat::val_str(String* str) DBUG_ASSERT(fixed == 1); if (null_value) return 0; - if (!result.length() && tree) + if (no_appended && tree) /* Tree is used for sorting as in ORDER BY */ tree_walk(tree, (tree_walk_action)&dump_leaf_key, (void*)this, left_root_right); diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index 3a2df5125ba..4ddc788b182 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -1603,8 +1603,7 @@ bool Item_func_now::get_date(MYSQL_TIME *res, int Item_func_now::save_in_field(Field *to, bool no_conversions) { to->set_notnull(); - to->store_time(<ime, MYSQL_TIMESTAMP_DATETIME); - return 0; + return to->store_time(<ime, MYSQL_TIMESTAMP_DATETIME); } @@ -2646,6 +2645,13 @@ bool Item_date_typecast::get_date(MYSQL_TIME *ltime, uint fuzzy_date) } +bool Item_date_typecast::get_time(MYSQL_TIME *ltime) +{ + bzero((char *)ltime, sizeof(MYSQL_TIME)); + return args[0]->null_value; +} + + String *Item_date_typecast::val_str(String *str) { DBUG_ASSERT(fixed == 1); @@ -3308,7 +3314,7 @@ void Item_func_str_to_date::fix_length_and_dec() { maybe_null= 1; decimals=0; - cached_field_type= MYSQL_TYPE_STRING; + cached_field_type= MYSQL_TYPE_DATETIME; max_length= MAX_DATETIME_FULL_WIDTH*MY_CHARSET_BIN_MB_MAXLEN; cached_timestamp_type= MYSQL_TIMESTAMP_NONE; if ((const_item= args[1]->const_item())) diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h index 94bee28bb6b..b647e93b700 100644 --- a/sql/item_timefunc.h +++ b/sql/item_timefunc.h @@ -779,6 +779,7 @@ public: const char *func_name() const { return "cast_as_date"; } String *val_str(String *str); bool get_date(MYSQL_TIME *ltime, uint fuzzy_date); + bool get_time(MYSQL_TIME *ltime); const char *cast_type() const { return "date"; } enum_field_types field_type() const { return MYSQL_TYPE_DATE; } Field *tmp_table_field(TABLE *t_arg) @@ -964,7 +965,10 @@ class Item_func_maketime :public Item_str_timefunc { public: Item_func_maketime(Item *a, Item *b, Item *c) - :Item_str_timefunc(a, b ,c) {} + :Item_str_timefunc(a, b, c) + { + maybe_null= TRUE; + } String *val_str(String *str); const char *func_name() const { return "maketime"; } }; @@ -1032,7 +1036,7 @@ class Item_func_str_to_date :public Item_str_func bool const_item; public: Item_func_str_to_date(Item *a, Item *b) - :Item_str_func(a, b) + :Item_str_func(a, b), const_item(false) {} String *val_str(String *str); bool get_date(MYSQL_TIME *ltime, uint fuzzy_date); diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index e50d1bd1654..47396748da6 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -1224,6 +1224,7 @@ my_bool mysql_rm_tmp_tables(void); /* item_func.cc */ extern bool check_reserved_words(LEX_STRING *name); +extern enum_field_types agg_field_type(Item **items, uint nitems); /* strfunc.cc */ ulonglong find_set(TYPELIB *lib, const char *x, uint length, CHARSET_INFO *cs, @@ -1309,8 +1310,8 @@ extern bool opt_endinfo, using_udf_functions; extern my_bool locked_in_memory; extern bool opt_using_transactions, mysqld_embedded; extern bool using_update_log, opt_large_files, server_id_supplied; -extern bool opt_log, opt_update_log, opt_bin_log, opt_slow_log, opt_error_log; -extern my_bool opt_log_queries_not_using_indexes; +extern bool opt_update_log, opt_bin_log, opt_error_log; +extern my_bool opt_log, opt_slow_log, opt_log_queries_not_using_indexes; extern bool opt_disable_networking, opt_skip_show_db; extern my_bool opt_character_set_client_handshake; extern bool volatile abort_loop, shutdown_in_progress, grant_option; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index c128aeaa47d..4c459d34a55 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -339,8 +339,8 @@ static my_bool opt_sync_bdb_logs; /* Global variables */ -bool opt_log, opt_update_log, opt_bin_log, opt_slow_log; -my_bool opt_log_queries_not_using_indexes= 0; +bool opt_update_log, opt_bin_log; +my_bool opt_log, opt_slow_log, opt_log_queries_not_using_indexes= 0; bool opt_error_log= IF_WIN(1,0); bool opt_disable_networking=0, opt_skip_show_db=0; my_bool opt_character_set_client_handshake= 1; @@ -6544,7 +6544,8 @@ static void mysql_init_variables(void) /* Things reset to zero */ opt_skip_slave_start= opt_reckless_slave = 0; mysql_home[0]= pidfile_name[0]= log_error_file[0]= 0; - opt_log= opt_update_log= opt_slow_log= 0; + opt_log= opt_slow_log= 0; + opt_update_log= 0; opt_bin_log= 0; opt_disable_networking= opt_skip_show_db=0; opt_logname= opt_update_logname= opt_binlog_index_name= opt_slow_logname= 0; diff --git a/sql/opt_range.cc b/sql/opt_range.cc index c3e9b6638bd..facc8e09c27 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -2206,7 +2206,7 @@ double get_sweep_read_cost(const PARAM *param, ha_rows records) if (param->table->file->primary_key_is_clustered()) { result= param->table->file->read_time(param->table->s->primary_key, - records, records); + (uint)records, records); } else { @@ -2414,7 +2414,7 @@ TABLE_READ_PLAN *get_best_disjunct_quick(PARAM *param, SEL_IMERGE *imerge, /* Add Unique operations cost */ unique_calc_buff_size= - Unique::get_cost_calc_buff_size(non_cpk_scan_records, + Unique::get_cost_calc_buff_size((ulong)non_cpk_scan_records, param->table->file->ref_length, param->thd->variables.sortbuff_size); if (param->imerge_cost_buff_size < unique_calc_buff_size) @@ -2426,7 +2426,7 @@ TABLE_READ_PLAN *get_best_disjunct_quick(PARAM *param, SEL_IMERGE *imerge, } imerge_cost += - Unique::get_use_cost(param->imerge_cost_buff, non_cpk_scan_records, + Unique::get_use_cost(param->imerge_cost_buff, (uint)non_cpk_scan_records, param->table->file->ref_length, param->thd->variables.sortbuff_size); DBUG_PRINT("info",("index_merge total cost: %g (wanted: less then %g)", @@ -2765,7 +2765,7 @@ ROR_INTERSECT_INFO* ror_intersect_init(const PARAM *param) info->is_covering= FALSE; info->index_scan_costs= 0.0; info->index_records= 0; - info->out_rows= param->table->file->records; + info->out_rows= (double) param->table->file->records; bitmap_clear_all(&info->covered_fields); return info; } @@ -6757,7 +6757,7 @@ int QUICK_RANGE_SELECT::reset() if (file->table_flags() & HA_NEED_READ_RANGE_BUFFER) { mrange_bufsiz= min(multi_range_bufsiz, - (QUICK_SELECT_I::records + 1)* head->s->reclength); + ((uint)QUICK_SELECT_I::records + 1)* head->s->reclength); while (mrange_bufsiz && ! my_multi_malloc(MYF(MY_WME), @@ -8359,7 +8359,7 @@ void cost_group_min_max(TABLE* table, KEY *index_info, uint used_key_parts, bool have_min, bool have_max, double *read_cost, ha_rows *records) { - uint table_records; + ha_rows table_records; uint num_groups; uint num_blocks; uint keys_per_block; @@ -8376,14 +8376,14 @@ void cost_group_min_max(TABLE* table, KEY *index_info, uint used_key_parts, keys_per_block= (table->file->block_size / 2 / (index_info->key_length + table->file->ref_length) + 1); - num_blocks= (table_records / keys_per_block) + 1; + num_blocks= (uint)(table_records / keys_per_block) + 1; /* Compute the number of keys in a group. */ keys_per_group= index_info->rec_per_key[group_key_parts - 1]; if (keys_per_group == 0) /* If there is no statistics try to guess */ /* each group contains 10% of all records */ - keys_per_group= (table_records / 10) + 1; - num_groups= (table_records / keys_per_group) + 1; + keys_per_group= (uint)(table_records / 10) + 1; + num_groups= (uint)(table_records / keys_per_group) + 1; /* Apply the selectivity of the quick select for group prefixes. */ if (range_tree && (quick_prefix_records != HA_POS_ERROR)) @@ -8427,9 +8427,9 @@ void cost_group_min_max(TABLE* table, KEY *index_info, uint used_key_parts, *records= num_groups; DBUG_PRINT("info", - ("table rows: %u keys/block: %u keys/group: %u result rows: %lu blocks: %u", - table_records, keys_per_block, keys_per_group, (ulong) *records, - num_blocks)); + ("table rows: %lu keys/block: %u keys/group: %u result rows: %lu blocks: %u", + (ulong)table_records, keys_per_block, keys_per_group, + (ulong) *records, num_blocks)); DBUG_VOID_RETURN; } diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc index b9de54dbf5c..3fc62d05ae5 100644 --- a/sql/opt_sum.cc +++ b/sql/opt_sum.cc @@ -249,20 +249,20 @@ int opt_sum_query(TABLE_LIST *tables, List &all_fields,COND *conds) Check if case 1 from above holds. If it does, we should read the skipped tuple. */ - if (ref.key_buff[prefix_len] == 1 && - /* + if (item_field->field->real_maybe_null() && + ref.key_buff[prefix_len] == 1 && + /* Last keypart (i.e. the argument to MIN) is set to NULL by find_key_for_maxmin only if all other keyparts are bound to constants in a conjunction of equalities. Hence, we can detect this by checking only if the last keypart is NULL. - */ + */ (error == HA_ERR_KEY_NOT_FOUND || key_cmp_if_same(table, ref.key_buff, ref.key, prefix_len))) { - DBUG_ASSERT(item_field->field->real_maybe_null()); error= table->file->index_read(table->record[0], ref.key_buff, - ref.key_length, + ref.key_length, HA_READ_KEY_EXACT); } } diff --git a/sql/protocol.cc b/sql/protocol.cc index ced6d78519a..2bdbe83eea1 100644 --- a/sql/protocol.cc +++ b/sql/protocol.cc @@ -824,6 +824,7 @@ bool Protocol_simple::store(const char *from, uint length, field_types[field_pos] == MYSQL_TYPE_DECIMAL || field_types[field_pos] == MYSQL_TYPE_BIT || field_types[field_pos] == MYSQL_TYPE_NEWDECIMAL || + field_types[field_pos] == MYSQL_TYPE_NEWDATE || (field_types[field_pos] >= MYSQL_TYPE_ENUM && field_types[field_pos] <= MYSQL_TYPE_GEOMETRY)); field_pos++; diff --git a/sql/set_var.cc b/sql/set_var.cc index f4e80302ad7..1f88509d1b6 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -201,6 +201,7 @@ sys_var_key_cache_long sys_key_cache_age_threshold("key_cache_age_threshold", param_age_threshold)); sys_var_bool_ptr sys_local_infile("local_infile", &opt_local_infile); +sys_var_bool_const_ptr sys_log("log", &opt_log); sys_var_trust_routine_creators sys_trust_routine_creators("log_bin_trust_routine_creators", &trust_function_creators); @@ -213,6 +214,7 @@ sys_var_bool_ptr sys_var_thd_ulong sys_log_warnings("log_warnings", &SV::log_warnings); sys_var_thd_ulong sys_long_query_time("long_query_time", &SV::long_query_time); +sys_var_bool_const_ptr sys_log_slow("log_slow_queries", &opt_slow_log); sys_var_thd_bool sys_low_priority_updates("low_priority_updates", &SV::low_priority_updates, fix_low_priority_updates); @@ -665,9 +667,11 @@ sys_var *sys_variables[]= &sys_lc_time_names, &sys_license, &sys_local_infile, + &sys_log, &sys_log_binlog, &sys_log_off, &sys_log_queries_not_using_indexes, + &sys_log_slow, &sys_log_update, &sys_log_warnings, &sys_long_query_time, @@ -946,7 +950,7 @@ struct show_var_st init_vars[]= { #ifdef HAVE_MLOCKALL {"locked_in_memory", (char*) &locked_in_memory, SHOW_BOOL}, #endif - {"log", (char*) &opt_log, SHOW_BOOL}, + {sys_log.name, (char*) &sys_log, SHOW_SYS}, {"log_bin", (char*) &opt_bin_log, SHOW_BOOL}, {sys_trust_function_creators.name,(char*) &sys_trust_function_creators, SHOW_SYS}, {"log_error", (char*) log_error_file, SHOW_CHAR}, @@ -955,7 +959,7 @@ struct show_var_st init_vars[]= { #ifdef HAVE_REPLICATION {"log_slave_updates", (char*) &opt_log_slave_updates, SHOW_MY_BOOL}, #endif - {"log_slow_queries", (char*) &opt_slow_log, SHOW_BOOL}, + {sys_log_slow.name, (char*) &sys_log_slow, SHOW_SYS}, {sys_log_warnings.name, (char*) &sys_log_warnings, SHOW_SYS}, {sys_long_query_time.name, (char*) &sys_long_query_time, SHOW_SYS}, {sys_low_priority_updates.name, (char*) &sys_low_priority_updates, SHOW_SYS}, @@ -1040,6 +1044,9 @@ struct show_var_st init_vars[]= { {sys_readonly.name, (char*) &sys_readonly, SHOW_SYS}, {sys_read_rnd_buff_size.name,(char*) &sys_read_rnd_buff_size, SHOW_SYS}, #ifdef HAVE_REPLICATION + {"relay_log" , (char*) &opt_relay_logname, SHOW_CHAR_PTR}, + {"relay_log_index", (char*) &opt_relaylog_index_name, SHOW_CHAR_PTR}, + {"relay_log_info_file", (char*) &relay_log_info_file, SHOW_CHAR_PTR}, {sys_relay_log_purge.name, (char*) &sys_relay_log_purge, SHOW_SYS}, {"relay_log_space_limit", (char*) &relay_log_space_limit, SHOW_LONGLONG}, #endif @@ -1764,7 +1771,7 @@ bool sys_var::check_set(THD *thd, set_var *var, TYPELIB *enum_names) ¬_used)); if (error_len) { - strmake(buff, error, min(sizeof(buff), error_len)); + strmake(buff, error, min(sizeof(buff) - 1, error_len)); goto err; } } diff --git a/sql/set_var.h b/sql/set_var.h index d408384d5f0..99db38933c2 100644 --- a/sql/set_var.h +++ b/sql/set_var.h @@ -160,6 +160,28 @@ public: }; +class sys_var_bool_const_ptr : public sys_var +{ +public: + my_bool *value; + sys_var_bool_const_ptr(const char *name_arg, my_bool *value_arg) + :sys_var(name_arg),value(value_arg) + {} + bool check(THD *thd, set_var *var) + { + return 1; + } + bool update(THD *thd, set_var *var) + { + return 1; + } + SHOW_TYPE show_type() { return SHOW_MY_BOOL; } + byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base) + { return (byte*) value; } + bool check_update_type(Item_result type) { return 0; } + bool is_readonly() const { return 1; } +}; + class sys_var_str :public sys_var { public: diff --git a/sql/share/errmsg.txt b/sql/share/errmsg.txt index 709cd1fc0a9..9e6cf462113 100644 --- a/sql/share/errmsg.txt +++ b/sql/share/errmsg.txt @@ -5639,3 +5639,5 @@ ER_TOO_HIGH_LEVEL_OF_NESTING_FOR_SELECT eng "Too high level of nesting for select" ER_NAME_BECOMES_EMPTY eng "Name '%-.64s' has become ''" +ER_AMBIGUOUS_FIELD_TERM + eng "First character of the FIELDS TERMINATED string is ambiguous; please use non-optional and non-empty FIELDS ENCLOSED BY" diff --git a/sql/sp_rcontext.cc b/sql/sp_rcontext.cc index ac7c46c9fe5..54e016f6099 100644 --- a/sql/sp_rcontext.cc +++ b/sql/sp_rcontext.cc @@ -503,14 +503,14 @@ sp_cursor::fetch(THD *thd, List *vars) */ Item_cache * -sp_rcontext::create_case_expr_holder(THD *thd, Item_result result_type) +sp_rcontext::create_case_expr_holder(THD *thd, const Item *item) { Item_cache *holder; Query_arena current_arena; thd->set_n_backup_active_arena(thd->spcont->callers_arena, ¤t_arena); - holder= Item_cache::get_cache(result_type); + holder= Item_cache::get_cache(item); thd->restore_active_arena(thd->spcont->callers_arena, ¤t_arena); @@ -559,7 +559,7 @@ sp_rcontext::set_case_expr(THD *thd, int case_expr_id, Item **case_expr_item_ptr case_expr_item->result_type()) { m_case_expr_holders[case_expr_id]= - create_case_expr_holder(thd, case_expr_item->result_type()); + create_case_expr_holder(thd, case_expr_item); } m_case_expr_holders[case_expr_id]->store(case_expr_item); diff --git a/sql/sp_rcontext.h b/sql/sp_rcontext.h index 0104b71a648..43102cfeeb2 100644 --- a/sql/sp_rcontext.h +++ b/sql/sp_rcontext.h @@ -261,7 +261,7 @@ private: bool init_var_table(THD *thd); bool init_var_items(); - Item_cache *create_case_expr_holder(THD *thd, Item_result result_type); + Item_cache *create_case_expr_holder(THD *thd, const Item *item); int set_variable(THD *thd, Field *field, Item **value); }; // class sp_rcontext : public Sql_alloc diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 213e460f699..134541368e9 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -311,7 +311,7 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables) continue; } - const char *password= get_field(&mem, table->field[2]); + const char *password= get_field(thd->mem_root, table->field[2]); uint password_len= password ? strlen(password) : 0; set_user_salt(&user, password, password_len); if (user.salt_len == 0 && password_len != 0) @@ -364,7 +364,7 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables) /* Starting from 4.0.2 we have more fields */ if (table->s->fields >= 31) { - char *ssl_type=get_field(&mem, table->field[next_field++]); + char *ssl_type=get_field(thd->mem_root, table->field[next_field++]); if (!ssl_type) user.ssl_type=SSL_TYPE_NONE; else if (!strcmp(ssl_type, "ANY")) @@ -378,11 +378,11 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables) user.x509_issuer= get_field(&mem, table->field[next_field++]); user.x509_subject= get_field(&mem, table->field[next_field++]); - char *ptr = get_field(&mem, table->field[next_field++]); + char *ptr = get_field(thd->mem_root, table->field[next_field++]); user.user_resource.questions=ptr ? atoi(ptr) : 0; - ptr = get_field(&mem, table->field[next_field++]); + ptr = get_field(thd->mem_root, table->field[next_field++]); user.user_resource.updates=ptr ? atoi(ptr) : 0; - ptr = get_field(&mem, table->field[next_field++]); + ptr = get_field(thd->mem_root, table->field[next_field++]); user.user_resource.conn_per_hour= ptr ? atoi(ptr) : 0; if (user.user_resource.questions || user.user_resource.updates || user.user_resource.conn_per_hour) @@ -391,7 +391,7 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables) if (table->s->fields >= 36) { /* Starting from 5.0.3 we have max_user_connections field */ - ptr= get_field(&mem, table->field[next_field++]); + ptr= get_field(thd->mem_root, table->field[next_field++]); user.user_resource.user_conn= ptr ? atoi(ptr) : 0; } else @@ -3835,50 +3835,83 @@ bool check_column_grant_in_table_ref(THD *thd, TABLE_LIST * table_ref, } -bool check_grant_all_columns(THD *thd, ulong want_access, GRANT_INFO *grant, - const char* db_name, const char *table_name, - Field_iterator *fields) +/** + @brief check if a query can access a set of columns + + @param thd the current thread + @param want_access_arg the privileges requested + @param fields an iterator over the fields of a table reference. + @return Operation status + @retval 0 Success + @retval 1 Falure + @details This function walks over the columns of a table reference + The columns may originate from different tables, depending on the kind of + table reference, e.g. join. + For each table it will retrieve the grant information and will use it + to check the required access privileges for the fields requested from it. +*/ +bool check_grant_all_columns(THD *thd, ulong want_access_arg, + Field_iterator_table_ref *fields) { Security_context *sctx= thd->security_ctx; - GRANT_TABLE *grant_table; - GRANT_COLUMN *grant_column; + ulong want_access= want_access_arg; + const char *table_name= NULL; - want_access &= ~grant->privilege; - if (!want_access) - return 0; // Already checked - if (!grant_option) - goto err2; - - rw_rdlock(&LOCK_grant); - - /* reload table if someone has modified any grants */ - - if (grant->version != grant_version) + if (grant_option) { - grant->grant_table= - table_hash_search(sctx->host, sctx->ip, db_name, - sctx->priv_user, - table_name, 0); /* purecov: inspected */ - grant->version= grant_version; /* purecov: inspected */ - } - /* The following should always be true */ - if (!(grant_table= grant->grant_table)) - goto err; /* purecov: inspected */ + const char* db_name; + GRANT_INFO *grant; + /* Initialized only to make gcc happy */ + GRANT_TABLE *grant_table= NULL; - for (; !fields->end_of_fields(); fields->next()) - { - const char *field_name= fields->name(); - grant_column= column_hash_search(grant_table, field_name, - (uint) strlen(field_name)); - if (!grant_column || (~grant_column->rights & want_access)) - goto err; - } - rw_unlock(&LOCK_grant); - return 0; + rw_rdlock(&LOCK_grant); + + for (; !fields->end_of_fields(); fields->next()) + { + const char *field_name= fields->name(); + + if (table_name != fields->table_name()) + { + table_name= fields->table_name(); + db_name= fields->db_name(); + grant= fields->grant(); + /* get a fresh one for each table */ + want_access= want_access_arg & ~grant->privilege; + if (want_access) + { + /* reload table if someone has modified any grants */ + if (grant->version != grant_version) + { + grant->grant_table= + table_hash_search(sctx->host, sctx->ip, db_name, + sctx->priv_user, + table_name, 0); /* purecov: inspected */ + grant->version= grant_version; /* purecov: inspected */ + } + + grant_table= grant->grant_table; + DBUG_ASSERT (grant_table); + } + } + + if (want_access) + { + GRANT_COLUMN *grant_column= + column_hash_search(grant_table, field_name, + (uint) strlen(field_name)); + if (!grant_column || (~grant_column->rights & want_access)) + goto err; + } + } + rw_unlock(&LOCK_grant); + return 0; err: - rw_unlock(&LOCK_grant); -err2: + rw_unlock(&LOCK_grant); + } + else + table_name= fields->table_name(); + char command[128]; get_privilege_desc(command, sizeof(command), want_access); my_error(ER_COLUMNACCESS_DENIED_ERROR, MYF(0), @@ -4865,6 +4898,7 @@ static int handle_grant_table(TABLE_LIST *tables, uint table_no, bool drop, byte user_key[MAX_KEY_LENGTH]; uint key_prefix_length; DBUG_ENTER("handle_grant_table"); + THD *thd= current_thd; if (! table_no) // mysql.user table { @@ -4932,17 +4966,18 @@ static int handle_grant_table(TABLE_LIST *tables, uint table_no, bool drop, DBUG_PRINT("info",("scan error: %d", error)); continue; } - if (! (host= get_field(&mem, host_field))) + if (! (host= get_field(thd->mem_root, host_field))) host= ""; - if (! (user= get_field(&mem, user_field))) + if (! (user= get_field(thd->mem_root, user_field))) user= ""; #ifdef EXTRA_DEBUG DBUG_PRINT("loop",("scan fields: '%s'@'%s' '%s' '%s' '%s'", user, host, - get_field(&mem, table->field[1]) /*db*/, - get_field(&mem, table->field[3]) /*table*/, - get_field(&mem, table->field[4]) /*column*/)); + get_field(thd->mem_root, table->field[1]) /*db*/, + get_field(thd->mem_root, table->field[3]) /*table*/, + get_field(thd->mem_root, + table->field[4]) /*column*/)); #endif if (strcmp(user_str, user) || my_strcasecmp(system_charset_info, host_str, host)) diff --git a/sql/sql_acl.h b/sql/sql_acl.h index d08f2663af5..b2007ccdf47 100644 --- a/sql/sql_acl.h +++ b/sql/sql_acl.h @@ -205,9 +205,8 @@ bool check_grant_column (THD *thd, GRANT_INFO *grant, const char *name, uint length, Security_context *sctx); bool check_column_grant_in_table_ref(THD *thd, TABLE_LIST * table_ref, const char *name, uint length); -bool check_grant_all_columns(THD *thd, ulong want_access, GRANT_INFO *grant, - const char* db_name, const char *table_name, - Field_iterator *fields); +bool check_grant_all_columns(THD *thd, ulong want_access, + Field_iterator_table_ref *fields); bool check_grant_routine(THD *thd, ulong want_access, TABLE_LIST *procs, bool is_proc, bool no_error); bool check_grant_db(THD *thd,const char *db); diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 905190cb9cd..fd921be1ecf 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -3968,7 +3968,9 @@ find_field_in_tables(THD *thd, Item_ident *item, { Field *cur_field= find_field_in_table_ref(thd, cur_table, name, length, item->name, db, table_name, ref, - check_privileges, + (thd->lex->sql_command == + SQLCOM_SHOW_FIELDS) + ? false : check_privileges, allow_rowid, &(item->cached_field_index), register_tree_change, @@ -4162,7 +4164,8 @@ find_item_in_list(Item *find, List &items, uint *counter, if (item_field->field_name && item_field->table_name && !my_strcasecmp(system_charset_info, item_field->field_name, field_name) && - !strcmp(item_field->table_name, table_name) && + !my_strcasecmp(table_alias_charset, item_field->table_name, + table_name) && (!db_name || (item_field->db_name && !strcmp(item_field->db_name, db_name)))) { @@ -5424,10 +5427,7 @@ insert_fields(THD *thd, Name_resolution_context *context, const char *db_name, !any_privileges) { field_iterator.set(tables); - if (check_grant_all_columns(thd, SELECT_ACL, field_iterator.grant(), - field_iterator.db_name(), - field_iterator.table_name(), - &field_iterator)) + if (check_grant_all_columns(thd, SELECT_ACL, &field_iterator)) DBUG_RETURN(TRUE); } #endif diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index 9a29350880e..8c868971911 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -1032,12 +1032,14 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length) Query_cache_block_table *block_table, *block_table_end; ulong tot_length; Query_cache_query_flags flags; +#ifndef __WIN__ const uint spin_treshold= 50000; const double lock_time_treshold= 0.1; /* Time in seconds */ uint spin_count= 0; int lock_status= 0; ulong new_time= 0; ulong stop_time= 0; +#endif DBUG_ENTER("Query_cache::send_result_to_client"); @@ -1085,6 +1087,9 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length) } } +#ifdef __WIN__ + STRUCT_LOCK(&structure_guard_mutex); +#else stop_time= my_clock()+(ulong)lock_time_treshold*CLOCKS_PER_SEC; while ((lock_status= pthread_mutex_trylock(&structure_guard_mutex)) == EBUSY && spin_count < spin_treshold @@ -1107,6 +1112,7 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length) thd->lex->safe_to_cache_query= FALSE; goto err; } +#endif if (query_cache_size == 0 || flush_in_progress) { diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 4a98a044e25..ef199b6f883 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -1194,6 +1194,7 @@ int select_export::prepare(List &list, SELECT_LEX_UNIT *u) { bool blob_flag=0; + bool string_results= FALSE, non_string_results= FALSE; unit= u; if ((uint) strlen(exchange->file_name) + NAME_LEN >= FN_REFLEN) strmake(path,exchange->file_name,FN_REFLEN-1); @@ -1211,13 +1212,18 @@ select_export::prepare(List &list, SELECT_LEX_UNIT *u) blob_flag=1; break; } + if (item->result_type() == STRING_RESULT) + string_results= TRUE; + else + non_string_results= TRUE; } } field_term_length=exchange->field_term->length(); + field_term_char= field_term_length ? (*exchange->field_term)[0] : INT_MAX; if (!exchange->line_term->length()) exchange->line_term=exchange->field_term; // Use this if it exists field_sep_char= (exchange->enclosed->length() ? (*exchange->enclosed)[0] : - field_term_length ? (*exchange->field_term)[0] : INT_MAX); + field_term_char); escape_char= (exchange->escaped->length() ? (*exchange->escaped)[0] : -1); is_ambiguous_field_sep= test(strchr(ESCAPE_CHARS, field_sep_char)); is_unsafe_field_sep= test(strchr(NUMERIC_CHARS, field_sep_char)); @@ -1229,12 +1235,25 @@ select_export::prepare(List &list, SELECT_LEX_UNIT *u) exchange->opt_enclosed=1; // A little quicker loop fixed_row_size= (!field_term_length && !exchange->enclosed->length() && !blob_flag); + if ((is_ambiguous_field_sep && exchange->enclosed->is_empty() && + (string_results || is_unsafe_field_sep)) || + (exchange->opt_enclosed && non_string_results && + field_term_length && strchr(NUMERIC_CHARS, field_term_char))) + { + push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_AMBIGUOUS_FIELD_TERM, ER(ER_AMBIGUOUS_FIELD_TERM)); + is_ambiguous_field_term= TRUE; + } + else + is_ambiguous_field_term= FALSE; + return 0; } #define NEED_ESCAPING(x) ((int) (uchar) (x) == escape_char || \ - (int) (uchar) (x) == field_sep_char || \ + (enclosed ? (int) (uchar) (x) == field_sep_char \ + : (int) (uchar) (x) == field_term_char) || \ (int) (uchar) (x) == line_sep_char || \ !(x)) @@ -1263,8 +1282,10 @@ bool select_export::send_data(List &items) while ((item=li++)) { Item_result result_type=item->result_type(); + bool enclosed = (exchange->enclosed->length() && + (!exchange->opt_enclosed || result_type == STRING_RESULT)); res=item->str_result(&tmp); - if (res && (!exchange->opt_enclosed || result_type == STRING_RESULT)) + if (res && enclosed) { if (my_b_write(&cache,(byte*) exchange->enclosed->ptr(), exchange->enclosed->length())) @@ -1355,11 +1376,16 @@ bool select_export::send_data(List &items) DBUG_ASSERT before the loop makes that sure. */ - if (NEED_ESCAPING(*pos) || - (check_second_byte && - my_mbcharlen(character_set_client, (uchar) *pos) == 2 && - pos + 1 < end && - NEED_ESCAPING(pos[1]))) + if ((NEED_ESCAPING(*pos) || + (check_second_byte && + my_mbcharlen(character_set_client, (uchar) *pos) == 2 && + pos + 1 < end && + NEED_ESCAPING(pos[1]))) && + /* + Don't escape field_term_char by doubling - doubling is only + valid for ENCLOSED BY characters: + */ + (enclosed || !is_ambiguous_field_term || *pos != field_term_char)) { char tmp_buff[2]; tmp_buff[0]= ((int) *pos == field_sep_char && @@ -1398,7 +1424,7 @@ bool select_export::send_data(List &items) goto err; } } - if (res && (!exchange->opt_enclosed || result_type == STRING_RESULT)) + if (res && enclosed) { if (my_b_write(&cache, (byte*) exchange->enclosed->ptr(), exchange->enclosed->length())) @@ -1527,7 +1553,7 @@ bool select_max_min_finder_subselect::send_data(List &items) { if (!cache) { - cache= Item_cache::get_cache(val_item->result_type()); + cache= Item_cache::get_cache(val_item); switch (val_item->result_type()) { case REAL_RESULT: diff --git a/sql/sql_class.h b/sql/sql_class.h index 4fac86dc405..93a9d4d6da2 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -1368,9 +1368,20 @@ public: ulonglong limit_found_rows; ulonglong options; /* Bitmap of states */ - longlong row_count_func; /* For the ROW_COUNT() function */ - ha_rows cuted_fields, - sent_row_count, examined_row_count; + longlong row_count_func; /* For the ROW_COUNT() function */ + ha_rows cuted_fields; + + /* + number of rows we actually sent to the client, including "synthetic" + rows in ROLLUP etc. + */ + ha_rows sent_row_count; + + /* + number of rows we read, sent or not, including in create_sort_index() + */ + ha_rows examined_row_count; + /* The set of those tables whose fields are referenced in all subqueries of the query. @@ -1403,7 +1414,11 @@ public: /* Statement id is thread-wide. This counter is used to generate ids */ ulong statement_id_counter; ulong rand_saved_seed1, rand_saved_seed2; - ulong row_count; // Row counter, mainly for errors and warnings + /* + Row counter, mainly for errors and warnings. Not increased in + create_sort_index(); may differ from examined_row_count. + */ + ulong row_count; long dbug_thread_id; pthread_t real_id; uint tmp_table, global_read_lock; @@ -1992,12 +2007,19 @@ public: class select_export :public select_to_file { uint field_term_length; int field_sep_char,escape_char,line_sep_char; + int field_term_char; // first char of FIELDS TERMINATED BY or MAX_INT /* The is_ambiguous_field_sep field is true if a value of the field_sep_char field is one of the 'n', 't', 'r' etc characters (see the READ_INFO::unescape method and the ESCAPE_CHARS constant value). */ bool is_ambiguous_field_sep; + /* + The is_ambiguous_field_term is true if field_sep_char contains the first + char of the FIELDS TERMINATED BY (ENCLOSED BY is empty), and items can + contain this character. + */ + bool is_ambiguous_field_term; /* The is_unsafe_field_sep field is true if a value of the field_sep_char field is one of the '0'..'9', '+', '-', '.' and 'e' characters @@ -2029,7 +2051,7 @@ class select_insert :public select_result_interceptor { ulonglong last_insert_id; COPY_INFO info; bool insert_into_view; - + bool is_bulk_insert_mode; select_insert(TABLE_LIST *table_list_par, TABLE *table_par, List *fields_par, List *update_fields, List *update_values, diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index f07af393070..770bbd1349d 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -189,11 +189,9 @@ static int check_insert_fields(THD *thd, TABLE_LIST *table_list, #ifndef NO_EMBEDDED_ACCESS_CHECKS if (grant_option) { - Field_iterator_table field_it; - field_it.set_table(table); - if (check_grant_all_columns(thd, INSERT_ACL, &table->grant, - table->s->db, table->s->table_name, - &field_it)) + Field_iterator_table_ref field_it; + field_it.set(table_list); + if (check_grant_all_columns(thd, INSERT_ACL, &field_it)) return -1; } #endif @@ -2647,7 +2645,8 @@ select_insert::select_insert(TABLE_LIST *table_list_par, TABLE *table_par, bool ignore_check_option_errors) :table_list(table_list_par), table(table_par), fields(fields_par), last_insert_id(0), - insert_into_view(table_list_par && table_list_par->view != 0) + insert_into_view(table_list_par && table_list_par->view != 0), + is_bulk_insert_mode(FALSE) { bzero((char*) &info,sizeof(info)); info.handle_duplicates= duplic; @@ -2832,8 +2831,11 @@ int select_insert::prepare2(void) { DBUG_ENTER("select_insert::prepare2"); if (thd->lex->current_select->options & OPTION_BUFFER_RESULT && - !thd->prelocked_mode) + !thd->prelocked_mode && !is_bulk_insert_mode) + { table->file->start_bulk_insert((ha_rows) 0); + is_bulk_insert_mode= TRUE; + } DBUG_RETURN(0); } @@ -2939,6 +2941,7 @@ bool select_insert::send_eof() DBUG_ENTER("select_insert::send_eof"); error= (!thd->prelocked_mode) ? table->file->end_bulk_insert():0; + is_bulk_insert_mode= FALSE; table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY); table->file->extra(HA_EXTRA_WRITE_CANNOT_REPLACE); @@ -3129,7 +3132,10 @@ static TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info, create_field *cr_field; Field *field, *def_field; if (item->type() == Item::FUNC_ITEM) - field= item->tmp_table_field(&tmp_table); + if (item->result_type() != STRING_RESULT) + field= item->tmp_table_field(&tmp_table); + else + field= item->tmp_table_field_from_field_type(&tmp_table); else field= create_tmp_field(thd, &tmp_table, item, item->type(), (Item ***) 0, &tmp_field, &def_field, 0, 0, 0, 0, @@ -3271,7 +3277,10 @@ select_create::prepare(List &values, SELECT_LEX_UNIT *u) if (info.handle_duplicates == DUP_UPDATE) table->file->extra(HA_EXTRA_INSERT_WITH_UPDATE); if (!thd->prelocked_mode) + { table->file->start_bulk_insert((ha_rows) 0); + is_bulk_insert_mode= TRUE; + } thd->abort_on_warning= (!info.ignore && (thd->variables.sql_mode & (MODE_STRICT_TRANS_TABLES | diff --git a/sql/sql_map.cc b/sql/sql_map.cc index 03dc091b9b7..282716c6151 100644 --- a/sql/sql_map.cc +++ b/sql/sql_map.cc @@ -41,7 +41,7 @@ mapped_files::mapped_files(const my_string filename,byte *magic,uint magic_lengt struct stat stat_buf; if (!fstat(file,&stat_buf)) { - if (!(map=(byte*) my_mmap(0,(size=(ulong) stat_buf.st_size),PROT_READ, + if (!(map=(byte*) my_mmap(0,(size_t)(size=(ulong) stat_buf.st_size),PROT_READ, MAP_SHARED | MAP_NORESERVE,file, 0L))) { @@ -52,7 +52,7 @@ mapped_files::mapped_files(const my_string filename,byte *magic,uint magic_lengt if (map && memcmp(map,magic,magic_length)) { my_error(ER_WRONG_MAGIC, MYF(0), name); - VOID(my_munmap(map,size)); + VOID(my_munmap(map,(size_t)size)); map=0; } if (!map) @@ -70,7 +70,7 @@ mapped_files::~mapped_files() #ifdef HAVE_MMAP if (file >= 0) { - VOID(my_munmap(map,size)); + VOID(my_munmap(map,(size_t)size)); VOID(my_close(file,MYF(0))); file= -1; map=0; } diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index a111208cbf9..0a8b92d28c0 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -6430,7 +6430,12 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd, ST_SCHEMA_TABLE *schema_table= find_schema_table(thd, ptr->table_name); if (!schema_table || (schema_table->hidden && - lex->orig_sql_command == SQLCOM_END)) // not a 'show' command + (lex->orig_sql_command == SQLCOM_END || // not a 'show' command + /* + this check is used for show columns|keys from I_S hidden table + */ + lex->orig_sql_command == SQLCOM_SHOW_FIELDS || + lex->orig_sql_command == SQLCOM_SHOW_KEYS))) { my_error(ER_UNKNOWN_TABLE, MYF(0), ptr->table_name, INFORMATION_SCHEMA_NAME.str); diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 87011a451e2..a652a49fff5 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -565,11 +565,12 @@ JOIN::prepare(Item ***rref_pointer_array, /* - Check if one one uses a not constant column with group functions - and no GROUP BY. + Check if there are references to un-aggregated columns when computing + aggregate functions with implicit grouping (there is no GROUP BY). TODO: Add check of calculation of GROUP functions and fields: SELECT COUNT(*)+table.col1 from table1; */ + if (thd->variables.sql_mode & MODE_ONLY_FULL_GROUP_BY) { if (!group_list) { @@ -583,6 +584,13 @@ JOIN::prepare(Item ***rref_pointer_array, else if (!(flag & 2) && !item->const_during_execution()) flag|=2; } + if (having) + { + if (having->with_sum_func) + flag |= 1; + else if (!having->const_during_execution()) + flag |= 2; + } if (flag == 3) { my_message(ER_MIX_OF_GROUP_FUNC_AND_FIELDS, @@ -1057,10 +1065,19 @@ JOIN::optimize() We have found that grouping can be removed since groups correspond to only one row anyway, but we still have to guarantee correct result order. The line below effectively rewrites the query from GROUP BY - to ORDER BY . One exception is if skip_sort_order is - set (see above), then we can simply skip GROUP BY. + to ORDER BY . There are two exceptions: + - if skip_sort_order is set (see above), then we can simply skip + GROUP BY; + - we can only rewrite ORDER BY if the ORDER BY fields are 'compatible' + with the GROUP BY ones, i.e. either one is a prefix of another. + We only check if the ORDER BY is a prefix of GROUP BY. In this case + test_if_subpart() copies the ASC/DESC attributes from the original + ORDER BY fields. + If GROUP BY is a prefix of ORDER BY, then it is safe to leave + 'order' as is. */ - order= skip_sort_order ? 0 : group_list; + if (!order || test_if_subpart(group_list, order)) + order= skip_sort_order ? 0 : group_list; group_list= 0; group= 0; } @@ -5927,7 +5944,7 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond) /* Fix for EXPLAIN */ if (sel->quick) - join->best_positions[i].records_read= sel->quick->records; + join->best_positions[i].records_read= (double)sel->quick->records; } else { @@ -6083,10 +6100,9 @@ make_join_readinfo(JOIN *join, ulonglong options) ordered. If there is a temp table the ordering is done as a last operation and doesn't prevent join cache usage. */ - if (!ordered_set && !join->need_tmp && - ((table == join->sort_by_table && - (!join->order || join->skip_sort_order)) || - (join->sort_by_table == (TABLE *) 1 && i != join->const_tables))) + if (!ordered_set && !join->need_tmp && + (table == join->sort_by_table || + (join->sort_by_table == (TABLE *) 1 && i != join->const_tables))) ordered_set= 1; switch (tab->type) { @@ -10351,6 +10367,15 @@ do_select(JOIN *join,List *fields,TABLE *table,Procedure *procedure) error= (*end_select)(join,join_tab,0); if (error == NESTED_LOOP_OK || error == NESTED_LOOP_QUERY_LIMIT) error= (*end_select)(join,join_tab,1); + + /* + If we don't go through evaluate_join_record(), do the counting + here. join->send_records is increased on success in end_send(), + so we don't touch it here. + */ + join->examined_rows++; + join->thd->row_count++; + DBUG_ASSERT(join->examined_rows <= 1); } else if (join->send_row_on_empty_set()) { @@ -14361,6 +14386,9 @@ change_to_use_tmp_fields(THD *thd, Item **ref_pointer_array, item_field= (Item*) new Item_field(field); if (!item_field) DBUG_RETURN(TRUE); // Fatal error + + if (item->real_item()->type() != Item::FIELD_ITEM) + field->orig_table= 0; item_field->name= item->name; if (item->type() == Item::REF_ITEM) { @@ -15500,6 +15528,55 @@ static void print_join(THD *thd, String *str, List *tables) } +/** + @brief Print an index hint for a table + + @details Prints out the USE|FORCE|IGNORE index hints for a table. + + @param thd the current thread + @param[out] str appends the index hint here + @param hint what the hint is (as string : "USE INDEX"| + "FORCE INDEX"|"IGNORE INDEX") + @param hint_length the length of the string in 'hint' + @param indexes a list of index names for the hint +*/ + +void +TABLE_LIST::print_index_hint(THD *thd, String *str, + const char *hint, uint32 hint_length, + List indexes) +{ + List_iterator_fast li(indexes); + String *idx; + bool first= 1; + size_t find_length= strlen(primary_key_name); + + str->append (' '); + str->append (hint, hint_length); + str->append (STRING_WITH_LEN(" (")); + while ((idx = li++)) + { + if (first) + first= 0; + else + str->append(','); + /* + It's safe to use ptr() here because we compare the length first + and we rely that my_strcasecmp will not access more than length() + chars from the string. See test_if_string_in_list() for similar + implementation. + */ + if (find_length == idx->length() && + !my_strcasecmp (system_charset_info, primary_key_name, + idx->ptr())) + str->append(primary_key_name); + else + append_identifier (thd, str, idx->ptr(), idx->length()); + } + str->append(')'); +} + + /* Print table as it should be in join list @@ -15564,9 +15641,33 @@ void TABLE_LIST::print(THD *thd, String *str) } if (my_strcasecmp(table_alias_charset, cmp_name, alias)) { + char t_alias_buff[MAX_ALIAS_NAME]; + const char *t_alias= alias; + str->append(' '); - append_identifier(thd, str, alias, strlen(alias)); + if (lower_case_table_names== 1) + { + if (alias && alias[0]) + { + strmov(t_alias_buff, alias); + my_casedn_str(files_charset_info, t_alias_buff); + t_alias= t_alias_buff; + } + } + + append_identifier(thd, str, t_alias, strlen(t_alias)); } + + if (use_index) + { + if (force_index) + print_index_hint(thd, str, STRING_WITH_LEN("FORCE INDEX"), *use_index); + else + print_index_hint(thd, str, STRING_WITH_LEN("USE INDEX"), *use_index); + } + if (ignore_index) + print_index_hint (thd, str, STRING_WITH_LEN("IGNORE INDEX"), *ignore_index); + } } diff --git a/sql/sql_select.h b/sql/sql_select.h index d84fbcb8c2d..4fc32e7fdb3 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -521,9 +521,13 @@ public: store_key(THD *thd, Field *field_arg, char *ptr, char *null, uint length) :null_key(0), null_ptr(null), err(0) { - if (field_arg->type() == FIELD_TYPE_BLOB) + if (field_arg->type() == FIELD_TYPE_BLOB + || field_arg->type() == FIELD_TYPE_GEOMETRY) { - /* Key segments are always packed with a 2 byte length prefix */ + /* + Key segments are always packed with a 2 byte length prefix. + See mi_rkey for details. + */ to_field=new Field_varstring(ptr, length, 2, (uchar*) null, 1, Field::NONE, field_arg->field_name, field_arg->table, field_arg->charset()); diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 9d6f66aff53..2a87d603cf9 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -961,8 +961,8 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, sql_field->length= dup_field->char_length; sql_field->pack_length= dup_field->pack_length; sql_field->key_length= dup_field->key_length; - sql_field->create_length_to_internal_length(); sql_field->decimals= dup_field->decimals; + sql_field->create_length_to_internal_length(); sql_field->unireg_check= dup_field->unireg_check; /* We're making one field from two, the result field will have @@ -1293,7 +1293,7 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, } if (f_is_geom(sql_field->pack_flag) && sql_field->geom_type == Field::GEOM_POINT) - column->length= 21; + column->length= 25; if (!column->length) { my_error(ER_BLOB_KEY_WITHOUT_LENGTH, MYF(0), column->field_name); diff --git a/sql/sql_udf.cc b/sql/sql_udf.cc index ce6cd43eace..34ca18d5c39 100644 --- a/sql/sql_udf.cc +++ b/sql/sql_udf.cc @@ -410,7 +410,12 @@ int mysql_create_function(THD *thd,udf_func *udf) if (!initialized) { - my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0)); + if (opt_noacl) + my_error(ER_CANT_INITIALIZE_UDF, MYF(0), + udf->name.str, + "UDFs are unavailable with the --skip-grant-tables option"); + else + my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0)); DBUG_RETURN(1); } @@ -514,7 +519,10 @@ int mysql_drop_function(THD *thd,const LEX_STRING *udf_name) DBUG_ENTER("mysql_drop_function"); if (!initialized) { - my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0)); + if (opt_noacl) + my_error(ER_FUNCTION_NOT_DEFINED, MYF(0), udf_name->str); + else + my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0)); DBUG_RETURN(1); } rw_wrlock(&THR_LOCK_udf); diff --git a/sql/sql_update.cc b/sql/sql_update.cc index c78e246f518..321d07dec76 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -362,7 +362,7 @@ int mysql_update(THD *thd, init_read_record_idx(&info, thd, table, 1, used_index); thd->proc_info="Searching rows for update"; - uint tmp_limit= limit; + ha_rows tmp_limit= limit; while (!(error=info.read_record(&info)) && !thd->killed) { diff --git a/sql/sql_view.cc b/sql/sql_view.cc index 35a97411511..297edd0d90d 100644 --- a/sql/sql_view.cc +++ b/sql/sql_view.cc @@ -223,9 +223,6 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views, { LEX *lex= thd->lex; bool link_to_local; -#ifndef NO_EMBEDDED_ACCESS_CHECKS - bool definer_check_is_needed= mode != VIEW_ALTER || lex->definer; -#endif /* first table in list is target VIEW name => cut off it */ TABLE_LIST *view= lex->unlink_first_table(&link_to_local); TABLE_LIST *tables= lex->query_tables; @@ -280,7 +277,7 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views, - same as current user - current user has SUPER_ACL */ - if (definer_check_is_needed && + if (lex->definer && (strcmp(lex->definer->user.str, thd->security_ctx->priv_user) != 0 || my_strcasecmp(system_charset_info, lex->definer->host.str, @@ -925,6 +922,15 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table, DBUG_RETURN(0); } + if (table->use_index || table->ignore_index) + { + my_error(ER_WRONG_USAGE, MYF(0), + table->ignore_index ? "IGNORE INDEX" : + (table->force_index ? "FORCE INDEX" : "USE INDEX"), + "VIEW"); + DBUG_RETURN(TRUE); + } + /* check loop via view definition */ for (TABLE_LIST *precedent= table->referencing_view; precedent; diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 3fd8d339f31..3401bf739b3 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -3094,7 +3094,7 @@ type: spatial_type: GEOMETRY_SYM { $$= Field::GEOM_GEOMETRY; } | GEOMETRYCOLLECTION { $$= Field::GEOM_GEOMETRYCOLLECTION; } - | POINT_SYM { Lex->length= (char*)"21"; + | POINT_SYM { Lex->length= (char*)"25"; $$= Field::GEOM_POINT; } | MULTIPOINT { $$= Field::GEOM_MULTIPOINT; } @@ -4305,6 +4305,12 @@ select_item: MYSQL_YYABORT; if ($4.str) { + if (Lex->sql_command == SQLCOM_CREATE_VIEW && + check_column_name($4.str)) + { + my_error(ER_WRONG_COLUMN_NAME, MYF(0), $4.str); + MYSQL_YYABORT; + } $2->is_autogenerated_name= FALSE; $2->set_name($4.str, $4.length, system_charset_info); } @@ -7639,11 +7645,15 @@ literal: String *str= tmp ? tmp->quick_fix_field(), tmp->val_str((String*) 0) : (String*) 0; - $$= new Item_string(str ? str->ptr() : "", + $$= new Item_string(NULL, /* name will be set in select_item */ + str ? str->ptr() : "", str ? str->length() : 0, Lex->underscore_charset); - if ($$) - ((Item_string *) $$)->set_repertoire_from_value(); + if (!$$ || !$$->check_well_formed_result(&$$->str_value, TRUE)) + { + MYSQL_YYABORT; + } + ((Item_string *) $$)->set_repertoire_from_value(); } | UNDERSCORE_CHARSET BIN_NUM { @@ -7655,9 +7665,14 @@ literal: String *str= tmp ? tmp->quick_fix_field(), tmp->val_str((String*) 0) : (String*) 0; - $$= new Item_string(str ? str->ptr() : "", - str ? str->length() : 0, - Lex->charset); + $$= new Item_string(NULL, /* name will be set in select_item */ + str ? str->ptr() : "", + str ? str->length() : 0, + Lex->underscore_charset); + if (!$$ || !$$->check_well_formed_result(&$$->str_value, TRUE)) + { + MYSQL_YYABORT; + } } | DATE_SYM text_literal { $$ = $2; } | TIME_SYM text_literal { $$ = $2; } diff --git a/sql/table.cc b/sql/table.cc index a393f1a676b..7fe9aa774f3 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -732,9 +732,11 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat, keyinfo->key_length+= HA_KEY_NULL_LENGTH; } if (field->type() == FIELD_TYPE_BLOB || - field->real_type() == MYSQL_TYPE_VARCHAR) + field->real_type() == MYSQL_TYPE_VARCHAR || + field->type() == FIELD_TYPE_GEOMETRY) { - if (field->type() == FIELD_TYPE_BLOB) + if (field->type() == FIELD_TYPE_BLOB || + field->type() == FIELD_TYPE_GEOMETRY) key_part->key_part_flag|= HA_BLOB_PART; else key_part->key_part_flag|= HA_VAR_LENGTH_PART; diff --git a/sql/table.h b/sql/table.h index f411ce489c4..cff4be630e4 100644 --- a/sql/table.h +++ b/sql/table.h @@ -773,6 +773,8 @@ struct TABLE_LIST private: bool prep_check_option(THD *thd, uint8 check_opt_type); bool prep_where(THD *thd, Item **conds, bool no_where_clause); + void print_index_hint(THD *thd, String *str, const char *hint, + uint32 hint_length, List); /* Cleanup for re-execution in a prepared statement or a stored procedure. diff --git a/strings/decimal.c b/strings/decimal.c index f1f02f3a071..cbea0e340c6 100644 --- a/strings/decimal.c +++ b/strings/decimal.c @@ -2323,11 +2323,12 @@ static int do_div_mod(decimal_t *from1, decimal_t *from2, } if (unlikely(intg0+frac0 > to->len)) { - stop1-=to->len-frac0-intg0; + stop1-=frac0+intg0-to->len; frac0=to->len-intg0; to->frac=frac0*DIG_PER_DEC1; error=E_DEC_TRUNCATED; } + DBUG_ASSERT(buf0 + (stop1 - start1) <= to->buf + to->len); while (start1 < stop1) *buf0++=*start1++; } diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 9962a108e45..65e18da97f1 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -15490,7 +15490,7 @@ static void test_bug21635() char *query_end; MYSQL_RES *result; MYSQL_FIELD *field; - unsigned int field_count, i; + unsigned int field_count, i, j; int rc; DBUG_ENTER("test_bug21635"); @@ -15506,28 +15506,35 @@ static void test_bug21635() myquery(rc); rc= mysql_query(mysql, "CREATE TABLE t1 (i INT)"); myquery(rc); - rc= mysql_query(mysql, "INSERT INTO t1 VALUES (1)"); - myquery(rc); - - rc= mysql_real_query(mysql, query, query_end - query); - myquery(rc); - - result= mysql_use_result(mysql); - DIE_UNLESS(result); - - field_count= mysql_field_count(mysql); - for (i= 0; i < field_count; ++i) + /* + We need this loop to ensure correct behavior with both constant and + non-constant tables. + */ + for (j= 0; j < 2 ; j++) { - field= mysql_fetch_field_direct(result, i); - printf("%s -> %s ... ", expr[i * 2], field->name); - fflush(stdout); - DIE_UNLESS(field->db[0] == 0 && field->org_table[0] == 0 && - field->table[0] == 0 && field->org_name[0] == 0); - DIE_UNLESS(strcmp(field->name, expr[i * 2 + 1]) == 0); - puts("OK"); - } + rc= mysql_query(mysql, "INSERT INTO t1 VALUES (1)"); + myquery(rc); - mysql_free_result(result); + rc= mysql_real_query(mysql, query, query_end - query); + myquery(rc); + + result= mysql_use_result(mysql); + DIE_UNLESS(result); + + field_count= mysql_field_count(mysql); + for (i= 0; i < field_count; ++i) + { + field= mysql_fetch_field_direct(result, i); + printf("%s -> %s ... ", expr[i * 2], field->name); + fflush(stdout); + DIE_UNLESS(field->db[0] == 0 && field->org_table[0] == 0 && + field->table[0] == 0 && field->org_name[0] == 0); + DIE_UNLESS(strcmp(field->name, expr[i * 2 + 1]) == 0); + puts("OK"); + } + + mysql_free_result(result); + } rc= mysql_query(mysql, "DROP TABLE t1"); myquery(rc); @@ -15857,6 +15864,99 @@ static void test_bug29306() DBUG_VOID_RETURN; } + +/** + Bug#31669 Buffer overflow in mysql_change_user() +*/ + +#define LARGE_BUFFER_SIZE 2048 + +static void test_bug31669() +{ + int rc; + static char buff[LARGE_BUFFER_SIZE+1]; +#ifndef EMBEDDED_LIBRARY + static char user[USERNAME_LENGTH+1]; + static char db[NAME_LEN+1]; + static char query[LARGE_BUFFER_SIZE*2]; +#endif + + DBUG_ENTER("test_bug31669"); + myheader("test_bug31669"); + + rc= mysql_change_user(mysql, NULL, NULL, NULL); + DIE_UNLESS(rc); + + rc= mysql_change_user(mysql, "", "", ""); + DIE_UNLESS(rc); + + memset(buff, 'a', sizeof(buff)); + + rc= mysql_change_user(mysql, buff, buff, buff); + DIE_UNLESS(rc); + + rc = mysql_change_user(mysql, opt_user, opt_password, current_db); + DIE_UNLESS(!rc); + +#ifndef EMBEDDED_LIBRARY + memset(db, 'a', sizeof(db)); + db[NAME_LEN]= 0; + strxmov(query, "CREATE DATABASE IF NOT EXISTS ", db, NullS); + rc= mysql_query(mysql, query); + myquery(rc); + + memset(user, 'b', sizeof(user)); + user[USERNAME_LENGTH]= 0; + memset(buff, 'c', sizeof(buff)); + buff[LARGE_BUFFER_SIZE]= 0; + strxmov(query, "GRANT ALL PRIVILEGES ON *.* TO '", user, "'@'%' IDENTIFIED BY " + "'", buff, "' WITH GRANT OPTION", NullS); + rc= mysql_query(mysql, query); + myquery(rc); + + rc= mysql_query(mysql, "FLUSH PRIVILEGES"); + myquery(rc); + + rc= mysql_change_user(mysql, user, buff, db); + DIE_UNLESS(!rc); + + user[USERNAME_LENGTH-1]= 'a'; + rc= mysql_change_user(mysql, user, buff, db); + DIE_UNLESS(rc); + + user[USERNAME_LENGTH-1]= 'b'; + buff[LARGE_BUFFER_SIZE-1]= 'd'; + rc= mysql_change_user(mysql, user, buff, db); + DIE_UNLESS(rc); + + buff[LARGE_BUFFER_SIZE-1]= 'c'; + db[NAME_LEN-1]= 'e'; + rc= mysql_change_user(mysql, user, buff, db); + DIE_UNLESS(rc); + + db[NAME_LEN-1]= 'a'; + rc= mysql_change_user(mysql, user, buff, db); + DIE_UNLESS(!rc); + + rc= mysql_change_user(mysql, user + 1, buff + 1, db + 1); + DIE_UNLESS(rc); + + rc = mysql_change_user(mysql, opt_user, opt_password, current_db); + DIE_UNLESS(!rc); + + strxmov(query, "DROP DATABASE ", db, NullS); + rc= mysql_query(mysql, query); + myquery(rc); + + strxmov(query, "DELETE FROM mysql.user WHERE User='", user, "'", NullS); + rc= mysql_query(mysql, query); + myquery(rc); + DIE_UNLESS(mysql_affected_rows(mysql) == 1); +#endif + + DBUG_VOID_RETURN; +} + /* Read and parse arguments and MySQL options from my.cnf */ @@ -16149,6 +16249,7 @@ static struct my_tests_st my_tests[]= { { "test_bug27592", test_bug27592 }, { "test_bug29948", test_bug29948 }, { "test_bug29306", test_bug29306 }, + { "test_bug31669", test_bug31669 }, { 0, 0 } };