diff --git a/.bzrignore b/.bzrignore index d1de21857db..e7a7a1c27dc 100644 --- a/.bzrignore +++ b/.bzrignore @@ -708,7 +708,6 @@ mysql-test/r/*.err mysql-test/r/*.log mysql-test/r/*.out mysql-test/r/*.reject -mysql-test/r/*.warnings mysql-test/r/alter_table.err mysql-test/r/archive.err mysql-test/r/bdb-alter-table-1.err @@ -1342,3 +1341,6 @@ win/vs71cache.txt win/vs8cache.txt zlib/*.ds? zlib/*.vcproj +debian/control +debian/defs.mk +include/abi_check diff --git a/BUILD/check-cpu b/BUILD/check-cpu index 8969f92bda4..48a5b5371e3 100755 --- a/BUILD/check-cpu +++ b/BUILD/check-cpu @@ -104,6 +104,12 @@ check_cpu () { *Athlon*64*) cpu_arg="athlon64"; ;; + *Turion*) + cpu_arg="athlon64"; + ;; + *Opteron*) + cpu_arg="athlon64"; + ;; *Athlon*) cpu_arg="athlon"; ;; diff --git a/BUILD/compile-pentium-gcov b/BUILD/compile-pentium-gcov index 26475824570..0d561d5b147 100755 --- a/BUILD/compile-pentium-gcov +++ b/BUILD/compile-pentium-gcov @@ -13,8 +13,9 @@ export LDFLAGS="-fprofile-arcs -ftest-coverage" # The -fprofile-arcs and -ftest-coverage options cause GCC to instrument the # code with profiling information used by gcov. -# the -DDISABLE_TAO_ASM is needed to avoid build failures in Yassl. -extra_flags="$pentium_cflags -fprofile-arcs -ftest-coverage -DDISABLE_TAO_ASM $debug_cflags $max_cflags -DMYSQL_SERVER_SUFFIX=-gcov" +# The -DDISABLE_TAO_ASM is needed to avoid build failures in Yassl. +# The -DHAVE_gcov enables code to write out coverage info even when crashing. +extra_flags="$pentium_cflags -fprofile-arcs -ftest-coverage -DDISABLE_TAO_ASM $debug_cflags $max_cflags -DMYSQL_SERVER_SUFFIX=-gcov -DHAVE_gcov" c_warnings="$c_warnings $debug_extra_warnings" cxx_warnings="$cxx_warnings $debug_extra_warnings" extra_configs="$pentium_configs $debug_configs --disable-shared $static_link" diff --git a/BitKeeper/triggers/post-commit b/BitKeeper/triggers/post-commit index 8051cf98b7a..865d7cdac92 100755 --- a/BitKeeper/triggers/post-commit +++ b/BitKeeper/triggers/post-commit @@ -33,6 +33,13 @@ then exit fi +IS_MERGE=`bk changes -r+ -k -m` +if [ "$IS_MERGE" = "" ] +then + echo Merge changeset, not sending mails + exit +fi + CHANGESET=`bk -R prs -r+ -h -d':P:::I:' ChangeSet` CSETKEY=`bk -R prs -r+ -h -d':KEY:' ChangeSet` # @@ -48,44 +55,35 @@ WL=`bk -R prs -r+ -h -d':C:' ChangeSet | \ s/.*\(WL#[0-9][0-9]*\)/ \1/p'` if [ "$BUG" = "" ] then - TO=dev-public@mysql.com +# TO=dev-public@mysql.com BS="" BH="" else - TO=dev-bugs@mysql.com +# TO=dev-bugs@mysql.com BS=" BUG#$BUG" # need newline here BH="X-Bug: $BUG " fi + #++ -# dev-public@ / dev-bugs@ +# commits@ or dev-private@ mail #-- - echo "Commit successful, notifying developers at $TO" + +LIST="commits" +TO="commits@lists.mysql.com" +if [ -f .tree-is-private ] +then + LIST="dev-private" + TO="dev-private@mysql.com" +fi + + echo "Notifying $LIST list at $TO" ( cat < From: $FROM To: $TO -Subject: bk commit - $VERSION tree ($CHANGESET)${BS}${WL} -X-CSetKey: <$CSETKEY> -$BH -EOF - bk changes -v -r+ - bk cset -r+ -d - ) > $BKROOT/BitKeeper/tmp/dev_public.txt - -$SENDMAIL -t < $BKROOT/BitKeeper/tmp/dev_public.txt - -#++ -# commits@ mail -#-- - echo "Notifying commits list at $COMMITS" - ( - cat < -From: $FROM -To: $COMMITS Subject: bk commit into $VERSION tree ($CHANGESET)$BS X-CSetKey: <$CSETKEY> $BH @@ -98,7 +96,7 @@ see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html EOF bk changes -v -r+ - bk cset -r+ -d + bk rset -r+ -ah | bk gnupatch -h -dup -T ) | bk sed -e ${LIMIT}q > $BKROOT/BitKeeper/tmp/commits.txt $SENDMAIL -t < $BKROOT/BitKeeper/tmp/commits.txt @@ -120,7 +118,7 @@ Subject: bk commit - $VERSION tree (Manual) ($CHANGESET)$BS EOF bk changes -v -r+ - bk cset -r+ -d + bk rset -r+ -ah | bk gnupatch -h -dup -T ) > $BKROOT/BitKeeper/tmp/docs.txt $SENDMAIL -t < $BKROOT/BitKeeper/tmp/docs.txt fi diff --git a/CMakeLists.txt b/CMakeLists.txt index 890ee2676e8..d2a828c1843 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -158,10 +158,10 @@ IF(EMBED_MANIFESTS) 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(tmp_manifest) + ENDIF(NOT tmp_manifest) # Set the processor architecture. IF(CMAKE_GENERATOR MATCHES "Visual Studio 8 2005 Win64") - SET(PROCESSOR_ARCH "X64") + SET(PROCESSOR_ARCH "amd64") ELSE(CMAKE_GENERATOR MATCHES "Visual Studio 8 2005 Win64") SET(PROCESSOR_ARCH "X86") ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 8 2005 Win64") diff --git a/Makefile.am b/Makefile.am index 992a6f6d755..186a3ec2453 100644 --- a/Makefile.am +++ b/Makefile.am @@ -157,6 +157,16 @@ test-bt: @PERL@ ./mysql-test-run.pl --force --comment=funcs1_ps --ps-protocol --suite=funcs_1 -cd mysql-test ; MTR_BUILD_THREAD=auto \ @PERL@ ./mysql-test-run.pl --force --comment=funcs2 --suite=funcs_2 + -cd mysql-test ; MTR_BUILD_THREAD=auto \ + @PERL@ ./mysql-test-run.pl --force --comment=rowlock --suite=row_lock + -if [ -d mysql-test/suite/nist ] ; then \ + cd mysql-test ; MTR_BUILD_THREAD=auto \ + @PERL@ ./mysql-test-run.pl --comment=NIST+normal --force --suite=nist ; \ + fi + -if [ -d mysql-test/suite/nist ] ; then \ + cd mysql-test ; MTR_BUILD_THREAD=auto \ + @PERL@ ./mysql-test-run.pl --comment=NIST+ps --force --suite=nist --ps-protocol ; \ + fi test-bt-debug: -cd mysql-test ; MTR_BUILD_THREAD=auto \ diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index 6e37d02ecd8..8eaa04f8392 100755 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -19,16 +19,53 @@ SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX") # The old Windows build method used renamed (.cc -> .cpp) source files, fails # in #include in mysqlbinlog.cc. So disable that using the USING_CMAKE define. -ADD_DEFINITIONS(-DUSING_CMAKE) -INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include - ${CMAKE_SOURCE_DIR}/zlib - ${CMAKE_SOURCE_DIR}/extra/yassl/include +ADD_DEFINITIONS(-DUSING_CMAKE -DYASSL_PREFIX -DUSE_TLS) + +INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include + ${CMAKE_SOURCE_DIR}/zlib + ${CMAKE_SOURCE_DIR}/extra/yassl/include + ${CMAKE_SOURCE_DIR}/extra/yassl/taocrypt/include + ${CMAKE_SOURCE_DIR}/extra/yassl/taocrypt/mySTL ${CMAKE_SOURCE_DIR}/libmysql ${CMAKE_SOURCE_DIR}/regex ${CMAKE_SOURCE_DIR}/mysys ${CMAKE_SOURCE_DIR}/sql ${CMAKE_SOURCE_DIR}/strings) +SET(YASSL_SOURCES ../extra/yassl/src/buffer.cpp + ../extra/yassl/src/cert_wrapper.cpp + ../extra/yassl/src/crypto_wrapper.cpp + ../extra/yassl/src/handshake.cpp + ../extra/yassl/src/lock.cpp + ../extra/yassl/src/log.cpp + ../extra/yassl/src/socket_wrapper.cpp + ../extra/yassl/src/ssl.cpp + ../extra/yassl/src/timer.cpp + ../extra/yassl/src/yassl_error.cpp + ../extra/yassl/src/yassl_imp.cpp + ../extra/yassl/src/yassl_int.cpp) + +SET(TAOCRYPT_SOURCES ../extra/yassl/taocrypt/src/aes.cpp + ../extra/yassl/taocrypt/src/aestables.cpp + ../extra/yassl/taocrypt/src/algebra.cpp + ../extra/yassl/taocrypt/src/arc4.cpp + ../extra/yassl/taocrypt/src/asn.cpp + ../extra/yassl/taocrypt/src/coding.cpp + ../extra/yassl/taocrypt/src/des.cpp + ../extra/yassl/taocrypt/src/dh.cpp + ../extra/yassl/taocrypt/src/dsa.cpp + ../extra/yassl/taocrypt/src/file.cpp + ../extra/yassl/taocrypt/src/hash.cpp + ../extra/yassl/taocrypt/src/integer.cpp + ../extra/yassl/taocrypt/src/md2.cpp + ../extra/yassl/taocrypt/src/md4.cpp + ../extra/yassl/taocrypt/src/md5.cpp + ../extra/yassl/taocrypt/src/misc.cpp + ../extra/yassl/taocrypt/src/random.cpp + ../extra/yassl/taocrypt/src/ripemd.cpp + ../extra/yassl/taocrypt/src/rsa.cpp + ../extra/yassl/taocrypt/src/sha.cpp) + ADD_LIBRARY(mysqlclient ../mysys/array.c ../strings/bchange.c ../strings/bmove.c ../strings/bmove_upp.c ../mysys/charset-def.c ../mysys/charset.c ../sql-common/client.c ../strings/ctype-big5.c ../strings/ctype-bin.c @@ -63,39 +100,42 @@ ADD_LIBRARY(mysqlclient ../mysys/array.c ../strings/bchange.c ../strings/bmove.c ../strings/strmov.c ../strings/strnlen.c ../strings/strnmov.c ../strings/strtod.c ../strings/strtoll.c ../strings/strtoull.c ../strings/strxmov.c ../strings/strxnmov.c ../mysys/thr_mutex.c ../mysys/typelib.c ../vio/vio.c ../vio/viosocket.c - ../vio/viossl.c ../vio/viosslfactories.c ../strings/xml.c) + ../vio/viossl.c ../vio/viosslfactories.c ../strings/xml.c + ${YASSL_SOURCES} ${TAOCRYPT_SOURCES} + ) + ADD_DEPENDENCIES(mysqlclient GenError) ADD_EXECUTABLE(mysql completion_hash.cc mysql.cc readline.cc sql_string.cc) LINK_DIRECTORIES(${MYSQL_BINARY_DIR}/mysys ${MYSQL_BINARY_DIR}/zlib) -TARGET_LINK_LIBRARIES(mysql mysqlclient mysys yassl taocrypt zlib dbug wsock32) +TARGET_LINK_LIBRARIES(mysql mysqlclient mysys zlib dbug wsock32) ADD_EXECUTABLE(mysqltest mysqltest.c) -TARGET_LINK_LIBRARIES(mysqltest mysqlclient mysys yassl taocrypt zlib dbug regex wsock32) +TARGET_LINK_LIBRARIES(mysqltest mysqlclient mysys zlib dbug regex wsock32) ADD_EXECUTABLE(mysqlcheck mysqlcheck.c) -TARGET_LINK_LIBRARIES(mysqlcheck mysqlclient dbug yassl taocrypt zlib wsock32) +TARGET_LINK_LIBRARIES(mysqlcheck mysqlclient dbug zlib wsock32) ADD_EXECUTABLE(mysqldump mysqldump.c ../sql-common/my_user.c) -TARGET_LINK_LIBRARIES(mysqldump mysqlclient mysys dbug yassl taocrypt zlib wsock32) +TARGET_LINK_LIBRARIES(mysqldump mysqlclient mysys dbug zlib wsock32) ADD_EXECUTABLE(mysqlimport mysqlimport.c) -TARGET_LINK_LIBRARIES(mysqlimport mysqlclient mysys dbug yassl taocrypt zlib wsock32) +TARGET_LINK_LIBRARIES(mysqlimport mysqlclient mysys dbug zlib wsock32) ADD_EXECUTABLE(mysql_upgrade mysql_upgrade.c ../mysys/my_getpagesize.c) -TARGET_LINK_LIBRARIES(mysql_upgrade mysqlclient mysys dbug yassl taocrypt zlib wsock32) +TARGET_LINK_LIBRARIES(mysql_upgrade mysqlclient mysys dbug zlib wsock32) ADD_DEPENDENCIES(mysql_upgrade GenFixPrivs) ADD_EXECUTABLE(mysqlshow mysqlshow.c) -TARGET_LINK_LIBRARIES(mysqlshow mysqlclient mysys dbug yassl taocrypt zlib wsock32) +TARGET_LINK_LIBRARIES(mysqlshow mysqlclient mysys dbug zlib wsock32) ADD_EXECUTABLE(mysqlbinlog mysqlbinlog.cc ../mysys/mf_tempdir.c ../mysys/my_new.cc ../mysys/my_bit.c ../mysys/my_bitmap.c ../mysys/base64.c) -TARGET_LINK_LIBRARIES(mysqlbinlog mysqlclient dbug yassl taocrypt zlib wsock32) +TARGET_LINK_LIBRARIES(mysqlbinlog mysqlclient dbug zlib wsock32) ADD_EXECUTABLE(mysqladmin mysqladmin.cc) -TARGET_LINK_LIBRARIES(mysqladmin mysqlclient mysys dbug yassl taocrypt zlib wsock32) +TARGET_LINK_LIBRARIES(mysqladmin mysqlclient mysys dbug zlib wsock32) ADD_EXECUTABLE(echo echo.c) diff --git a/client/mysqldump.c b/client/mysqldump.c index f1e6a825257..1a024a923f5 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -686,6 +686,18 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), break; case 'T': opt_disable_keys=0; + + if (strlen(argument) >= FN_REFLEN) + { + /* + This check is made because the some the file functions below + have FN_REFLEN sized stack allocated buffers and will cause + a crash even if the input destination buffer is large enough + to hold the output. + */ + die(EX_USAGE, "Input filename too long: %s", argument); + } + break; case '#': DBUG_PUSH(argument ? argument : default_dbug_option); @@ -2324,17 +2336,6 @@ static void dump_table(char *table, char *db) { char filename[FN_REFLEN], tmp_path[FN_REFLEN]; - if (strlen(path) >= FN_REFLEN) - { - /* - This check is made because the some the file functions below - have FN_REFLEN sized stack allocated buffers and will cause - a crash even if the input destination buffer is large enough - to hold the output. - */ - die(EX_USAGE, "Input filename or options too long: %s", path); - } - /* Convert the path to native os format and resolve to the full filepath. @@ -2535,15 +2536,18 @@ static void dump_table(char *table, char *db) plus 2 bytes for '0x' prefix. - In non-HEX mode we need up to 2 bytes per character, plus 2 bytes for leading and trailing '\'' characters. + Also we need to reserve 1 byte for terminating '\0'. */ - dynstr_realloc_checked(&extended_row,length * 2+2); + dynstr_realloc_checked(&extended_row,length * 2 + 2 + 1); if (opt_hex_blob && is_blob) { dynstr_append_checked(&extended_row, "0x"); extended_row.length+= mysql_hex_string(extended_row.str + extended_row.length, row[i], length); - extended_row.str[extended_row.length]= '\0'; + DBUG_ASSERT(extended_row.length+1 <= extended_row.max_length); + /* mysql_hex_string() already terminated string by '\0' */ + DBUG_ASSERT(extended_row.str[extended_row.length] == '\0'); } else { @@ -3268,10 +3272,41 @@ static int do_unlock_tables(MYSQL *mysql_con) return mysql_query_with_error_report(mysql_con, 0, "UNLOCK TABLES"); } - -static int do_reset_master(MYSQL *mysql_con) +static int get_bin_log_name(MYSQL *mysql_con, + char* buff_log_name, uint buff_len) { - return mysql_query_with_error_report(mysql_con, 0, "RESET MASTER"); + MYSQL_RES *res; + MYSQL_ROW row; + + if (mysql_query(mysql_con, "SHOW MASTER STATUS") || + !(res= mysql_store_result(mysql))) + return 1; + + if (!(row= mysql_fetch_row(res))) + { + mysql_free_result(res); + return 1; + } + /* + Only one row is returned, and the first column is the name of the + active log. + */ + strmake(buff_log_name, row[0], buff_len - 1); + + mysql_free_result(res); + return 0; +} + +static int purge_bin_logs_to(MYSQL *mysql_con, char* log_name) +{ + DYNAMIC_STRING str; + int err; + init_dynamic_string_checked(&str, "PURGE BINARY LOGS TO '", 1024, 1024); + dynstr_append_checked(&str, log_name); + dynstr_append_checked(&str, "'"); + err = mysql_query_with_error_report(mysql_con, 0, str.str); + dynstr_free(&str); + return err; } @@ -3795,6 +3830,7 @@ static void dynstr_realloc_checked(DYNAMIC_STRING *str, ulong additional_size) int main(int argc, char **argv) { + char bin_log_name[FN_REFLEN]; int exit_code; MY_INIT("mysqldump"); @@ -3831,8 +3867,13 @@ int main(int argc, char **argv) goto err; if (opt_single_transaction && start_transaction(mysql)) goto err; - if (opt_delete_master_logs && do_reset_master(mysql)) - goto err; + if (opt_delete_master_logs) + { + if (mysql_refresh(mysql, REFRESH_LOG) || + get_bin_log_name(mysql, bin_log_name, sizeof(bin_log_name))) + goto err; + flush_logs= 0; + } if (opt_lock_all_tables || opt_master_data) { if (flush_logs && mysql_refresh(mysql, REFRESH_LOG)) @@ -3856,6 +3897,18 @@ int main(int argc, char **argv) /* One or more databases, all tables */ dump_databases(argv); } + + /* ensure dumped data flushed */ + if (md_result_file && fflush(md_result_file)) + { + if (!first_error) + first_error= EX_MYSQLERR; + goto err; + } + /* everything successful, purge the old logs files */ + if (opt_delete_master_logs && purge_bin_logs_to(mysql, bin_log_name)) + goto err; + #ifdef HAVE_SMEM my_free(shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR)); #endif diff --git a/client/mysqltest.c b/client/mysqltest.c index 5640d0c24ba..d1ec753b54b 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -280,6 +280,7 @@ enum enum_commands { Q_REPLACE_REGEX, Q_REMOVE_FILE, Q_FILE_EXIST, Q_WRITE_FILE, Q_COPY_FILE, Q_PERL, Q_DIE, Q_EXIT, Q_SKIP, Q_CHMOD_FILE, Q_APPEND_FILE, Q_CAT_FILE, Q_DIFF_FILES, + Q_SEND_QUIT, Q_UNKNOWN, /* Unknown command. */ Q_COMMENT, /* Comments, ignored. */ @@ -367,6 +368,7 @@ const char *command_names[]= "append_file", "cat_file", "diff_files", + "send_quit", 0 }; @@ -496,6 +498,10 @@ void handle_error(struct st_command*, void handle_no_error(struct st_command*); #ifdef EMBEDDED_LIBRARY + +/* attributes of the query thread */ +pthread_attr_t cn_thd_attrib; + /* send_one_query executes query in separate thread what is necessary in embedded library to run 'send' in proper way. @@ -534,7 +540,7 @@ static int do_send_query(struct st_connection *cn, const char *q, int q_len, cn->cur_query= q; cn->cur_query_len= q_len; cn->query_done= 0; - if (pthread_create(&tid, NULL, send_one_query, (void*)cn)) + if (pthread_create(&tid, &cn_thd_attrib, send_one_query, (void*)cn)) die("Cannot start new thread for query"); return 0; @@ -1143,6 +1149,50 @@ void check_require(DYNAMIC_STRING* ds, const char *fname) } +/* + Remove surrounding chars from string + + Return 1 if first character is found but not last +*/ +static int strip_surrounding(char* str, char c1, char c2) +{ + char* ptr= str; + + /* Check if the first non space character is c1 */ + while(*ptr && my_isspace(charset_info, *ptr)) + ptr++; + if (*ptr == c1) + { + /* Replace it with a space */ + *ptr= ' '; + + /* Last non space charecter should be c2 */ + ptr= strend(str)-1; + while(*ptr && my_isspace(charset_info, *ptr)) + ptr--; + if (*ptr == c2) + { + /* Replace it with \0 */ + *ptr= 0; + } + else + { + /* Mismatch detected */ + return 1; + } + } + return 0; +} + + +static void strip_parentheses(struct st_command *command) +{ + if (strip_surrounding(command->first_argument, '(', ')')) + die("%.*s - argument list started with '%c' must be ended with '%c'", + command->first_word_len, command->query, '(', ')'); +} + + static byte *get_var_key(const byte* var, uint* len, my_bool __attribute__((unused)) t) { @@ -1398,12 +1448,11 @@ void var_query_set(VAR *var, const char *query, const char** query_end) init_dynamic_string(&ds_query, 0, (end - query) + 32, 256); do_eval(&ds_query, query, end, FALSE); - if (mysql_real_query(mysql, ds_query.str, ds_query.length) || - !(res = mysql_store_result(mysql))) - { + if (mysql_real_query(mysql, ds_query.str, ds_query.length)) die("Error running query '%s': %d %s", ds_query.str, mysql_errno(mysql), mysql_error(mysql)); - } + if (!(res= mysql_store_result(mysql))) + die("Query '%s' didn't return a result set", ds_query.str); dynstr_free(&ds_query); if ((row = mysql_fetch_row(res)) && row[0]) @@ -1457,6 +1506,130 @@ void var_query_set(VAR *var, const char *query, const char** query_end) } +/* + Set variable from the result of a field in a query + + This function is useful when checking for a certain value + in the output from a query that can't be restricted to only + return some values. A very good example of that is most SHOW + commands. + + SYNOPSIS + var_set_query_get_value() + + DESCRIPTION + let $variable= query_get_value(,,); + + - The query that should be sent to the server + - Name of the column that holds the field be compared + against the expected value + - Number of the row that holds the field to be + compared against the expected value + +*/ + +void var_set_query_get_value(struct st_command *command, VAR *var) +{ + ulong row_no; + int col_no= -1; + MYSQL_RES* res; + MYSQL* mysql= &cur_con->mysql; + + static DYNAMIC_STRING ds_query; + static DYNAMIC_STRING ds_col; + static DYNAMIC_STRING ds_row; + const struct command_arg query_get_value_args[] = { + "query", ARG_STRING, TRUE, &ds_query, "Query to run", + "column name", ARG_STRING, TRUE, &ds_col, "Name of column", + "row number", ARG_STRING, TRUE, &ds_row, "Number for row", + }; + + DBUG_ENTER("var_set_query_get_value"); + LINT_INIT(res); + + strip_parentheses(command); + DBUG_PRINT("info", ("query: %s", command->query)); + check_command_args(command, command->first_argument, query_get_value_args, + sizeof(query_get_value_args)/sizeof(struct command_arg), + ','); + + DBUG_PRINT("info", ("query: %s", ds_query.str)); + DBUG_PRINT("info", ("col: %s", ds_col.str)); + + /* Convert row number to int */ + if (!str2int(ds_row.str, 10, (long) 0, (long) INT_MAX, &row_no)) + die("Invalid row number: '%s'", ds_row.str); + DBUG_PRINT("info", ("row: %s, row_no: %ld", ds_row.str, row_no)); + dynstr_free(&ds_row); + + /* Remove any surrounding "'s from the query - if there is any */ + if (strip_surrounding(ds_query.str, '"', '"')) + die("Mismatched \"'s around query '%s'", ds_query.str); + + /* Run the query */ + if (mysql_real_query(mysql, ds_query.str, ds_query.length)) + die("Error running query '%s': %d %s", ds_query.str, + mysql_errno(mysql), mysql_error(mysql)); + if (!(res= mysql_store_result(mysql))) + die("Query '%s' didn't return a result set", ds_query.str); + + { + /* Find column number from the given column name */ + uint i; + uint num_fields= mysql_num_fields(res); + MYSQL_FIELD *fields= mysql_fetch_fields(res); + + for (i= 0; i < num_fields; i++) + { + if (strcmp(fields[i].name, ds_col.str) == 0 && + strlen(fields[i].name) == ds_col.length) + { + col_no= i; + break; + } + } + if (col_no == -1) + { + mysql_free_result(res); + die("Could not find column '%s' in the result of '%s'", + ds_col.str, ds_query.str); + } + DBUG_PRINT("info", ("Found column %d with name '%s'", + i, fields[i].name)); + } + dynstr_free(&ds_col); + + { + /* Get the value */ + MYSQL_ROW row; + ulong rows= 0; + const char* value= "No such row"; + + while ((row= mysql_fetch_row(res))) + { + if (++rows == row_no) + { + + DBUG_PRINT("info", ("At row %ld, column %d is '%s'", + row_no, col_no, row[col_no])); + /* Found the row to get */ + if (row[col_no]) + value= row[col_no]; + else + value= "NULL"; + + break; + } + } + eval_expr(var, value, 0); + } + dynstr_free(&ds_query); + mysql_free_result(res); + + DBUG_VOID_RETURN; +} + + void var_copy(VAR *dest, VAR *src) { dest->int_val= src->int_val; @@ -1480,26 +1653,47 @@ void var_copy(VAR *dest, VAR *src) void eval_expr(VAR *v, const char *p, const char **p_end) { - static int MIN_VAR_ALLOC= 32; /* MASV why 32? */ - VAR *vp; + + DBUG_ENTER("eval_expr"); + DBUG_PRINT("enter", ("p: '%s'", p)); + if (*p == '$') { + VAR *vp; if ((vp= var_get(p, p_end, 0, 0))) - { var_copy(v, vp); - return; - } + DBUG_VOID_RETURN; } - else if (*p == '`') + + if (*p == '`') { var_query_set(v, p, p_end); + DBUG_VOID_RETURN; } - else + + { + /* Check if this is a "let $var= query_get_value()" */ + const char* get_value_str= "query_get_value"; + const size_t len= strlen(get_value_str); + if (strncmp(p, get_value_str, len)==0) + { + struct st_command command; + memset(&command, 0, sizeof(command)); + command.query= (char*)p; + command.first_word_len= len; + command.first_argument= command.query + len; + command.end= (char*)*p_end; + var_set_query_get_value(&command, v); + DBUG_VOID_RETURN; + } + } + { int new_val_len = (p_end && *p_end) ? (int) (*p_end - p) : (int) strlen(p); if (new_val_len + 1 >= v->alloced_len) { + static int MIN_VAR_ALLOC= 32; v->alloced_len = (new_val_len < MIN_VAR_ALLOC - 1) ? MIN_VAR_ALLOC : new_val_len + 1; if (!(v->str_val = @@ -1512,9 +1706,10 @@ void eval_expr(VAR *v, const char *p, const char **p_end) memcpy(v->str_val, p, new_val_len); v->str_val[new_val_len] = 0; v->int_val=atoi(p); + DBUG_PRINT("info", ("atoi on '%s', returns: %d", p, v->int_val)); v->int_dirty=0; } - return; + DBUG_VOID_RETURN; } @@ -2362,6 +2557,48 @@ void do_diff_files(struct st_command *command) DBUG_VOID_RETURN; } + /* + SYNOPSIS + do_send_quit + command called command + + DESCRIPTION + Sends a simple quit command to the server for the named connection. + + */ + +void do_send_quit(struct st_command *command) +{ + char *p= command->first_argument, *name; + struct st_connection *con; + + DBUG_ENTER("do_send_quit"); + DBUG_PRINT("enter",("name: '%s'",p)); + + if (!*p) + die("Missing connection name in do_send_quit"); + name= p; + while (*p && !my_isspace(charset_info,*p)) + p++; + + if (*p) + *p++= 0; + command->last_argument= p; + + /* Loop through connection pool for connection to close */ + for (con= connections; con < next_con; con++) + { + DBUG_PRINT("info", ("con->name: %s", con->name)); + if (!strcmp(con->name, name)) + { + simple_command(&con->mysql,COM_QUIT,NullS,0,1); + DBUG_VOID_RETURN; + } + } + die("connection '%s' not found in connection pool", name); +} + + /* SYNOPSIS do_perl @@ -3271,11 +3508,10 @@ void do_close_connection(struct st_command *command) my_free(con->name, MYF(0)); /* - When the connection is closed set name to "closed_connection" + When the connection is closed set name to "-closed_connection-" to make it possible to reuse the connection name. - The connection slot will not be reused */ - if (!(con->name = my_strdup("closed_connection", MYF(MY_WME)))) + if (!(con->name = my_strdup("-closed_connection-", MYF(MY_WME)))) die("Out of memory"); DBUG_VOID_RETURN; @@ -3453,7 +3689,7 @@ void do_connect(struct st_command *command) int con_port= opt_port; char *con_options; bool con_ssl= 0, con_compress= 0; - char *ptr; + struct st_connection* con_slot; static DYNAMIC_STRING ds_connection_name; static DYNAMIC_STRING ds_host; @@ -3481,20 +3717,7 @@ void do_connect(struct st_command *command) DBUG_ENTER("do_connect"); DBUG_PRINT("enter",("connect: %s", command->first_argument)); - /* Remove parenteses around connect arguments */ - if ((ptr= strstr(command->first_argument, "("))) - { - /* Replace it with a space */ - *ptr= ' '; - if ((ptr= strstr(command->first_argument, ")"))) - { - /* Replace it with \0 */ - *ptr= 0; - } - else - die("connect - argument list started with '(' must be ended with ')'"); - } - + strip_parentheses(command); check_command_args(command, command->first_argument, connect_args, sizeof(connect_args)/sizeof(struct command_arg), ','); @@ -3552,19 +3775,24 @@ void do_connect(struct st_command *command) con_options= end; } - if (next_con == connections_end) - die("Connection limit exhausted, you can have max %d connections", - (int) (sizeof(connections)/sizeof(struct st_connection))); - if (find_connection_by_name(ds_connection_name.str)) die("Connection %s already exists", ds_connection_name.str); + + if (next_con != connections_end) + con_slot= next_con; + else + { + if (!(con_slot= find_connection_by_name("-closed_connection-"))) + die("Connection limit exhausted, you can have max %d connections", + (int) (sizeof(connections)/sizeof(struct st_connection))); + } - if (!mysql_init(&next_con->mysql)) + if (!mysql_init(&con_slot->mysql)) die("Failed on mysql_init()"); if (opt_compress || con_compress) - mysql_options(&next_con->mysql, MYSQL_OPT_COMPRESS, NullS); - mysql_options(&next_con->mysql, MYSQL_OPT_LOCAL_INFILE, 0); - mysql_options(&next_con->mysql, MYSQL_SET_CHARSET_NAME, + mysql_options(&con_slot->mysql, MYSQL_OPT_COMPRESS, NullS); + mysql_options(&con_slot->mysql, MYSQL_OPT_LOCAL_INFILE, 0); + mysql_options(&con_slot->mysql, MYSQL_SET_CHARSET_NAME, charset_info->csname); if (opt_charsets_dir) mysql_options(&cur_con->mysql, MYSQL_SET_CHARSET_DIR, @@ -3573,12 +3801,12 @@ void do_connect(struct st_command *command) #ifdef HAVE_OPENSSL if (opt_use_ssl || con_ssl) { - mysql_ssl_set(&next_con->mysql, opt_ssl_key, opt_ssl_cert, opt_ssl_ca, + mysql_ssl_set(&con_slot->mysql, opt_ssl_key, opt_ssl_cert, opt_ssl_ca, opt_ssl_capath, opt_ssl_cipher); #if MYSQL_VERSION_ID >= 50000 /* Turn on ssl_verify_server_cert only if host is "localhost" */ opt_ssl_verify_server_cert= !strcmp(ds_host.str, "localhost"); - mysql_options(&next_con->mysql, MYSQL_OPT_SSL_VERIFY_SERVER_CERT, + mysql_options(&con_slot->mysql, MYSQL_OPT_SSL_VERIFY_SERVER_CERT, &opt_ssl_verify_server_cert); #endif } @@ -3592,16 +3820,19 @@ void do_connect(struct st_command *command) if (ds_database.length && !strcmp(ds_database.str,"*NO-ONE*")) dynstr_set(&ds_database, ""); - if (connect_n_handle_errors(command, &next_con->mysql, + if (connect_n_handle_errors(command, &con_slot->mysql, ds_host.str,ds_user.str, ds_password.str, ds_database.str, con_port, ds_sock.str)) { DBUG_PRINT("info", ("Inserting connection %s in connection pool", ds_connection_name.str)); - if (!(next_con->name= my_strdup(ds_connection_name.str, MYF(MY_WME)))) + if (!(con_slot->name= my_strdup(ds_connection_name.str, MYF(MY_WME)))) die("Out of memory"); - cur_con= next_con++; + cur_con= con_slot; + + if (con_slot == next_con) + next_con++; /* if we used the next_con slot, advance the pointer */ } dynstr_free(&ds_connection_name); @@ -4192,16 +4423,12 @@ int read_command(struct st_command** command_ptr) DBUG_RETURN(0); } if (!(*command_ptr= command= - (struct st_command*) my_malloc(sizeof(*command), MYF(MY_WME))) || + (struct st_command*) my_malloc(sizeof(*command), + MYF(MY_WME|MY_ZEROFILL))) || insert_dynamic(&q_lines, (gptr) &command)) die(NullS); - - command->require_file[0]= 0; - command->first_word_len= 0; - command->query_len= 0; - command->type= Q_UNKNOWN; - command->query_buf= command->query= 0; + read_command_buf[0]= 0; if (read_line(read_command_buf, sizeof(read_command_buf))) { @@ -5999,6 +6226,12 @@ int main(int argc, char **argv) next_con= connections + 1; cur_con= connections; +#ifdef EMBEDDED_LIBRARY + /* set appropriate stack for the 'query' threads */ + (void) pthread_attr_init(&cn_thd_attrib); + pthread_attr_setstacksize(&cn_thd_attrib, DEFAULT_THREAD_STACK); +#endif /*EMBEDDED_LIBRARY*/ + /* Init file stack */ memset(file_stack, 0, sizeof(file_stack)); file_stack_end= @@ -6168,6 +6401,7 @@ int main(int argc, char **argv) case Q_WRITE_FILE: do_write_file(command); break; case Q_APPEND_FILE: do_append_file(command); break; case Q_DIFF_FILES: do_diff_files(command); break; + case Q_SEND_QUIT: do_send_quit(command); break; case Q_CAT_FILE: do_cat_file(command); break; case Q_COPY_FILE: do_copy_file(command); break; case Q_CHMOD_FILE: do_chmod_file(command); break; diff --git a/cmd-line-utils/libedit/el_term.h b/cmd-line-utils/libedit/el_term.h index 9e5588ee96f..00ca48e38e2 100644 --- a/cmd-line-utils/libedit/el_term.h +++ b/cmd-line-utils/libedit/el_term.h @@ -90,6 +90,16 @@ extern char* tgoto(const char*, int, int); extern char* tgetstr(char*, char**); #endif + +#if !HAVE_DECL_TGOTO +/* + 'tgoto' is not declared in the system header files, this causes + problems on 64-bit systems. The function returns a 64 bit pointer + but caller see it as "int" and it's thus truncated to 32-bit +*/ +extern char* tgoto(const char*, int, int); +#endif + protected void term_move_to_line(EditLine *, int); protected void term_move_to_char(EditLine *, int); protected void term_clear_EOL(EditLine *, int); diff --git a/configure.in b/configure.in index 989aa978690..5f02b5eae63 100644 --- a/configure.in +++ b/configure.in @@ -7,7 +7,7 @@ AC_INIT(sql/mysqld.cc) AC_CANONICAL_SYSTEM # The Docs Makefile.am parses this line! # remember to also change ndb version below and update version.c in ndb -AM_INIT_AUTOMAKE(mysql, 5.0.44) +AM_INIT_AUTOMAKE(mysql, 5.0.46) AM_CONFIG_HEADER(config.h) PROTOCOL_VERSION=10 @@ -23,7 +23,7 @@ NDB_SHARED_LIB_VERSION=$NDB_SHARED_LIB_MAJOR_VERSION:0:0 # ndb version NDB_VERSION_MAJOR=5 NDB_VERSION_MINOR=0 -NDB_VERSION_BUILD=44 +NDB_VERSION_BUILD=46 NDB_VERSION_STATUS="" # Set all version vars based on $VERSION. How do we do this more elegant ? @@ -507,7 +507,7 @@ then FIND_PROC="$PS \$\$PID | grep -v grep | grep \$\$MYSQLD > /dev/null" else case $SYSTEM_TYPE in - *freebsd*) + *freebsd*|*dragonfly*) FIND_PROC="$PS p \$\$PID | grep -v grep | grep \$\$MYSQLD > /dev/null" ;; *darwin*) @@ -776,6 +776,7 @@ AC_CHECK_HEADERS(fcntl.h float.h floatingpoint.h ieeefp.h limits.h \ sys/timeb.h sys/types.h sys/un.h sys/vadvise.h sys/wait.h term.h \ unistd.h utime.h sys/utime.h termio.h termios.h sched.h crypt.h alloca.h \ sys/ioctl.h malloc.h sys/malloc.h sys/ipc.h sys/shm.h linux/config.h \ + sys/prctl.h \ sys/resource.h sys/param.h) #-------------------------------------------------------------------- @@ -1127,7 +1128,7 @@ case $SYSTEM_TYPE in MAX_C_OPTIMIZE="-O" fi ;; - *freebsd*) + *freebsd*|*dragonfly*) AC_MSG_WARN([Adding fix for interrupted reads]) OSVERSION=`sysctl -a | grep osreldate | awk '{ print $2 }'` if test "$OSVERSION" -gt "480100" && \ @@ -1736,6 +1737,12 @@ AC_ARG_WITH(client-ldflags, [CLIENT_EXTRA_LDFLAGS=]) AC_SUBST(CLIENT_EXTRA_LDFLAGS) +AC_ARG_WITH(mysqld-libs, + [ --with-mysqld-libs Extra libraries to link with for mysqld], + [MYSQLD_EXTRA_LIBS=$withval], + [MYSQLD_EXTRA_LIBS=]) +AC_SUBST(MYSQLD_EXTRA_LIBS) + AC_ARG_WITH(lib-ccflags, [ --with-lib-ccflags Extra CC options for libraries], [LIB_EXTRA_CCFLAGS=$withval], @@ -1946,6 +1953,19 @@ else fi AC_SUBST(TERMCAP_LIB) +# Check if the termcap function 'tgoto' is already declared in +# system header files or if it need to be declared locally +AC_CHECK_DECLS(tgoto,,,[ +#ifdef HAVE_CURSES_H +# include +#elif HAVE_NCURSES_H +# include +#endif +#ifdef HAVE_TERM_H +# include +#endif +]) + LIBEDIT_LOBJECTS="" AC_CHECK_FUNC(strunvis, ,[LIBEDIT_LOBJECTS="$LIBEDIT_LOBJECTS unvis.o"]) AC_CHECK_FUNC(strvis, ,[LIBEDIT_LOBJECTS="$LIBEDIT_LOBJECTS vis.o"]) diff --git a/extra/yassl/include/openssl/ssl.h b/extra/yassl/include/openssl/ssl.h index 7dd33e3fcad..efd0dec75b6 100644 --- a/extra/yassl/include/openssl/ssl.h +++ b/extra/yassl/include/openssl/ssl.h @@ -277,6 +277,8 @@ int SSL_session_reused(SSL*); int SSL_set_rfd(SSL*, int); int SSL_set_wfd(SSL*, int); void SSL_set_shutdown(SSL*, int); +void SSL_set_quiet_shutdown(SSL *ssl,int mode); +int SSL_get_quiet_shutdown(SSL *ssl); int SSL_want_read(SSL*); int SSL_want_write(SSL*); diff --git a/extra/yassl/include/yassl_int.hpp b/extra/yassl/include/yassl_int.hpp index 94cb85c3300..b7bd35f5fa2 100644 --- a/extra/yassl/include/yassl_int.hpp +++ b/extra/yassl/include/yassl_int.hpp @@ -584,6 +584,7 @@ class SSL { Socket socket_; // socket wrapper Buffers buffers_; // buffered handshakes and data Log log_; // logger + bool quietShutdown_; // shutdown without handshakes // optimization variables bool has_data_; // buffered data ready? @@ -610,6 +611,7 @@ public: Buffers& useBuffers(); bool HasData() const; + bool GetQuietShutdown() const; // sets void set_pending(Cipher suite); @@ -621,6 +623,7 @@ public: void SetError(YasslError); int SetCompression(); void UnSetCompression(); + void SetQuietShutdown(bool mode); // helpers bool isTLS() const; diff --git a/extra/yassl/src/ssl.cpp b/extra/yassl/src/ssl.cpp index 86dfa1c6ebd..c3d580a93ab 100644 --- a/extra/yassl/src/ssl.cpp +++ b/extra/yassl/src/ssl.cpp @@ -411,8 +411,10 @@ int SSL_clear(SSL* ssl) int SSL_shutdown(SSL* ssl) { - Alert alert(warning, close_notify); - sendAlert(*ssl, alert); + if (!ssl->GetQuietShutdown()) { + Alert alert(warning, close_notify); + sendAlert(*ssl, alert); + } ssl->useLog().ShowTCP(ssl->getSocket().get_fd(), true); GetErrors().Remove(); @@ -421,6 +423,18 @@ int SSL_shutdown(SSL* ssl) } +void SSL_set_quiet_shutdown(SSL *ssl,int mode) +{ + ssl->SetQuietShutdown(mode != 0); +} + + +int SSL_get_quiet_shutdown(SSL *ssl) +{ + return ssl->GetQuietShutdown(); +} + + /* on by default but allow user to turn off */ long SSL_CTX_set_session_cache_mode(SSL_CTX* ctx, long mode) { diff --git a/extra/yassl/src/yassl_int.cpp b/extra/yassl/src/yassl_int.cpp index ae16abf9e49..f5ab2f200a5 100644 --- a/extra/yassl/src/yassl_int.cpp +++ b/extra/yassl/src/yassl_int.cpp @@ -291,7 +291,7 @@ const ClientKeyFactory& sslFactory::getClientKey() const SSL::SSL(SSL_CTX* ctx) : secure_(ctx->getMethod()->getVersion(), crypto_.use_random(), ctx->getMethod()->getSide(), ctx->GetCiphers(), ctx, - ctx->GetDH_Parms().set_), has_data_(false) + ctx->GetDH_Parms().set_), quietShutdown_(false), has_data_(false) { if (int err = crypto_.get_random().GetError()) { SetError(YasslError(err)); @@ -773,6 +773,12 @@ void SSL::SetError(YasslError ye) // TODO: add string here } +// set the quiet shutdown mode (close_nofiy not sent or received on shutdown) +void SSL::SetQuietShutdown(bool mode) +{ + quietShutdown_ = mode; +} + Buffers& SSL::useBuffers() { @@ -1330,6 +1336,12 @@ YasslError SSL::GetError() const } +bool SSL::GetQuietShutdown() const +{ + return quietShutdown_; +} + + bool SSL::GetMultiProtocol() const { return secure_.GetContext()->getMethod()->multipleProtocol(); diff --git a/heap/hp_hash.c b/heap/hp_hash.c index c5a30a3ef65..d8eee9c794c 100644 --- a/heap/hp_hash.c +++ b/heap/hp_hash.c @@ -379,7 +379,13 @@ ulong hp_rec_hashnr(register HP_KEYDEF *keydef, register const byte *rec) ulong hp_hashnr(register HP_KEYDEF *keydef, register const byte *key) { - register ulong nr=0; + /* + Note, if a key consists of a combination of numeric and + a text columns, it most likely won't work well. + Making text columns work with NEW_HASH_FUNCTION + needs also changes in strings/ctype-xxx.c. + */ + ulong nr= 1, nr2= 4; HA_KEYSEG *seg,*endseg; for (seg=keydef->seg,endseg=seg+keydef->keysegs ; seg < endseg ; seg++) @@ -401,14 +407,15 @@ ulong hp_hashnr(register HP_KEYDEF *keydef, register const byte *key) } if (seg->type == HA_KEYTYPE_TEXT) { - seg->charset->hash_sort(seg->charset,pos,((uchar*)key)-pos,&nr,NULL); + seg->charset->coll->hash_sort(seg->charset, pos, ((uchar*)key)-pos, + &nr, &nr2); } else if (seg->type == HA_KEYTYPE_VARTEXT1) /* Any VARCHAR segments */ { uint pack_length= 2; /* Key packing is constant */ uint length= uint2korr(pos); - seg->charset->hash_sort(seg->charset, pos+pack_length, length, &nr, - NULL); + seg->charset->coll->hash_sort(seg->charset, pos+pack_length, length, + &nr, &nr2); key+= pack_length; } else @@ -428,7 +435,7 @@ ulong hp_hashnr(register HP_KEYDEF *keydef, register const byte *key) ulong hp_rec_hashnr(register HP_KEYDEF *keydef, register const byte *rec) { - register ulong nr=0; + ulong nr= 1, nr2= 4; HA_KEYSEG *seg,*endseg; for (seg=keydef->seg,endseg=seg+keydef->keysegs ; seg < endseg ; seg++) @@ -444,14 +451,16 @@ ulong hp_rec_hashnr(register HP_KEYDEF *keydef, register const byte *rec) } if (seg->type == HA_KEYTYPE_TEXT) { - seg->charset->hash_sort(seg->charset,pos,((uchar*)key)-pos,&nr,NULL); + uint char_length= seg->length; /* TODO: fix to use my_charpos() */ + seg->charset->coll->hash_sort(seg->charset, pos, char_length, + &nr, &nr2); } else if (seg->type == HA_KEYTYPE_VARTEXT1) /* Any VARCHAR segments */ { uint pack_length= seg->bit_start; uint length= (pack_length == 1 ? (uint) *(uchar*) pos : uint2korr(pos)); - seg->charset->hash_sort(seg->charset, pos+pack_length, - length, &nr, NULL); + seg->charset->coll->hash_sort(seg->charset, pos+pack_length, + length, &nr, &nr2); } else { diff --git a/include/keycache.h b/include/keycache.h index dc763b8cc08..54c099fc474 100644 --- a/include/keycache.h +++ b/include/keycache.h @@ -46,7 +46,6 @@ typedef struct st_key_cache my_bool key_cache_inited; my_bool resize_in_flush; /* true during flush of resize operation */ my_bool can_be_used; /* usage of cache for read/write is allowed */ - uint key_cache_shift; ulong key_cache_mem_size; /* specified size of the cache memory */ uint key_cache_block_size; /* size of the page buffer of a cache block */ ulong min_warm_blocks; /* min number of warm blocks; */ diff --git a/include/m_ctype.h b/include/m_ctype.h index f33fd015733..9f21ac16a05 100644 --- a/include/m_ctype.h +++ b/include/m_ctype.h @@ -281,10 +281,11 @@ extern CHARSET_INFO my_charset_tis620_thai_ci; extern CHARSET_INFO my_charset_tis620_bin; extern CHARSET_INFO my_charset_ucs2_general_ci; extern CHARSET_INFO my_charset_ucs2_bin; -extern CHARSET_INFO my_charset_ucs2_general_uca; +extern CHARSET_INFO my_charset_ucs2_unicode_ci; extern CHARSET_INFO my_charset_ujis_japanese_ci; extern CHARSET_INFO my_charset_ujis_bin; extern CHARSET_INFO my_charset_utf8_general_ci; +extern CHARSET_INFO my_charset_utf8_unicode_ci; extern CHARSET_INFO my_charset_utf8_bin; extern CHARSET_INFO my_charset_cp1250_czech_ci; diff --git a/include/m_string.h b/include/m_string.h index 349084ab21e..981111b8718 100644 --- a/include/m_string.h +++ b/include/m_string.h @@ -105,6 +105,9 @@ extern char *stpcpy(char *, const char *); /* For AIX with gcc 2.95.3 */ extern char NEAR _dig_vec_upper[]; extern char NEAR _dig_vec_lower[]; +/* Defined in strtod.c */ +extern const double log_10[309]; + #ifdef BAD_STRING_COMPILER #define strmov(A,B) (memccpy(A,B,0,INT_MAX)-1) #else diff --git a/include/my_base.h b/include/my_base.h index d07a4de8e6a..4ce7a87105d 100644 --- a/include/my_base.h +++ b/include/my_base.h @@ -168,7 +168,12 @@ enum ha_extra_function { These flags are reset by the handler::extra(HA_EXTRA_RESET) call. */ HA_EXTRA_DELETE_CANNOT_BATCH, - HA_EXTRA_UPDATE_CANNOT_BATCH + HA_EXTRA_UPDATE_CANNOT_BATCH, + /* + Inform handler that an "INSERT...ON DUPLICATE KEY UPDATE" will be + executed. This condition is unset by HA_EXTRA_NO_IGNORE_DUP_KEY. + */ + HA_EXTRA_INSERT_WITH_UPDATE }; /* The following is parameter to ha_panic() */ diff --git a/include/my_global.h b/include/my_global.h index f32a987ffb1..81dde581237 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -895,7 +895,12 @@ typedef unsigned long uint32; /* Short for unsigned integer >= 32 bits */ typedef unsigned long ulong; /* Short for unsigned long */ #endif #ifndef longlong_defined -#if defined(HAVE_LONG_LONG) && SIZEOF_LONG != 8 +/* + Using [unsigned] long long is preferable as [u]longlong because we use + [unsigned] long long unconditionally in many places, + for example in constants with [U]LL suffix. +*/ +#if defined(HAVE_LONG_LONG) && SIZEOF_LONG_LONG == 8 typedef unsigned long long int ulonglong; /* ulong or unsigned long long */ typedef long long int longlong; #else diff --git a/include/mysql_com.h b/include/mysql_com.h index 93409b2ea1d..889579e3622 100644 --- a/include/mysql_com.h +++ b/include/mysql_com.h @@ -345,6 +345,11 @@ my_bool net_write_command(NET *net,unsigned char command, int net_real_write(NET *net,const char *packet,unsigned long len); unsigned long my_net_read(NET *net); +#ifdef _global_h +void my_net_set_write_timeout(NET *net, uint timeout); +void my_net_set_read_timeout(NET *net, uint timeout); +#endif + /* The following function is not meant for normal usage Currently it's used internally by manager.c diff --git a/include/thr_lock.h b/include/thr_lock.h index 966522fe3e3..aa5eb7426ae 100644 --- a/include/thr_lock.h +++ b/include/thr_lock.h @@ -54,6 +54,11 @@ enum thr_lock_type { TL_IGNORE=-1, TL_WRITE_CONCURRENT_INSERT, /* Write used by INSERT DELAYED. Allows READ locks */ TL_WRITE_DELAYED, + /* + parser only! Late bound low_priority flag. + At open_tables() becomes thd->update_lock_default. + */ + TL_WRITE_DEFAULT, /* WRITE lock that has lower priority than TL_READ */ TL_WRITE_LOW_PRIORITY, /* Normal WRITE lock */ diff --git a/include/violite.h b/include/violite.h index 63388c170c9..7b57667541a 100644 --- a/include/violite.h +++ b/include/violite.h @@ -88,7 +88,6 @@ my_bool vio_peer_addr(Vio* vio, char *buf, uint16 *port); /* Remotes in_addr */ void vio_in_addr(Vio *vio, struct in_addr *in); my_bool vio_poll_read(Vio *vio,uint timeout); -void vio_timeout(Vio *vio,uint which, uint timeout); #ifdef HAVE_OPENSSL #include @@ -101,7 +100,9 @@ void vio_timeout(Vio *vio,uint which, uint timeout); #define HEADER_DES_LOCL_H dummy_something #define YASSL_MYSQL_COMPATIBLE +#ifndef YASSL_PREFIX #define YASSL_PREFIX +#endif /* Set yaSSL to use same type as MySQL do for socket handles */ typedef my_socket YASSL_SOCKET_T; #define YASSL_SOCKET_T_DEFINED diff --git a/innobase/btr/btr0btr.c b/innobase/btr/btr0btr.c index 07bc04feae6..a339405372d 100644 --- a/innobase/btr/btr0btr.c +++ b/innobase/btr/btr0btr.c @@ -2542,8 +2542,11 @@ btr_index_rec_validate( rec_get_nth_field(rec, offsets, i, &len); - /* Note that prefix indexes are not fixed size even when - their type is CHAR. */ + /* Note that if fixed_size != 0, it equals the + length of a fixed-size column in the clustered index. + A prefix index of the column is of fixed, but different + length. When fixed_size == 0, prefix_len is the maximum + length of the prefix index column. */ if ((dict_index_get_nth_field(index, i)->prefix_len == 0 && len != UNIV_SQL_NULL && fixed_size diff --git a/innobase/buf/buf0buf.c b/innobase/buf/buf0buf.c index f24f1744363..9df48495355 100644 --- a/innobase/buf/buf0buf.c +++ b/innobase/buf/buf0buf.c @@ -1220,7 +1220,8 @@ loop: ut_ad(buf_validate()); } #endif - ut_ad(block->buf_fix_count > 0); + /* This debug code has been upgraded to narrow down Bug# 26081 */ + ut_a(block->buf_fix_count > 0); ut_ad(block->state == BUF_BLOCK_FILE_PAGE); if (mode == BUF_GET_NOWAIT) { @@ -1238,6 +1239,13 @@ loop: if (!success) { mutex_enter(&block->mutex); + /* This debug code has been added to narrow + down Bug# 26081 */ + if (UNIV_UNLIKELY(block->buf_fix_count == 0)) { + buf_print_diagnostic(mtr, block); + ut_error; + } + block->buf_fix_count--; mutex_exit(&block->mutex); @@ -1362,7 +1370,14 @@ buf_page_optimistic_get_func( if (UNIV_UNLIKELY(!success)) { mutex_enter(&block->mutex); - + + /* This debug code has been added to narrow + down Bug# 26081 */ + if (UNIV_UNLIKELY(block->buf_fix_count == 0)) { + buf_print_diagnostic(mtr, block); + ut_error; + } + block->buf_fix_count--; mutex_exit(&block->mutex); @@ -1384,7 +1399,14 @@ buf_page_optimistic_get_func( } mutex_enter(&block->mutex); - + + /* This debug code has been added to narrow + down Bug# 26081 */ + if (UNIV_UNLIKELY(block->buf_fix_count == 0)) { + buf_print_diagnostic(mtr, block); + ut_error; + } + block->buf_fix_count--; mutex_exit(&block->mutex); @@ -1404,7 +1426,10 @@ buf_page_optimistic_get_func( ut_ad(buf_validate()); } #endif - ut_ad(block->buf_fix_count > 0); + /* This debug code has been upgraded from ut_ad() to narrow + down Bug# 26081 */ + ut_a(block->buf_fix_count > 0); + ut_ad(block->state == BUF_BLOCK_FILE_PAGE); #ifdef UNIV_DEBUG_FILE_ACCESSES @@ -1493,7 +1518,14 @@ buf_page_get_known_nowait( if (!success) { mutex_enter(&block->mutex); - + + /* This debug code has been added to narrow + down Bug# 26081 */ + if (UNIV_UNLIKELY(block->buf_fix_count == 0)) { + buf_print_diagnostic(mtr, block); + ut_error; + } + block->buf_fix_count--; mutex_exit(&block->mutex); @@ -1514,7 +1546,8 @@ buf_page_get_known_nowait( ut_ad(buf_validate()); } #endif - ut_ad(block->buf_fix_count > 0); + /* This debug code has been upgraded to narrow down Bug# 26081 */ + ut_a(block->buf_fix_count > 0); ut_ad(block->state == BUF_BLOCK_FILE_PAGE); #ifdef UNIV_DEBUG_FILE_ACCESSES ut_a(block->file_page_was_freed == FALSE); @@ -2027,7 +2060,6 @@ buf_pool_invalidate(void) mutex_exit(&(buf_pool->mutex)); } -#ifdef UNIV_DEBUG /************************************************************************* Validates the buffer buf_pool data structure. */ @@ -2227,7 +2259,6 @@ buf_print(void) ut_a(buf_validate()); } -#endif /* UNIV_DEBUG */ /************************************************************************* Returns the number of latched pages in the buffer pool. */ @@ -2483,3 +2514,64 @@ buf_get_free_list_len(void) return(len); } + +/************************************************************************* +Print the block fields. */ + +void +buf_block_print( +/*============*/ + const buf_block_t* block) /* in: block to print */ +{ + fprintf(stderr, + "BLOCK fields\nmagic_n: 0x%lx\n" + "state: %lu frame: 0x%lx space:offset: 0x%lx:0x%lx\n" + "hash value: 0x%lx check_index_page_at_flush: %ld\n" + "newest_modification %lu:%lu oldest_modification %lu:%lu\n" + "flush_type: %lu in_free_list: %ld in_LRU_list: %ld\n" + "LRU_position: %ld freed_page_clock: %lu old: %ld\n" + "accessed: %ld buf_fix_count: %lu io_fix: %ld " + "modify_clock: %lu:%lu\n" + "n_hash_helps: %lu n_fields: %ld n_bytes: %lu side: %lu\n" + "is_hashed: %lu n_pointers: %lu curr_n_fields: %lu\n" + "curr_n_bytes: %lu curr_side: %lu index name: %s\n" + "file_page_was_freed: %lu\n", + block->magic_n, block->state, (ulint) block->frame, + block->space, block->offset, block->lock_hash_val, + block->check_index_page_at_flush, + ut_dulint_get_high(block->newest_modification), + ut_dulint_get_low(block->newest_modification), + ut_dulint_get_high(block->oldest_modification), + ut_dulint_get_low(block->oldest_modification), + block->flush_type, block->in_free_list, block->in_LRU_list, + block->LRU_position, block->freed_page_clock, + block->old, block->accessed, block->buf_fix_count, + block->io_fix, + ut_dulint_get_high(block->modify_clock), + ut_dulint_get_low(block->modify_clock), + block->n_hash_helps, block->n_fields, block->n_bytes, + block->side, block->is_hashed, block->n_pointers, + block->curr_n_fields, block->curr_n_bytes, + block->curr_side, block->index->name, + block->file_page_was_freed); +} + +/************************************************************************ +Print some diagnostics related to the buffer pool.*/ + +void +buf_print_diagnostic( +/*=================*/ + mtr_t* mtr, /* in: mtr to print */ + const buf_block_t* block) /* in: block to print */ +{ + fprintf(stderr, "=== MTR ===\n"); + mtr_print(mtr); + buf_LRU_print(); + buf_print(); + buf_LRU_validate(); + buf_print_io(stderr); + fprintf(stderr, "=== BLOCK ===\n"); + buf_block_print(block); +} + diff --git a/innobase/buf/buf0lru.c b/innobase/buf/buf0lru.c index dfee2add045..0f632f0752a 100644 --- a/innobase/buf/buf0lru.c +++ b/innobase/buf/buf0lru.c @@ -945,7 +945,6 @@ buf_LRU_block_free_hashed_page( buf_LRU_block_free_non_file_page(block); } -#ifdef UNIV_DEBUG /************************************************************************** Validates the LRU list. */ @@ -1076,4 +1075,3 @@ buf_LRU_print(void) mutex_exit(&(buf_pool->mutex)); } -#endif /* UNIV_DEBUG */ diff --git a/innobase/ibuf/ibuf0ibuf.c b/innobase/ibuf/ibuf0ibuf.c index eb10a88d1d1..031add1c9ba 100644 --- a/innobase/ibuf/ibuf0ibuf.c +++ b/innobase/ibuf/ibuf0ibuf.c @@ -1436,6 +1436,9 @@ ibuf_entry_build( *buf2++ = 0; /* write the compact format indicator */ } for (i = 0; i < n_fields; i++) { + ulint fixed_len; + const dict_field_t* ifield; + /* We add 4 below because we have the 4 extra fields at the start of an ibuf record */ @@ -1443,11 +1446,30 @@ ibuf_entry_build( entry_field = dtuple_get_nth_field(entry, i); dfield_copy(field, entry_field); + ifield = dict_index_get_nth_field(index, i); + /* Prefix index columns of fixed-length columns are of + fixed length. However, in the function call below, + dfield_get_type(entry_field) contains the fixed length + of the column in the clustered index. Replace it with + the fixed length of the secondary index column. */ + fixed_len = ifield->fixed_len; + +#ifdef UNIV_DEBUG + if (fixed_len) { + /* dict_index_add_col() should guarantee these */ + ut_ad(fixed_len <= (ulint) entry_field->type.len); + if (ifield->prefix_len) { + ut_ad(ifield->prefix_len == fixed_len); + } else { + ut_ad(fixed_len + == (ulint) entry_field->type.len); + } + } +#endif /* UNIV_DEBUG */ + dtype_new_store_for_order_and_null_size( - buf2 + i * DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE, - dfield_get_type(entry_field), - dict_index_get_nth_field(index, i) - ->prefix_len); + buf2 + i * DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE, + dfield_get_type(entry_field), fixed_len); } /* Store the type info in buf2 to field 3 of tuple */ diff --git a/innobase/include/buf0buf.ic b/innobase/include/buf0buf.ic index ddc91b8d66c..844d3fbd6d1 100644 --- a/innobase/include/buf0buf.ic +++ b/innobase/include/buf0buf.ic @@ -11,6 +11,15 @@ Created 11/5/1995 Heikki Tuuri #include "buf0rea.h" #include "mtr0mtr.h" +/************************************************************************* +Print the mtr and block fields. */ + +void +buf_print_diagnostic( +/*=================*/ + mtr_t* mtr, /* in: mtr to print */ + const buf_block_t* block); /* in: block to print */ + #ifdef UNIV_DEBUG extern ulint buf_dbg_counter; /* This is used to insert validation operations in execution in the @@ -618,12 +627,9 @@ buf_page_release( RW_NO_LATCH */ mtr_t* mtr) /* in: mtr */ { - ulint buf_fix_count; - ut_ad(block); ut_a(block->state == BUF_BLOCK_FILE_PAGE); - ut_a(block->buf_fix_count > 0); if (rw_latch == RW_X_LATCH && mtr->modifications) { mutex_enter(&buf_pool->mutex); @@ -633,11 +639,16 @@ buf_page_release( mutex_enter(&block->mutex); + /* This debug code has been added to narrow down Bug# 26081 */ + if (UNIV_UNLIKELY(block->buf_fix_count == 0)) { + buf_print_diagnostic(mtr, block); + ut_error; + } + #ifdef UNIV_SYNC_DEBUG rw_lock_s_unlock(&(block->debug_latch)); #endif - buf_fix_count = block->buf_fix_count; - block->buf_fix_count = buf_fix_count - 1; + --block->buf_fix_count; mutex_exit(&block->mutex); diff --git a/innobase/include/buf0lru.h b/innobase/include/buf0lru.h index 790bf65c698..e0f511cf7b8 100644 --- a/innobase/include/buf0lru.h +++ b/innobase/include/buf0lru.h @@ -122,7 +122,6 @@ void buf_LRU_make_block_old( /*===================*/ buf_block_t* block); /* in: control block */ -#ifdef UNIV_DEBUG /************************************************************************** Validates the LRU list. */ @@ -135,7 +134,6 @@ Prints the LRU list. */ void buf_LRU_print(void); /*===============*/ -#endif /* UNIV_DEBUG */ #ifndef UNIV_NONINL #include "buf0lru.ic" diff --git a/innobase/include/dict0dict.h b/innobase/include/dict0dict.h index 642037494b5..7fd9be1ebd6 100644 --- a/innobase/include/dict0dict.h +++ b/innobase/include/dict0dict.h @@ -84,6 +84,17 @@ dtype_t* dict_col_get_type( /*==============*/ dict_col_t* col); +#ifdef UNIV_DEBUG +/************************************************************************* +Assert that a column and a data type match. */ +UNIV_INLINE +ibool +dict_col_type_assert_equal( +/*=======================*/ + /* out: TRUE */ + const dict_col_t* col, /* in: column */ + const dtype_t* type); /* in: data type */ +#endif /* UNIV_DEBUG */ /************************************************************************* Gets the column number. */ UNIV_INLINE diff --git a/innobase/include/dict0dict.ic b/innobase/include/dict0dict.ic index 861da5d057a..cbd7285e20f 100644 --- a/innobase/include/dict0dict.ic +++ b/innobase/include/dict0dict.ic @@ -23,6 +23,30 @@ dict_col_get_type( return(&col->type); } +#ifdef UNIV_DEBUG +/************************************************************************* +Assert that a column and a data type match. */ +UNIV_INLINE +ibool +dict_col_type_assert_equal( +/*=======================*/ + /* out: TRUE */ + const dict_col_t* col, /* in: column */ + const dtype_t* type) /* in: data type */ +{ + ut_ad(col); + ut_ad(type); + + ut_ad(col->type.mtype == type->mtype); + ut_ad(col->type.prtype == type->prtype); + ut_ad(col->type.len == type->len); + ut_ad(col->type.mbminlen == type->mbminlen); + ut_ad(col->type.mbmaxlen == type->mbmaxlen); + + return(TRUE); +} +#endif /* UNIV_DEBUG */ + /************************************************************************* Gets the column number. */ UNIV_INLINE diff --git a/innobase/include/dict0mem.h b/innobase/include/dict0mem.h index 3c10e82342b..7d8dc404290 100644 --- a/innobase/include/dict0mem.h +++ b/innobase/include/dict0mem.h @@ -159,10 +159,13 @@ struct dict_col_struct{ in some of the functions below */ }; -/* DICT_MAX_INDEX_COL_LEN is measured in bytes and is the max index column -length + 1. Starting from 4.1.6, we set it to < 3 * 256, so that one can -create a column prefix index on 255 characters of a TEXT field also in the -UTF-8 charset. In that charset, a character may take at most 3 bytes. */ +/* DICT_MAX_INDEX_COL_LEN is measured in bytes and is the maximum +indexed column length (or indexed prefix length). It is set to 3*256, +so that one can create a column prefix index on 256 characters of a +TEXT or VARCHAR column also in the UTF-8 charset. In that charset, +a character may take at most 3 bytes. +This constant MUST NOT BE CHANGED, or the compatibility of InnoDB data +files would be at risk! */ #define DICT_MAX_INDEX_COL_LEN 768 diff --git a/innobase/include/os0file.h b/innobase/include/os0file.h index d5bc5a2b115..49460dbaf19 100644 --- a/innobase/include/os0file.h +++ b/innobase/include/os0file.h @@ -94,7 +94,8 @@ log. */ #define OS_FILE_PATH_ERROR 74 #define OS_FILE_AIO_RESOURCES_RESERVED 75 /* wait for OS aio resources to become available again */ -#define OS_FILE_ERROR_NOT_SPECIFIED 76 +#define OS_FILE_SHARING_VIOLATION 76 +#define OS_FILE_ERROR_NOT_SPECIFIED 77 /* Types for aio operations */ #define OS_FILE_READ 10 diff --git a/innobase/include/trx0trx.h b/innobase/include/trx0trx.h index 0dc82893ad1..cf9d1788ad8 100644 --- a/innobase/include/trx0trx.h +++ b/innobase/include/trx0trx.h @@ -604,7 +604,7 @@ struct trx_struct{ NULL */ ibool was_chosen_as_deadlock_victim; /* when the transaction decides to wait - for a lock, this it sets this to FALSE; + for a lock, it sets this to FALSE; if another transaction chooses this transaction as a victim in deadlock resolution, it sets this to TRUE */ diff --git a/innobase/lock/lock0lock.c b/innobase/lock/lock0lock.c index 77dfca5fdf4..e0f3f58f737 100644 --- a/innobase/lock/lock0lock.c +++ b/innobase/lock/lock0lock.c @@ -4438,14 +4438,11 @@ lock_table_queue_validate( dict_table_t* table) /* in: table */ { lock_t* lock; - ibool is_waiting; #ifdef UNIV_SYNC_DEBUG ut_ad(mutex_own(&kernel_mutex)); #endif /* UNIV_SYNC_DEBUG */ - is_waiting = FALSE; - lock = UT_LIST_GET_FIRST(table->locks); while (lock) { @@ -4455,12 +4452,9 @@ lock_table_queue_validate( if (!lock_get_wait(lock)) { - ut_a(!is_waiting); - ut_a(!lock_table_other_has_incompatible(lock->trx, 0, table, lock_get_mode(lock))); } else { - is_waiting = TRUE; ut_a(lock_table_has_to_wait_in_queue(lock)); } diff --git a/innobase/log/log0log.c b/innobase/log/log0log.c index 2d3bff522e2..26c0ce60c69 100644 --- a/innobase/log/log0log.c +++ b/innobase/log/log0log.c @@ -3061,9 +3061,22 @@ loop: mutex_enter(&kernel_mutex); - /* Check that there are no longer transactions. We need this wait even - for the 'very fast' shutdown, because the InnoDB layer may have - committed or prepared transactions and we don't want to lose them. */ + /* We need the monitor threads to stop before we proceed with a + normal shutdown. In case of very fast shutdown, however, we can + proceed without waiting for monitor threads. */ + + if (srv_fast_shutdown < 2 + && (srv_error_monitor_active + || srv_lock_timeout_and_monitor_active)) { + + mutex_exit(&kernel_mutex); + + goto loop; + } + + /* Check that there are no longer transactions. We need this wait even + for the 'very fast' shutdown, because the InnoDB layer may have + committed or prepared transactions and we don't want to lose them. */ if (trx_n_mysql_transactions > 0 || UT_LIST_GET_LEN(trx_sys->trx_list) > 0) { @@ -3184,22 +3197,8 @@ loop: goto loop; } - /* The lock timeout thread should now have exited */ - - if (srv_lock_timeout_and_monitor_active) { - - goto loop; - } - - /* We now let also the InnoDB error monitor thread to exit */ - srv_shutdown_state = SRV_SHUTDOWN_LAST_PHASE; - if (srv_error_monitor_active) { - - goto loop; - } - /* Make some checks that the server really is quiet */ ut_a(srv_n_threads_active[SRV_MASTER] == 0); ut_a(buf_all_freed()); diff --git a/innobase/mtr/mtr0mtr.c b/innobase/mtr/mtr0mtr.c index da045be1f62..143db0ce0dd 100644 --- a/innobase/mtr/mtr0mtr.c +++ b/innobase/mtr/mtr0mtr.c @@ -326,7 +326,16 @@ mtr_print( mtr_t* mtr) /* in: mtr */ { fprintf(stderr, - "Mini-transaction handle: memo size %lu bytes log size %lu bytes\n", + "Mini-transaction handle: memo size %lu bytes log " + "size %lu bytes\n" + "state: %lu modifications: %lu n_lock_recs %lu\n" + "log_mode: %lu start_lsn: %lu:%lu end_lsn: %lu:%lu\n", (ulong) dyn_array_get_data_size(&(mtr->memo)), - (ulong) dyn_array_get_data_size(&(mtr->log))); + (ulong) dyn_array_get_data_size(&(mtr->log)), + mtr->state, (ulint) mtr->modifications, + mtr->n_log_recs, mtr->log_mode, + ut_dulint_get_high(mtr->start_lsn), + ut_dulint_get_low(mtr->start_lsn), + ut_dulint_get_high(mtr->end_lsn), + ut_dulint_get_low(mtr->end_lsn)); } diff --git a/innobase/os/os0file.c b/innobase/os/os0file.c index 7133b28ecb2..3030b20a685 100644 --- a/innobase/os/os0file.c +++ b/innobase/os/os0file.c @@ -243,7 +243,13 @@ os_file_get_last_error( fprintf(stderr, "InnoDB: The error means mysqld does not have the access rights to\n" "InnoDB: the directory. It may also be you have created a subdirectory\n" - "InnoDB: of the same name as a data file.\n"); + "InnoDB: of the same name as a data file.\n"); + } else if (err == ERROR_SHARING_VIOLATION + || err == ERROR_LOCK_VIOLATION) { + fprintf(stderr, + "InnoDB: The error means that another program is using InnoDB's files.\n" + "InnoDB: This might be a backup or antivirus software or another instance\n" + "InnoDB: of MySQL. Please close it to get rid of this error.\n"); } else { fprintf(stderr, "InnoDB: Some operating system error numbers are described at\n" @@ -260,6 +266,9 @@ os_file_get_last_error( return(OS_FILE_DISK_FULL); } else if (err == ERROR_FILE_EXISTS) { return(OS_FILE_ALREADY_EXISTS); + } else if (err == ERROR_SHARING_VIOLATION + || err == ERROR_LOCK_VIOLATION) { + return(OS_FILE_SHARING_VIOLATION); } else { return(100 + err); } @@ -369,6 +378,12 @@ os_file_handle_error_cond_exit( || err == OS_FILE_PATH_ERROR) { return(FALSE); + + } else if (err == OS_FILE_SHARING_VIOLATION) { + + os_thread_sleep(10000000); /* 10 sec */ + return(TRUE); + } else { if (name) { fprintf(stderr, "InnoDB: File name %s\n", name); diff --git a/innobase/rem/rem0rec.c b/innobase/rem/rem0rec.c index 9480c978755..65da8352dc7 100644 --- a/innobase/rem/rem0rec.c +++ b/innobase/rem/rem0rec.c @@ -462,7 +462,7 @@ rec_get_converted_size_new( case REC_STATUS_INFIMUM: case REC_STATUS_SUPREMUM: /* infimum or supremum record, 8 bytes */ - return(size + 8); /* no extra data needed */ + return(8); /* no extra data needed */ default: ut_a(0); return(ULINT_UNDEFINED); @@ -473,23 +473,34 @@ rec_get_converted_size_new( ulint len = dtuple_get_nth_field(dtuple, i)->len; field = dict_index_get_nth_field(index, i); type = dict_col_get_type(dict_field_get_col(field)); - ut_ad(len != UNIV_SQL_NULL || - !(dtype_get_prtype(type) & DATA_NOT_NULL)); + + ut_ad(dict_col_type_assert_equal( + dict_field_get_col(field), + dfield_get_type(dtuple_get_nth_field( + dtuple, i)))); if (len == UNIV_SQL_NULL) { /* No length is stored for NULL fields. */ + ut_ad(!(dtype_get_prtype(type) & DATA_NOT_NULL)); continue; } ut_ad(len <= dtype_get_len(type) || dtype_get_mtype(type) == DATA_BLOB); - ut_ad(!field->fixed_len || len == field->fixed_len); if (field->fixed_len) { + ut_ad(len == field->fixed_len); + /* dict_index_add_col() should guarantee this */ + ut_ad(!field->prefix_len + || field->fixed_len == field->prefix_len); } else if (len < 128 || (dtype_get_len(type) < 256 && dtype_get_mtype(type) != DATA_BLOB)) { size++; } else { + /* For variable-length columns, we look up the + maximum length from the column itself. If this + is a prefix index column shorter than 256 bytes, + this will waste one byte. */ size += 2; } size += len; @@ -885,6 +896,11 @@ rec_convert_dtuple_to_rec_new( len = dfield_get_len(field); fixed_len = dict_index_get_nth_field(index, i)->fixed_len; + ut_ad(dict_col_type_assert_equal( + dict_field_get_col(dict_index_get_nth_field( + index, i)), + dfield_get_type(field))); + if (!(dtype_get_prtype(type) & DATA_NOT_NULL)) { if (len == UNIV_SQL_NULL) continue; diff --git a/innobase/row/row0sel.c b/innobase/row/row0sel.c index f8a65e6ff82..c956492900d 100644 --- a/innobase/row/row0sel.c +++ b/innobase/row/row0sel.c @@ -3451,6 +3451,31 @@ shortcut_fails_too_big_rec: pcur, 0, &mtr); pcur->trx_if_known = trx; + + rec = btr_pcur_get_rec(pcur); + + if (!moves_up + && !page_rec_is_supremum(rec) + && set_also_gap_locks + && !srv_locks_unsafe_for_binlog + && prebuilt->select_lock_type != LOCK_NONE) { + + /* Try to place a gap lock on the next index record + to prevent phantoms in ORDER BY ... DESC queries */ + + offsets = rec_get_offsets(page_rec_get_next(rec), + index, offsets, + ULINT_UNDEFINED, &heap); + err = sel_set_rec_lock(page_rec_get_next(rec), + index, offsets, + prebuilt->select_lock_type, + LOCK_GAP, thr); + + if (err != DB_SUCCESS) { + + goto lock_wait_or_error; + } + } } else { if (mode == PAGE_CUR_G) { btr_pcur_open_at_index_side(TRUE, index, diff --git a/innobase/srv/srv0srv.c b/innobase/srv/srv0srv.c index 96c0f05111b..e4ce29f445c 100644 --- a/innobase/srv/srv0srv.c +++ b/innobase/srv/srv0srv.c @@ -1037,7 +1037,7 @@ retry: if (!has_slept && !trx->has_search_latch && NULL == UT_LIST_GET_FIRST(trx->trx_locks)) { - has_slept = TRUE; /* We let is sleep only once to avoid + has_slept = TRUE; /* We let it sleep only once to avoid starvation */ srv_conc_n_waiting_threads++; @@ -1858,6 +1858,7 @@ srv_lock_timeout_and_monitor_thread( double time_elapsed; time_t current_time; time_t last_table_monitor_time; + time_t last_tablespace_monitor_time; time_t last_monitor_time; ibool some_waits; double wait_time; @@ -1870,6 +1871,7 @@ srv_lock_timeout_and_monitor_thread( UT_NOT_USED(arg); srv_last_monitor_time = time(NULL); last_table_monitor_time = time(NULL); + last_tablespace_monitor_time = time(NULL); last_monitor_time = time(NULL); loop: srv_lock_timeout_and_monitor_active = TRUE; @@ -1905,9 +1907,9 @@ loop: } if (srv_print_innodb_tablespace_monitor - && difftime(current_time, last_table_monitor_time) > 60) { + && difftime(current_time, last_tablespace_monitor_time) > 60) { - last_table_monitor_time = time(NULL); + last_tablespace_monitor_time = time(NULL); fputs("================================================\n", stderr); @@ -2103,7 +2105,7 @@ loop: os_thread_sleep(2000000); - if (srv_shutdown_state < SRV_SHUTDOWN_LAST_PHASE) { + if (srv_shutdown_state < SRV_SHUTDOWN_CLEANUP) { goto loop; } diff --git a/libmysql/CMakeLists.txt b/libmysql/CMakeLists.txt index 647f6bd5e33..3b18531f6c0 100755 --- a/libmysql/CMakeLists.txt +++ b/libmysql/CMakeLists.txt @@ -18,6 +18,10 @@ INCLUDE("${PROJECT_SOURCE_DIR}/win/mysql_manifest.cmake") # storage does not work properly in DLLs. SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX -DUSE_TLS") SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX -DUSE_TLS") +SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DSAFEMALLOC -DSAFE_MUTEX -DUSE_TLS") +SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DSAFEMALLOC -DSAFE_MUTEX -DUSE_TLS") +SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -DSAFEMALLOC -DSAFE_MUTEX -DUSE_TLS") +SET(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -DSAFEMALLOC -DSAFE_MUTEX -DUSE_TLS") INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/zlib diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index e80684a1b1e..72bc4445d83 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -67,8 +67,6 @@ ulong net_buffer_length=8192; ulong max_allowed_packet= 1024L*1024L*1024L; -ulong net_read_timeout= CLIENT_NET_READ_TIMEOUT; -ulong net_write_timeout= CLIENT_NET_WRITE_TIMEOUT; #ifdef EMBEDDED_LIBRARY @@ -170,8 +168,23 @@ int STDCALL mysql_server_init(int argc __attribute__((unused)), } +/* + Free all memory and resources used by the client library + + NOTES + When calling this there should not be any other threads using + the library. + + To make things simpler when used with windows dll's (which calls this + function automaticly), it's safe to call this function multiple times. +*/ + + void STDCALL mysql_server_end() { + if (!mysql_client_init) + return; + #ifdef EMBEDDED_LIBRARY end_embedded_server(); #endif @@ -1528,8 +1541,8 @@ my_bool STDCALL mysql_embedded(void) void my_net_local_init(NET *net) { net->max_packet= (uint) net_buffer_length; - net->read_timeout= (uint) net_read_timeout; - net->write_timeout=(uint) net_write_timeout; + my_net_set_read_timeout(net, CLIENT_NET_READ_TIMEOUT); + my_net_set_write_timeout(net, CLIENT_NET_WRITE_TIMEOUT); net->retry_count= 1; net->max_packet_size= max(net_buffer_length, max_allowed_packet); } @@ -3665,33 +3678,38 @@ static void fetch_long_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field, case MYSQL_TYPE_FLOAT: { /* - We need to store data in the buffer before the truncation check to + We need to mark the local variable volatile to workaround Intel FPU executive precision feature. (See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=323 for details) - AFAIU it does not guarantee to work. */ - float data; + volatile float data; if (is_unsigned) + { data= (float) ulonglong2double(value); + *param->error= ((ulonglong) value) != ((ulonglong) data); + } else - data= (float) value; + { + data= (float)value; + *param->error= value != ((longlong) data); + } floatstore(buffer, data); - *param->error= is_unsigned ? - ((ulonglong) value) != ((ulonglong) (*(float*) buffer)) : - ((longlong) value) != ((longlong) (*(float*) buffer)); break; } case MYSQL_TYPE_DOUBLE: { - double data; + volatile double data; if (is_unsigned) + { data= ulonglong2double(value); + *param->error= ((ulonglong) value) != ((ulonglong) data); + } else + { data= (double)value; + *param->error= value != ((longlong) data); + } doublestore(buffer, data); - *param->error= is_unsigned ? - ((ulonglong) value) != ((ulonglong) (*(double*) buffer)) : - ((longlong) value) != ((longlong) (*(double*) buffer)); break; } case MYSQL_TYPE_TIME: diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc index 26d761bf6fd..7ac663480c8 100644 --- a/libmysqld/lib_sql.cc +++ b/libmysqld/lib_sql.cc @@ -590,7 +590,7 @@ void *create_embedded_thd(int client_flag) thd->set_time(); thd->init_for_queries(); thd->client_capabilities= client_flag; - thd->real_id= (pthread_t) thd; + thd->real_id= (pthread_t)thd->thread_id; thd->db= NULL; thd->db_length= 0; diff --git a/libmysqld/libmysqld.def b/libmysqld/libmysqld.def index 0e80681700f..8829112fefd 100644 --- a/libmysqld/libmysqld.def +++ b/libmysqld/libmysqld.def @@ -29,8 +29,8 @@ EXPORTS my_print_variables my_realloc my_strdup - my_thread_end - my_thread_init + mysql_thread_end + mysql_thread_init myodbc_remove_escape mysql_affected_rows mysql_autocommit diff --git a/myisam/ft_parser.c b/myisam/ft_parser.c index 6c79f9249cf..6d68542e4e2 100644 --- a/myisam/ft_parser.c +++ b/myisam/ft_parser.c @@ -111,7 +111,7 @@ byte ft_get_word(CHARSET_INFO *cs, byte **start, byte *end, while (docquot) @@ -120,6 +120,7 @@ byte ft_get_word(CHARSET_INFO *cs, byte **start, byte *end, *start=doc+1; return 3; /* FTB_RBR */ } + mbl= my_mbcharlen(cs, *(uchar *)doc); if (!param->quot) { if (*doc == FTB_LBR || *doc == FTB_RBR || *doc == FTB_LQUOT) @@ -187,10 +188,11 @@ byte ft_simple_get_word(CHARSET_INFO *cs, byte **start, const byte *end, do { - for (;; doc++) + for (;; doc+= mbl) { if (doc >= end) DBUG_RETURN(0); if (true_word_char(cs, *doc)) break; + mbl= my_mbcharlen(cs, *(uchar *)doc); } mwc= length= 0; diff --git a/myisam/mi_key.c b/myisam/mi_key.c index b203286d544..377972b5a5f 100644 --- a/myisam/mi_key.c +++ b/myisam/mi_key.c @@ -252,16 +252,16 @@ uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key, uchar *old, if (keyseg->flag & HA_SPACE_PACK) { uchar *end=pos+length; - if (type != HA_KEYTYPE_NUM) - { - while (end > pos && end[-1] == ' ') - end--; - } - else + if (type == HA_KEYTYPE_NUM) { while (pos < end && pos[0] == ' ') pos++; } + else if (type != HA_KEYTYPE_BINARY) + { + while (end > pos && end[-1] == ' ') + end--; + } k_length-=length; length=(uint) (end-pos); FIX_LENGTH(cs, pos, length, char_length); diff --git a/myisam/mi_open.c b/myisam/mi_open.c index 274933679ef..28258af57a2 100644 --- a/myisam/mi_open.c +++ b/myisam/mi_open.c @@ -225,7 +225,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags) key_parts+=fulltext_keys*FT_SEGS; if (share->base.max_key_length > MI_MAX_KEY_BUFF || keys > MI_MAX_KEY || - key_parts >= MI_MAX_KEY * MI_MAX_KEY_SEG) + key_parts > MI_MAX_KEY * MI_MAX_KEY_SEG) { DBUG_PRINT("error",("Wrong key info: Max_key_length: %d keys: %d key_parts: %d", share->base.max_key_length, keys, key_parts)); my_errno=HA_ERR_UNSUPPORTED; diff --git a/myisam/sort.c b/myisam/sort.c index f918283503e..f48161b7c8e 100644 --- a/myisam/sort.c +++ b/myisam/sort.c @@ -138,8 +138,9 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages, while (memavl >= MIN_SORT_MEMORY) { - if ((my_off_t) (records+1)*(sort_length+sizeof(char*)) <= - (my_off_t) memavl) + if ((records < UINT_MAX32) && + ((my_off_t) (records + 1) * + (sort_length + sizeof(char*)) <= (my_off_t) memavl)) keys= records+1; else do diff --git a/myisammrg/myrg_def.h b/myisammrg/myrg_def.h index 344bd4edd3c..bc114523a80 100644 --- a/myisammrg/myrg_def.h +++ b/myisammrg/myrg_def.h @@ -29,4 +29,7 @@ extern pthread_mutex_t THR_LOCK_open; int _myrg_init_queue(MYRG_INFO *info,int inx,enum ha_rkey_function search_flag); int _myrg_mi_read_record(MI_INFO *info, byte *buf); - +#ifdef __cplusplus +extern "C" +#endif +void myrg_print_wrong_table(const char *table_name); diff --git a/myisammrg/myrg_open.c b/myisammrg/myrg_open.c index afab21dfa3d..0e82e429afd 100644 --- a/myisammrg/myrg_open.c +++ b/myisammrg/myrg_open.c @@ -90,6 +90,11 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking) if (!(isam=mi_open(buff,mode,(handle_locking?HA_OPEN_WAIT_IF_LOCKED:0)))) { my_errno= HA_ERR_WRONG_MRG_TABLE_DEF; + if (handle_locking & HA_OPEN_FOR_REPAIR) + { + myrg_print_wrong_table(buff); + continue; + } goto err; } if (!m_info) /* First file */ @@ -118,6 +123,11 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking) if (m_info->reclength != isam->s->base.reclength) { my_errno=HA_ERR_WRONG_MRG_TABLE_DEF; + if (handle_locking & HA_OPEN_FOR_REPAIR) + { + myrg_print_wrong_table(buff); + continue; + } goto err; } m_info->options|= isam->s->options; @@ -131,6 +141,8 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking) m_info->tables); } + if (my_errno == HA_ERR_WRONG_MRG_TABLE_DEF) + goto err; if (!m_info && !(m_info= (MYRG_INFO*) my_malloc(sizeof(MYRG_INFO), MYF(MY_WME | MY_ZEROFILL)))) goto err; diff --git a/mysql-test/Makefile.am b/mysql-test/Makefile.am index 6c7207b0b2d..ebc2bbb83e8 100644 --- a/mysql-test/Makefile.am +++ b/mysql-test/Makefile.am @@ -60,6 +60,7 @@ dist-hook: $(INSTALL_DATA) $(srcdir)/include/*.test $(distdir)/include $(INSTALL_DATA) $(srcdir)/r/*.result $(srcdir)/r/*.require $(distdir)/r $(INSTALL_DATA) $(srcdir)/std_data/Moscow_leap $(distdir)/std_data + $(INSTALL_DATA) $(srcdir)/std_data/Index.xml $(distdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/*.dat $(srcdir)/std_data/*.000001 $(distdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/des_key_file $(distdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/*.pem $(distdir)/std_data @@ -94,6 +95,7 @@ install-data-local: $(INSTALL_DATA) $(srcdir)/std_data/*.cnf $(DESTDIR)$(testdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/des_key_file $(DESTDIR)$(testdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/Moscow_leap $(DESTDIR)$(testdir)/std_data + $(INSTALL_DATA) $(srcdir)/std_data/Index.xml $(DESTDIR)$(testdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/*.pem $(DESTDIR)$(testdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/*.frm $(DESTDIR)$(testdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/*.MY* $(DESTDIR)$(testdir)/std_data diff --git a/mysql-test/include/federated.inc b/mysql-test/include/federated.inc index c8e8ededa11..7bdb2efaa8b 100644 --- a/mysql-test/include/federated.inc +++ b/mysql-test/include/federated.inc @@ -1,3 +1,4 @@ +--source include/have_log_bin.inc --source include/not_embedded.inc --source ./include/have_federated_db.inc diff --git a/mysql-test/include/have_outfile.inc b/mysql-test/include/have_outfile.inc index 10f093ec3ef..ae4a2723840 100644 --- a/mysql-test/include/have_outfile.inc +++ b/mysql-test/include/have_outfile.inc @@ -1,5 +1,5 @@ -- require r/have_outfile.require disable_query_log; select load_file(concat(@tmpdir,"/outfile.test")); ---exec rm $MYSQLTEST_VARDIR/tmp/outfile.test +--remove_file $MYSQLTEST_VARDIR/tmp/outfile.test enable_query_log; diff --git a/mysql-test/include/is_debug_build.inc b/mysql-test/include/is_debug_build.inc deleted file mode 100644 index 23a2814e2bb..00000000000 --- a/mysql-test/include/is_debug_build.inc +++ /dev/null @@ -1,4 +0,0 @@ --- require r/is_debug_build.require ---disable_query_log -select instr(version(), "debug") > 0; ---enable_query_log diff --git a/mysql-test/include/master-slave.inc b/mysql-test/include/master-slave.inc index ea09f4e842b..0c27a1d8225 100644 --- a/mysql-test/include/master-slave.inc +++ b/mysql-test/include/master-slave.inc @@ -1,3 +1,6 @@ +# Replication tests need binlog +source include/have_log_bin.inc; + connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,); connect (master1,127.0.0.1,root,,test,$MASTER_MYPORT,); connect (slave,127.0.0.1,root,,test,$SLAVE_MYPORT,); diff --git a/mysql-test/include/show_binlog_events.inc b/mysql-test/include/show_binlog_events.inc new file mode 100644 index 00000000000..5d60fb19cb5 --- /dev/null +++ b/mysql-test/include/show_binlog_events.inc @@ -0,0 +1,4 @@ +--let $binlog_start=98 +--replace_column 5 # +--replace_regex /\/\* xid=.* \*\//\/* XID *\// +--eval show binlog events from $binlog_start diff --git a/mysql-test/include/uses_vardir.inc b/mysql-test/include/uses_vardir.inc new file mode 100644 index 00000000000..950de698a43 --- /dev/null +++ b/mysql-test/include/uses_vardir.inc @@ -0,0 +1,14 @@ +# +# Some tests uses LOAD DATA with a relative path +# and need to see for example ../std_data +# +# Also if an absolute path was used, the server might be started +# with --secure-file-priv and wouldn't be allowed to LOAD a file +# outside of it's vardir anyway +# + + +if (`select LOCATE('$MYSQLTEST_VARDIR', REPLACE(@@datadir, '\\\\', '/')) != 1`) +{ + skip Need mysqld in MYSQLTEST_VARDIR; +} diff --git a/mysql-test/include/wait_for_slave_io_to_stop.inc b/mysql-test/include/wait_for_slave_io_to_stop.inc new file mode 100644 index 00000000000..004f8bbbd8d --- /dev/null +++ b/mysql-test/include/wait_for_slave_io_to_stop.inc @@ -0,0 +1,33 @@ +################################################### +#Author: Jeb +#Date: 2007-06-11 +#Purpose: used for io errors on the slave. If Slave gets an io +# error, the io trhead should stop +#Details: +# 1) Fill in and setup variables +# 2) loop through looking for +# sql threads to stop +# 3) If loops too long die. +#################################################### +connection slave; +let $my_show= SHOW SLAVE STATUS; +let $sql_running= Slave_IO_Running; +let $row_number= 1; +let $run= 1; +let $counter= 300; + +while ($run) +{ + let $io_result= query_get_value("SHOW SLAVE STATUS", Slave_IO_Running, $row_number); + if (`SELECT '$io_result' = 'No'`){ + let $run= 0; + } + sleep 0.1; + if (!$counter){ + --echo "Failed while waiting for slave IO thread to stop" + SHOW SLAVE STATUS; + exit; + } + dec $counter; +} + diff --git a/mysql-test/include/wait_for_slave_param.inc b/mysql-test/include/wait_for_slave_param.inc new file mode 100644 index 00000000000..fed97195aba --- /dev/null +++ b/mysql-test/include/wait_for_slave_param.inc @@ -0,0 +1,26 @@ +# include/wait_for_slave_param.inc +# +# SUMMARY +# +# Waits until SHOW SLAVE STATUS has returned a spicified value. +# +# USAGE +# +# let $slave_param= Slave_SQL_Running; +# let $slave_param_value= No; +# --source include/slave_wait_param.inc + +let $slave_wait_param_counter= 300; +let $slave_value= query_get_value("SHOW SLAVE STATUS", $slave_param, 1); +while (`select "$slave_value" != "$slave_param_value"`) +{ + dec $slave_wait_param_counter; + if (!$slave_wait_param_counter) + { + --echo ERROR: failed while waiting for slave parameter $slave_param: $slave_param_value + query_vertical show slave status; + exit; + } + sleep 0.1; + let $slave_value= query_get_value("SHOW SLAVE STATUS", $slave_param, 1); +} diff --git a/mysql-test/include/wait_for_slave_sql_to_stop.inc b/mysql-test/include/wait_for_slave_sql_to_stop.inc new file mode 100644 index 00000000000..ee765c81f6a --- /dev/null +++ b/mysql-test/include/wait_for_slave_sql_to_stop.inc @@ -0,0 +1,30 @@ +################################################### +#Author: Jeb +#Date: 2007-06-11 +#Purpose: used for SQL errors on the slave. If Slave gets a sql +# error, the SQL trhead should stop +#Details: +# 1) Fill in and setup variables +# 2) loop through looking for +# sql threads to stop +# 3) If loops too long die. +#################################################### +connection slave; +let $row_number= 1; +let $run= 1; +let $counter= 300; + +while ($run) +{ + let $sql_result= query_get_value("SHOW SLAVE STATUS", Slave_SQL_Running, $row_number); + if (`SELECT '$sql_result' = 'No'`){ + let $run= 0; + } + sleep 0.1; + if (!$counter){ + --echo "Failed while waiting for slave SQL thread to stop" + SHOW SLAVE STATUS; + exit; + } + dec $counter; +} diff --git a/mysql-test/include/wait_for_slave_to_start.inc b/mysql-test/include/wait_for_slave_to_start.inc new file mode 100644 index 00000000000..84e1d646efe --- /dev/null +++ b/mysql-test/include/wait_for_slave_to_start.inc @@ -0,0 +1,35 @@ +################################################### +#Author: Jeb +#Date: 2007-06-11 +#Purpose: To wait a brief time for slave to start +#Details: +# 1) Fill in and setup variables +# 2) loop through looking for both +# io and sql threads to start +# 3) If loops too long die. +#################################################### +connection slave; +let $row_number= 1; +let $run= 1; +let $counter= 300; + +while ($run) +{ + let $io_result= query_get_value("SHOW SLAVE STATUS", Slave_IO_Running, $row_number); + if (`SELECT '$io_result' = 'Yes'`){ + + let $sql_result= query_get_value("SHOW SLAVE STATUS", Slave_SQL_Running, $row_number); + if (`SELECT '$sql_result' = 'Yes'`){ + let $run= 0; + } + } + sleep 0.1; + if (!$counter){ + --echo "Failed while waiting for slave to start" + SHOW SLAVE STATUS; + exit; + } + dec $counter; +} + + diff --git a/mysql-test/include/wait_for_slave_to_stop.inc b/mysql-test/include/wait_for_slave_to_stop.inc new file mode 100644 index 00000000000..13acbecb835 --- /dev/null +++ b/mysql-test/include/wait_for_slave_to_stop.inc @@ -0,0 +1,37 @@ +################################################### +#Author: Jeb +#Date: 2007-06-11 +#Purpose: To replace the mysqltest.c executable +# wait_for_slave_to_stop function and +# return this to the test language. +#Details: +# 1) Fill in and setup variables +# 2) loop through looking for both +# io and sql threads to stop +# 3) If loops too long die. +#################################################### +connection slave; +let $row_number= 1; +let $run= 1; +let $counter= 300; + +while ($run) +{ + let $io_result= query_get_value("SHOW SLAVE STATUS", Slave_IO_Running, $row_number); + if (`SELECT '$io_result' = 'No'`){ + + let $sql_result= query_get_value("SHOW SLAVE STATUS", Slave_SQL_Running, $row_number); + if (`SELECT '$sql_result' = 'No'`){ + let $run= 0; + } + } + sleep 0.1; + if (!$counter){ + --echo "Failed while waiting for slave to stop" + SHOW SLAVE STATUS; + exit; + } + dec $counter; +} + + diff --git a/mysql-test/lib/mtr_cases.pl b/mysql-test/lib/mtr_cases.pl index 1d157ea3401..5e176dce109 100644 --- a/mysql-test/lib/mtr_cases.pl +++ b/mysql-test/lib/mtr_cases.pl @@ -596,6 +596,25 @@ sub collect_one_test_case($$$$$$$) { } } + if ( $tinfo->{'need_binlog'} ) + { + if (grep(/^--skip-log-bin/, @::opt_extra_mysqld_opt) ) + { + $tinfo->{'skip'}= 1; + $tinfo->{'comment'}= "Test need binlog"; + return; + } + } + else + { + if ( $::mysql_version_id >= 50100 ) + { + # Test does not need binlog, add --skip-binlog to + # the options used when starting it + push(@{$tinfo->{'master_opt'}}, "--skip-log-bin"); + } + } + } } @@ -608,6 +627,7 @@ our @tags= ["include/have_binlog_format_row.inc", "binlog_format", "row"], ["include/have_binlog_format_statement.inc", "binlog_format", "stmt"], ["include/have_binlog_format_mixed.inc", "binlog_format", "mixed"], + ["include/have_log_bin.inc", "need_binlog", 1], ["include/big_test.inc", "big_test", 1], ["include/have_debug.inc", "need_debug", 1], ["include/have_ndb.inc", "ndb_test", 1], diff --git a/mysql-test/lib/mtr_process.pl b/mysql-test/lib/mtr_process.pl index ac2e049a67c..f5ef028fa24 100644 --- a/mysql-test/lib/mtr_process.pl +++ b/mysql-test/lib/mtr_process.pl @@ -142,6 +142,7 @@ sub spawn_impl ($$$$$$$) { if ( $pid ) { + select(STDOUT) if $::glob_win32_perl; return spawn_parent_impl($pid,$mode,$path); } else @@ -163,9 +164,6 @@ sub spawn_impl ($$$$$$$) { { # Don't redirect stdout on ActiveState perl since this is # just another thread in the same process. - # Should be fixed so that the thread that is created with fork - # executes the exe in another process and wait's for it to return. - # In the meanwhile, we get all the output from mysqld's to screen } elsif ( ! open(STDOUT,$log_file_open_mode,$output) ) { @@ -175,7 +173,7 @@ sub spawn_impl ($$$$$$$) { if ( $error ) { - if ( $output eq $error ) + if ( !$::glob_win32_perl and $output eq $error ) { if ( ! open(STDERR,">&STDOUT") ) { @@ -184,15 +182,7 @@ sub spawn_impl ($$$$$$$) { } else { - if ( $::glob_win32_perl ) - { - # Don't redirect stdout on ActiveState perl since this is - # just another thread in the same process. - # Should be fixed so that the thread that is created with fork - # executes the exe in another process and wait's for it to return. - # In the meanwhile, we get all the output from mysqld's to screen - } - elsif ( ! open(STDERR,$log_file_open_mode,$error) ) + if ( ! open(STDERR,$log_file_open_mode,$error) ) { mtr_child_error("can't redirect STDERR to \"$error\": $!"); } @@ -547,72 +537,92 @@ sub mtr_kill_leftovers () { } -# Check that all processes in list are killed -# The argument is a list of 'ports', 'pids', 'pidfiles' and 'socketfiles' -# for which shutdown has been started. Make sure they all get killed -# in one way or the other. # -# FIXME On Cygwin, and maybe some other platforms, $srv->{'pid'} and -# the pid in $srv->{'pidfile'} will not be the same PID. We need to try to kill -# both I think. - +# Check that all processes in "spec" are shutdown gracefully +# else kill them off hard +# sub mtr_check_stop_servers ($) { my $spec= shift; # Return if no processes are defined return if ! @$spec; - #mtr_report("mtr_check_stop_servers"); + mtr_verbose("mtr_check_stop_servers"); + # ---------------------------------------------------------------------- + # Wait until servers in "spec" has stopped listening + # to their ports or timeout occurs + # ---------------------------------------------------------------------- mtr_ping_with_timeout(\@$spec); # ---------------------------------------------------------------------- - # We loop with waitpid() nonblocking to see how many of the ones we - # are to kill, actually got killed by mysqladmin or ndb_mgm - # - # Note that we don't rely on this, the mysqld server might have stopped - # listening to the port, but still be alive. But it is a start. + # Use waitpid() nonblocking for a little while, to see how + # many process's will exit sucessfully. + # This is the normal case. # ---------------------------------------------------------------------- - + my $wait_counter= 50; # Max number of times to redo the loop foreach my $srv ( @$spec ) { + my $pid= $srv->{'pid'}; my $ret_pid; - if ( $srv->{'pid'} ) + if ( $pid ) { - $ret_pid= waitpid($srv->{'pid'},&WNOHANG); - if ($ret_pid == $srv->{'pid'}) + $ret_pid= waitpid($pid,&WNOHANG); + if ($ret_pid == $pid) { mtr_verbose("Caught exit of process $ret_pid"); $srv->{'pid'}= 0; } + elsif ($ret_pid == 0) + { + mtr_verbose("Process $pid is still alive"); + if ($wait_counter-- > 0) + { + # Give the processes more time to exit + select(undef, undef, undef, (0.1)); + redo; + } + } else { - # mtr_warning("caught exit of unknown child $ret_pid"); + mtr_warning("caught exit of unknown child $ret_pid"); } } } # ---------------------------------------------------------------------- - # We know the process was started from this file, so there is a PID - # saved, or else we have nothing to do. - # Might be that is is recorded to be missing, but we failed to - # take away the PID file earlier, then we do it now. + # The processes that haven't yet exited need to + # be killed hard, put them in "kill_pids" hash # ---------------------------------------------------------------------- - - my %mysqld_pids; - + my %kill_pids; foreach my $srv ( @$spec ) { - if ( $srv->{'pid'} ) + my $pid= $srv->{'pid'}; + if ( $pid ) { - $mysqld_pids{$srv->{'pid'}}= 1; + # Server is still alive, put it in list to be hard killed + if ($::glob_win32_perl) + { + # Kill the real process if it's known + $pid= $srv->{'real_pid'} if ($srv->{'real_pid'}); + } + $kill_pids{$pid}= 1; + + # Write a message to the process's error log (if it has one) + # that it's being killed hard. + if ( defined $srv->{'errfile'} ) + { + mtr_tofile($srv->{'errfile'}, "Note: Forcing kill of process $pid\n"); + } + mtr_warning("Forcing kill of process $pid"); + } else { - # Server is dead, we remove the pidfile if any - # Race, could have been removed between I tested with -f - # and the unlink() below, so I better check again with -f - + # Server is dead, remove the pidfile if it exists + # + # Race, could have been removed between test with -f + # and the unlink() below, so better check again with -f if ( -f $srv->{'pidfile'} and ! unlink($srv->{'pidfile'}) and -f $srv->{'pidfile'} ) { @@ -621,69 +631,45 @@ sub mtr_check_stop_servers ($) { } } - # ---------------------------------------------------------------------- - # If all the processes in list already have been killed, - # then we don't have to do anything. - # ---------------------------------------------------------------------- - - if ( ! keys %mysqld_pids ) + if ( ! keys %kill_pids ) { + # All processes has exited gracefully return; } - # ---------------------------------------------------------------------- - # In mtr_mysqladmin_shutdown() we only waited for the mysqld servers - # not to listen to the port. But we are not sure we got them all - # killed. If we suspect it lives, try nice kill with SIG_TERM. Note - # that for true Win32 processes, kill(0,$pid) will not return 1. - # ---------------------------------------------------------------------- - - start_reap_all(); # Avoid zombies - - my @mysqld_pids= keys %mysqld_pids; - mtr_kill_processes(\@mysqld_pids); - - stop_reap_all(); # Get into control again + mtr_kill_processes(\%kill_pids); # ---------------------------------------------------------------------- - # Now, we check if all we can find using kill(0,$pid) are dead, - # and just assume the rest are. We cleanup socket and PID files. + # All processes are killed, cleanup leftover files # ---------------------------------------------------------------------- - { my $errors= 0; foreach my $srv ( @$spec ) { if ( $srv->{'pid'} ) { - if ( kill(0,$srv->{'pid'}) ) + # Server has been hard killed, clean it's resources + foreach my $file ($srv->{'pidfile'}, $srv->{'sockfile'}) { - # FIXME In Cygwin there seem to be some fast reuse - # of PIDs, so dying may not be the right thing to do. - $errors++; - mtr_warning("can't kill process $srv->{'pid'}"); - } - else - { - # We managed to kill it at last - # FIXME In Cygwin, we will get here even if the process lives. - - # Not needed as we know the process is dead, but to be safe - # we unlink and check success in two steps. We first unlink - # without checking the error code, and then check if the - # file still exists. - - foreach my $file ($srv->{'pidfile'}, $srv->{'sockfile'}) + # Know it is dead so should be no race, careful anyway + if ( defined $file and -f $file and ! unlink($file) and -f $file ) { - # Know it is dead so should be no race, careful anyway - if ( defined $file and -f $file and ! unlink($file) and -f $file ) - { - $errors++; - mtr_warning("couldn't delete $file"); - } - } - $srv->{'pid'}= 0; - } + $errors++; + mtr_warning("couldn't delete $file"); + } + } + + if ($::glob_win32_perl and $srv->{'real_pid'}) + { + # Wait for the pseudo pid - if the real_pid was known + # the pseudo pid has not been waited for yet, wai blocking + # since it's "such a simple program" + mtr_verbose("Wait for pseudo process $srv->{'pid'}"); + my $ret_pid= waitpid($srv->{'pid'}, 0); + mtr_verbose("Pseudo process $ret_pid died"); + } + + $srv->{'pid'}= 0; } } if ( $errors ) @@ -701,12 +687,9 @@ sub mtr_check_stop_servers ($) { } } } - - # FIXME We just assume they are all dead, for Cygwin we are not - # really sure - } + # Wait for all the process in the list to terminate sub mtr_wait_blocking($) { my $admin_pids= shift; @@ -1063,7 +1046,7 @@ sub sleep_until_file_created ($$$) { { if ( -r $pidfile ) { - return $pid; + return 1; } # Check if it died after the fork() was successful @@ -1095,9 +1078,9 @@ sub sleep_until_file_created ($$$) { sub mtr_kill_processes ($) { my $pids = shift; - mtr_verbose("mtr_kill_processes " . join(" ", @$pids)); + mtr_verbose("mtr_kill_processes (" . join(" ", keys %{$pids}) . ")"); - foreach my $pid (@$pids) + foreach my $pid (keys %{$pids}) { if ($pid <= 0) @@ -1106,11 +1089,26 @@ sub mtr_kill_processes ($) { next; } - foreach my $sig (15, 9) + my $signaled_procs= kill(9, $pid); + if ($signaled_procs == 0) { - last if mtr_im_kill_process([ $pid ], $sig, 10, 1); + # No such process existed, assume it's killed + mtr_verbose("killed $pid(no such process)"); + } + else + { + my $ret_pid= waitpid($pid,0); + if ($ret_pid == $pid) + { + mtr_verbose("killed $pid(got the pid)"); + } + elsif ($ret_pid == -1) + { + mtr_verbose("killed $pid(got -1)"); + } } } + mtr_verbose("done killing processes"); } diff --git a/mysql-test/lib/mtr_report.pl b/mysql-test/lib/mtr_report.pl index d08208d37a6..1abfc6b6b57 100644 --- a/mysql-test/lib/mtr_report.pl +++ b/mysql-test/lib/mtr_report.pl @@ -272,6 +272,7 @@ sub mtr_report_stats ($) { { foreach my $errlog ( sort glob("$::opt_vardir/log/*.err") ) { + my $testname= ""; unless ( open(ERR, $errlog) ) { mtr_warning("can't read $errlog"); @@ -287,10 +288,14 @@ sub mtr_report_stats ($) { { next; # Skip these lines } + if ( /CURRENT_TEST: (.*)/ ) + { + $testname= $1; + } if ( /$pattern/ ) { $found_problems= 1; - print WARN $_; + print WARN basename($errlog) . ": $testname: $_"; } } } diff --git a/mysql-test/lib/mtr_timer.pl b/mysql-test/lib/mtr_timer.pl index 523799f7cf5..86a9f58514f 100644 --- a/mysql-test/lib/mtr_timer.pl +++ b/mysql-test/lib/mtr_timer.pl @@ -97,9 +97,14 @@ sub mtr_timer_start($$$) { # clearing the signal handler. $SIG{INT}= 'DEFAULT'; + $SIG{TERM}= sub { + mtr_verbose("timer woke up, exiting!"); + exit(0); + }; + $0= "mtr_timer(timers,$name,$duration)"; - mtr_verbose("timer child $name, sleep $duration"); sleep($duration); + mtr_verbose("timer expired after $duration seconds"); exit(0); } } @@ -118,7 +123,7 @@ sub mtr_timer_stop ($$) { # FIXME as Cygwin reuses pids fast, maybe check that is # the expected process somehow?! - kill(9, $tpid); + kill(15, $tpid); # As the timers are so simple programs, we trust them to terminate, # and use blocking wait for it. We wait just to avoid a zombie. diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index f580213cda3..c58ed308bd8 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -903,6 +903,9 @@ sub command_line_setup () { $opt_skip_ndbcluster= 1; # Turn off use of NDB cluster $opt_skip_ssl= 1; # Turn off use of SSL + # Turn off use of bin log + push(@opt_extra_mysqld_opt, "--skip-log-bin"); + if ( $opt_extern ) { mtr_error("Can't use --extern with --embedded-server"); @@ -1784,6 +1787,17 @@ sub environment_setup () { split(':', $ENV{'DYLD_LIBRARY_PATH'}) : ()); mtr_debug("DYLD_LIBRARY_PATH: $ENV{'DYLD_LIBRARY_PATH'}"); + # The environment variable used for shared libs on AIX + $ENV{'SHLIB_PATH'}= join(":", @ld_library_paths, + $ENV{'SHLIB_PATH'} ? + split(':', $ENV{'SHLIB_PATH'}) : ()); + mtr_debug("SHLIB_PATH: $ENV{'SHLIB_PATH'}"); + + # The environment variable used for shared libs on hp-ux + $ENV{'LIBPATH'}= join(":", @ld_library_paths, + $ENV{'LIBPATH'} ? + split(':', $ENV{'LIBPATH'}) : ()); + mtr_debug("LIBPATH: $ENV{'LIBPATH'}"); # -------------------------------------------------------------------------- # Also command lines in .opt files may contain env vars @@ -1792,6 +1806,18 @@ sub environment_setup () { $ENV{'CHARSETSDIR'}= $path_charsetsdir; $ENV{'UMASK'}= "0660"; # The octal *string* $ENV{'UMASK_DIR'}= "0770"; # The octal *string* + + # + # MySQL tests can produce output in various character sets + # (especially, ctype_xxx.test). To avoid confusing Perl + # with output which is incompatible with the current locale + # settings, we reset the current values of LC_ALL and LC_CTYPE to "C". + # For details, please see + # Bug#27636 tests fails if LC_* variables set to *_*.UTF-8 + # + $ENV{'LC_ALL'}= "C"; + $ENV{'LC_CTYPE'}= "C"; + $ENV{'LC_COLLATE'}= "C"; $ENV{'USE_RUNNING_SERVER'}= $opt_extern; $ENV{'MYSQL_TEST_DIR'}= $glob_mysql_test_dir; @@ -2307,16 +2333,23 @@ sub check_running_as_root () { close FILE; } - chmod(oct("0755"), $test_file); - unlink($test_file); + # Some filesystems( for example CIFS) allows reading a file + # although mode was set to 0000, but in that case a stat on + # the file will not return 0000 + my $file_mode= (stat($test_file))[2] & 07777; $ENV{'MYSQL_TEST_ROOT'}= "NO"; - if ($result eq "MySQL") + mtr_verbose("result: $result, file_mode: $file_mode"); + if ($result eq "MySQL" && $file_mode == 0) { mtr_warning("running this script as _root_ will cause some " . "tests to be skipped"); $ENV{'MYSQL_TEST_ROOT'}= "YES"; } + + chmod(oct("0755"), $test_file); + unlink($test_file); + } @@ -2546,10 +2579,19 @@ sub ndbcluster_wait_started($$){ sub mysqld_wait_started($){ my $mysqld= shift; - my $res= sleep_until_file_created($mysqld->{'path_pid'}, - $mysqld->{'start_timeout'}, - $mysqld->{'pid'}); - return $res == 0; + if (sleep_until_file_created($mysqld->{'path_pid'}, + $mysqld->{'start_timeout'}, + $mysqld->{'pid'}) == 0) + { + # Failed to wait for pid file + return 1; + } + + # Get the "real pid" of the process, it will be used for killing + # the process in ActiveState's perl on windows + $mysqld->{'real_pid'}= mtr_get_pid_from_file($mysqld->{'path_pid'}); + + return 0; } @@ -3285,9 +3327,12 @@ sub find_testcase_skipped_reason($) { my ($tinfo)= @_; - # Open mysqltest-time - my $F= IO::File->new($path_timefile) or - mtr_error("can't open file \"$path_timefile\": $!"); + # Set default message + $tinfo->{'comment'}= "Detected by testcase(no log file)"; + + # Open mysqltest-time(the mysqltest log file) + my $F= IO::File->new($path_timefile) + or return; my $reason; while ( my $line= <$F> ) @@ -3340,8 +3385,8 @@ sub analyze_testcase_failure($) my ($tinfo)= @_; # Open mysqltest.log - my $F= IO::File->new($path_timefile) or - mtr_error("can't open file \"$path_timefile\": $!"); + my $F= IO::File->new($path_timefile) + or return; while ( my $line= <$F> ) { @@ -3600,6 +3645,9 @@ sub do_before_start_master ($) { # FIXME what about second master..... + # Don't delete anything if starting dirty + return if ($opt_start_dirty); + foreach my $bin ( glob("$opt_vardir/log/master*-bin*") ) { unlink($bin); @@ -3631,6 +3679,9 @@ sub do_before_start_slave ($) { my $tname= $tinfo->{'name'}; my $init_script= $tinfo->{'master_sh'}; + # Don't delete anything if starting dirty + return if ($opt_start_dirty); + foreach my $bin ( glob("$opt_vardir/log/slave*-bin*") ) { unlink($bin); @@ -3678,7 +3729,6 @@ sub mysqld_arguments ($$$$) { mtr_add_arg($args, "%s--no-defaults", $prefix); - mtr_add_arg($args, "%s--console", $prefix); mtr_add_arg($args, "%s--basedir=%s", $prefix, $path_my_basedir); mtr_add_arg($args, "%s--character-sets-dir=%s", $prefix, $path_charsetsdir); @@ -3740,8 +3790,7 @@ sub mysqld_arguments ($$$$) { "%s--log-slow-queries=%s-slow.log", $prefix, $log_base_path); # Check if "extra_opt" contains --skip-log-bin - my $skip_binlog= grep(/^--skip-log-bin/, @$extra_opt); - + my $skip_binlog= grep(/^--skip-log-bin/, @$extra_opt, @opt_extra_mysqld_opt); if ( $mysqld->{'type'} eq 'master' ) { if (! ($opt_skip_master_binlog || $skip_binlog) ) @@ -4052,9 +4101,11 @@ sub stop_all_servers () { push(@kill_pids,{ pid => $mysqld->{'pid'}, + real_pid => $mysqld->{'real_pid'}, pidfile => $mysqld->{'path_pid'}, sockfile => $mysqld->{'path_sock'}, port => $mysqld->{'port'}, + errfile => $mysqld->{'path_myerr'}, }); $mysqld->{'pid'}= 0; # Assume we are done with it @@ -4258,9 +4309,11 @@ sub run_testcase_stop_servers($$$) { push(@kill_pids,{ pid => $mysqld->{'pid'}, + real_pid => $mysqld->{'real_pid'}, pidfile => $mysqld->{'path_pid'}, sockfile => $mysqld->{'path_sock'}, port => $mysqld->{'port'}, + errfile => $mysqld->{'path_myerr'}, }); $mysqld->{'pid'}= 0; # Assume we are done with it @@ -4308,9 +4361,11 @@ sub run_testcase_stop_servers($$$) { push(@kill_pids,{ pid => $mysqld->{'pid'}, + real_pid => $mysqld->{'real_pid'}, pidfile => $mysqld->{'path_pid'}, sockfile => $mysqld->{'path_sock'}, port => $mysqld->{'port'}, + errfile => $mysqld->{'path_myerr'}, }); @@ -4731,12 +4786,10 @@ sub run_mysqltest ($) { mtr_add_arg($args, "%s", $_) for @args_saved; } - mtr_add_arg($args, "--test-file"); - mtr_add_arg($args, $tinfo->{'path'}); + mtr_add_arg($args, "--test-file=%s", $tinfo->{'path'}); if ( defined $tinfo->{'result_file'} ) { - mtr_add_arg($args, "--result-file"); - mtr_add_arg($args, $tinfo->{'result_file'}); + mtr_add_arg($args, "--result-file=%s", $tinfo->{'result_file'}); } if ( $opt_record ) diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result index 280cedb8b89..4eace9ac628 100644 --- a/mysql-test/r/alter_table.result +++ b/mysql-test/r/alter_table.result @@ -884,3 +884,22 @@ id 50 51 drop table t1; +set @orig_sql_mode = @@sql_mode; +set sql_mode="no_zero_date"; +create table t1(f1 int); +alter table t1 add column f2 datetime not null, add column f21 date not null; +insert into t1 values(1,'2000-01-01','2000-01-01'); +alter table t1 add column f3 datetime not null; +ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column 'f3' at row 1 +alter table t1 add column f3 date not null; +ERROR 22007: Incorrect date value: '0000-00-00' for column 'f3' at row 1 +alter table t1 add column f4 datetime not null default '2002-02-02', +add column f41 date not null; +ERROR 22007: Incorrect date value: '0000-00-00' for column 'f41' at row 1 +alter table t1 add column f4 datetime not null default '2002-02-02', +add column f41 date not null default '2002-02-02'; +select * from t1; +f1 f2 f21 f4 f41 +1 2000-01-01 00:00:00 2000-01-01 2002-02-02 00:00:00 2002-02-02 +drop table t1; +set sql_mode= @orig_sql_mode; diff --git a/mysql-test/r/analyse.result b/mysql-test/r/analyse.result index 0ecc462fb70..49722d5b0ab 100644 --- a/mysql-test/r/analyse.result +++ b/mysql-test/r/analyse.result @@ -39,10 +39,10 @@ t2 CREATE TABLE `t2` ( `Field_name` varbinary(255) NOT NULL default '', `Min_value` varbinary(255) default NULL, `Max_value` varbinary(255) default NULL, - `Min_length` int(11) NOT NULL default '0', - `Max_length` int(11) NOT NULL default '0', - `Empties_or_zeros` int(11) NOT NULL default '0', - `Nulls` int(11) NOT NULL default '0', + `Min_length` bigint(11) NOT NULL default '0', + `Max_length` bigint(11) NOT NULL default '0', + `Empties_or_zeros` bigint(11) NOT NULL default '0', + `Nulls` bigint(11) NOT NULL default '0', `Avg_value_or_avg_length` varbinary(255) NOT NULL default '', `Std` varbinary(255) default NULL, `Optimal_fieldtype` varbinary(64) NOT NULL default '' @@ -58,10 +58,10 @@ t2 CREATE TABLE `t2` ( `Field_name` varbinary(255) NOT NULL default '', `Min_value` varbinary(255) default NULL, `Max_value` varbinary(255) default NULL, - `Min_length` int(11) NOT NULL default '0', - `Max_length` int(11) NOT NULL default '0', - `Empties_or_zeros` int(11) NOT NULL default '0', - `Nulls` int(11) NOT NULL default '0', + `Min_length` bigint(11) NOT NULL default '0', + `Max_length` bigint(11) NOT NULL default '0', + `Empties_or_zeros` bigint(11) NOT NULL default '0', + `Nulls` bigint(11) NOT NULL default '0', `Avg_value_or_avg_length` varbinary(255) NOT NULL default '', `Std` varbinary(255) default NULL, `Optimal_fieldtype` varbinary(64) NOT NULL default '' @@ -81,10 +81,10 @@ t2 CREATE TABLE `t2` ( `Field_name` varbinary(255) NOT NULL default '', `Min_value` varbinary(255) default NULL, `Max_value` varbinary(255) default NULL, - `Min_length` int(11) NOT NULL default '0', - `Max_length` int(11) NOT NULL default '0', - `Empties_or_zeros` int(11) NOT NULL default '0', - `Nulls` int(11) NOT NULL default '0', + `Min_length` bigint(11) NOT NULL default '0', + `Max_length` bigint(11) NOT NULL default '0', + `Empties_or_zeros` bigint(11) NOT NULL default '0', + `Nulls` bigint(11) NOT NULL default '0', `Avg_value_or_avg_length` varbinary(255) NOT NULL default '', `Std` varbinary(255) default NULL, `Optimal_fieldtype` varbinary(64) NOT NULL default '' diff --git a/mysql-test/r/archive-big.result b/mysql-test/r/archive-big.result new file mode 100644 index 00000000000..7dbdb490017 --- /dev/null +++ b/mysql-test/r/archive-big.result @@ -0,0 +1,19 @@ +CREATE TABLE t1(a BLOB) ENGINE=ARCHIVE; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +DROP TABLE t1; diff --git a/mysql-test/r/archive.result b/mysql-test/r/archive.result index d89cecedcdd..b6a313ddf1a 100644 --- a/mysql-test/r/archive.result +++ b/mysql-test/r/archive.result @@ -12364,3 +12364,10 @@ select * from t1; i 1 drop table t1; +create table t1(a longblob) engine=archive; +insert into t1 set a=''; +insert into t1 set a='a'; +check table t1 extended; +Table Op Msg_type Msg_text +test.t1 check status OK +drop table t1; diff --git a/mysql-test/r/auto_increment.result b/mysql-test/r/auto_increment.result index d0058118e4c..90ba00e1019 100644 --- a/mysql-test/r/auto_increment.result +++ b/mysql-test/r/auto_increment.result @@ -232,7 +232,7 @@ a b delete from t1 where a=0; update t1 set a=NULL where b=6; Warnings: -Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'a' at row 4 +Warning 1048 Column 'a' cannot be null update t1 set a=300 where b=7; SET SQL_MODE=''; insert into t1(a,b)values(NULL,8); @@ -274,7 +274,7 @@ a b delete from t1 where a=0; update t1 set a=NULL where b=13; Warnings: -Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'a' at row 9 +Warning 1048 Column 'a' cannot be null update t1 set a=500 where b=14; select * from t1 order by b; a b diff --git a/mysql-test/r/backup.result b/mysql-test/r/backup.result index 29702e583cc..14313ba490f 100644 --- a/mysql-test/r/backup.result +++ b/mysql-test/r/backup.result @@ -4,18 +4,16 @@ create table t4(n int); backup table t4 to '../bogus'; Table Op Msg_type Msg_text test.t4 backup error Failed copying .frm file (errno: X) +test.t4 backup Error Can't create/write to file 'MYSQLTEST_VARDIR/bogus/t4.frm' (Errcode: X) test.t4 backup status Operation failed -Warnings: -Error 1 Can't create/write to file 'MYSQLTEST_VARDIR/bogus/t4.frm' (Errcode: X) backup table t4 to '../tmp'; Table Op Msg_type Msg_text test.t4 backup status OK backup table t4 to '../tmp'; Table Op Msg_type Msg_text test.t4 backup error Failed copying .frm file (errno: X) +test.t4 backup Error Can't create/write to file 'MYSQLTEST_VARDIR/tmp/t4.frm' (Errcode: X) test.t4 backup status Operation failed -Warnings: -Error 1 Can't create/write to file 'MYSQLTEST_VARDIR/tmp/t4.frm' (Errcode: X) drop table t4; restore table t4 from '../tmp'; Table Op Msg_type Msg_text diff --git a/mysql-test/r/bigint.result b/mysql-test/r/bigint.result index f18d1c9b583..064304b27aa 100644 --- a/mysql-test/r/bigint.result +++ b/mysql-test/r/bigint.result @@ -362,3 +362,29 @@ cast(-19999999999999999999 as signed) -9223372036854775808 Warnings: Error 1292 Truncated incorrect DECIMAL value: '' +select -9223372036854775808; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def -9223372036854775808 8 20 20 N 32897 0 63 +-9223372036854775808 +-9223372036854775808 +select -(9223372036854775808); +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def -(9223372036854775808) 8 20 20 N 32897 0 63 +-(9223372036854775808) +-9223372036854775808 +select -((9223372036854775808)); +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def -((9223372036854775808)) 8 20 20 N 32897 0 63 +-((9223372036854775808)) +-9223372036854775808 +select -(-(9223372036854775808)); +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def -(-(9223372036854775808)) 246 21 19 N 129 0 63 +-(-(9223372036854775808)) +9223372036854775808 +select --9223372036854775808, ---9223372036854775808, ----9223372036854775808; +--9223372036854775808 ---9223372036854775808 ----9223372036854775808 +9223372036854775808 -9223372036854775808 9223372036854775808 +select -(-9223372036854775808), -(-(-9223372036854775808)); +-(-9223372036854775808) -(-(-9223372036854775808)) +9223372036854775808 -9223372036854775808 diff --git a/mysql-test/r/binary.result b/mysql-test/r/binary.result index c5673d1c00d..c8b3768b7ce 100644 --- a/mysql-test/r/binary.result +++ b/mysql-test/r/binary.result @@ -160,3 +160,41 @@ hex(col1) 62000000000000000000 62200000000000000000 drop table t1; +CREATE TABLE t1 ( +a binary(20) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0', +index idx(a) +); +INSERT INTO t1 SET a=unhex('1F9480179366F2BF567E1C4B964C1EF029087575'); +INSERT INTO t1 SET a=unhex('1F9480179366F2BF567E1C4B964C1EF029082020'); +INSERT INTO t1 SET a=unhex('1F9480179366F2BF567E1C4B964C1EF029080707'); +SELECT hex(a) FROM t1 order by a; +hex(a) +1F9480179366F2BF567E1C4B964C1EF029080707 +1F9480179366F2BF567E1C4B964C1EF029082020 +1F9480179366F2BF567E1C4B964C1EF029087575 +EXPLAIN SELECT hex(a) FROM t1 order by a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL idx 20 NULL 3 Using index +SELECT hex(a) from t1 WHERE a=unhex('1F9480179366F2BF567E1C4B964C1EF029082020'); +hex(a) +1F9480179366F2BF567E1C4B964C1EF029082020 +EXPLAIN +SELECT hex(a) from t1 WHERE a=unhex('1F9480179366F2BF567E1C4B964C1EF029082020'); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx idx 20 const 1 Using where; Using index +SELECT hex(a) from t1 WHERE a=unhex('1F9480179366F2BF567E1C4B964C1EF02908'); +hex(a) +DROP TABLE t1; +CREATE TABLE t1 ( +id numeric(20) NOT NULL, +lang varchar(8) NOT NULL, +msg varchar(32) NOT NULL, +PRIMARY KEY (id,lang) +); +INSERT INTO t1 VALUES (33, 'en', 'zzzzzzz'); +INSERT INTO t1 VALUES (31, 'en', 'xxxxxxx'); +INSERT INTO t1 VALUES (32, 'en', 'yyyyyyy'); +SELECT * FROM t1 WHERE id=32; +id lang msg +32 en yyyyyyy +DROP TABLE t1; diff --git a/mysql-test/r/binlog.result b/mysql-test/r/binlog.result index 25930c31735..0a199c87545 100644 --- a/mysql-test/r/binlog.result +++ b/mysql-test/r/binlog.result @@ -1,6 +1,6 @@ drop table if exists t1, t2; reset master; -create table t1 (a int) engine=bdb; +create table t1 (a int) engine=innodb; create table t2 (a int) engine=innodb; begin; insert t1 values (5); @@ -10,14 +10,14 @@ insert t2 values (5); commit; show binlog events from 98; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query 1 # use `test`; create table t1 (a int) engine=bdb +master-bin.000001 # Query 1 # use `test`; create table t1 (a int) engine=innodb master-bin.000001 # Query 1 # use `test`; create table t2 (a int) engine=innodb master-bin.000001 # Query 1 # use `test`; BEGIN master-bin.000001 # Query 1 # use `test`; insert t1 values (5) -master-bin.000001 # Query 1 # use `test`; COMMIT +master-bin.000001 # Xid 1 # COMMIT /* XID */ master-bin.000001 # Query 1 # use `test`; BEGIN master-bin.000001 # Query 1 # use `test`; insert t2 values (5) -master-bin.000001 # Xid 1 # COMMIT /* xid=12 */ +master-bin.000001 # Xid 1 # COMMIT /* XID */ drop table t1,t2; reset master; create table t1 (n int) engine=innodb; @@ -128,8 +128,443 @@ master-bin.000001 # Query 1 # use `test`; insert into t1 values(4 + 4) master-bin.000001 # Query 1 # use `test`; insert into t1 values(3 + 4) master-bin.000001 # Query 1 # use `test`; insert into t1 values(2 + 4) master-bin.000001 # Query 1 # use `test`; insert into t1 values(1 + 4) -master-bin.000001 # Xid 1 # COMMIT /* xid=19 */ +master-bin.000001 # Xid 1 # COMMIT /* XID */ master-bin.000001 # Rotate 1 # master-bin.000002;pos=4 show binlog events in 'master-bin.000002' from 98; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000002 # Query 1 # use `test`; drop table t1 +set @ac = @@autocommit; +set autocommit= 0; +reset master; +create table t1(n int) engine=innodb; +begin; +insert into t1 values (1); +insert into t1 values (2); +insert into t1 values (3); +commit; +drop table t1; +show binlog events from 0; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 4 Format_desc 1 98 Server version, Binlog ver: 4 +master-bin.000001 98 Query 1 197 use `test`; create table t1(n int) engine=innodb +master-bin.000001 197 Query 1 265 use `test`; BEGIN +master-bin.000001 265 Query 1 353 use `test`; insert into t1 values (1) +master-bin.000001 353 Query 1 441 use `test`; insert into t1 values (2) +master-bin.000001 441 Query 1 529 use `test`; insert into t1 values (3) +master-bin.000001 529 Xid 1 556 COMMIT /* XID */ +master-bin.000001 556 Query 1 632 use `test`; drop table t1 +set @bcs = @@binlog_cache_size; +set global binlog_cache_size=4096; +reset master; +create table t1 (a int) engine=innodb; +show binlog events from 0; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 4 Format_desc 1 98 Server version, Binlog ver: 4 +master-bin.000001 98 Query 1 198 use `test`; create table t1 (a int) engine=innodb +master-bin.000001 198 Query 1 266 use `test`; BEGIN +master-bin.000001 266 Query 1 357 use `test`; insert into t1 values( 400 ) +master-bin.000001 357 Query 1 448 use `test`; insert into t1 values( 399 ) +master-bin.000001 448 Query 1 539 use `test`; insert into t1 values( 398 ) +master-bin.000001 539 Query 1 630 use `test`; insert into t1 values( 397 ) +master-bin.000001 630 Query 1 721 use `test`; insert into t1 values( 396 ) +master-bin.000001 721 Query 1 812 use `test`; insert into t1 values( 395 ) +master-bin.000001 812 Query 1 903 use `test`; insert into t1 values( 394 ) +master-bin.000001 903 Query 1 994 use `test`; insert into t1 values( 393 ) +master-bin.000001 994 Query 1 1085 use `test`; insert into t1 values( 392 ) +master-bin.000001 1085 Query 1 1176 use `test`; insert into t1 values( 391 ) +master-bin.000001 1176 Query 1 1267 use `test`; insert into t1 values( 390 ) +master-bin.000001 1267 Query 1 1358 use `test`; insert into t1 values( 389 ) +master-bin.000001 1358 Query 1 1449 use `test`; insert into t1 values( 388 ) +master-bin.000001 1449 Query 1 1540 use `test`; insert into t1 values( 387 ) +master-bin.000001 1540 Query 1 1631 use `test`; insert into t1 values( 386 ) +master-bin.000001 1631 Query 1 1722 use `test`; insert into t1 values( 385 ) +master-bin.000001 1722 Query 1 1813 use `test`; insert into t1 values( 384 ) +master-bin.000001 1813 Query 1 1904 use `test`; insert into t1 values( 383 ) +master-bin.000001 1904 Query 1 1995 use `test`; insert into t1 values( 382 ) +master-bin.000001 1995 Query 1 2086 use `test`; insert into t1 values( 381 ) +master-bin.000001 2086 Query 1 2177 use `test`; insert into t1 values( 380 ) +master-bin.000001 2177 Query 1 2268 use `test`; insert into t1 values( 379 ) +master-bin.000001 2268 Query 1 2359 use `test`; insert into t1 values( 378 ) +master-bin.000001 2359 Query 1 2450 use `test`; insert into t1 values( 377 ) +master-bin.000001 2450 Query 1 2541 use `test`; insert into t1 values( 376 ) +master-bin.000001 2541 Query 1 2632 use `test`; insert into t1 values( 375 ) +master-bin.000001 2632 Query 1 2723 use `test`; insert into t1 values( 374 ) +master-bin.000001 2723 Query 1 2814 use `test`; insert into t1 values( 373 ) +master-bin.000001 2814 Query 1 2905 use `test`; insert into t1 values( 372 ) +master-bin.000001 2905 Query 1 2996 use `test`; insert into t1 values( 371 ) +master-bin.000001 2996 Query 1 3087 use `test`; insert into t1 values( 370 ) +master-bin.000001 3087 Query 1 3178 use `test`; insert into t1 values( 369 ) +master-bin.000001 3178 Query 1 3269 use `test`; insert into t1 values( 368 ) +master-bin.000001 3269 Query 1 3360 use `test`; insert into t1 values( 367 ) +master-bin.000001 3360 Query 1 3451 use `test`; insert into t1 values( 366 ) +master-bin.000001 3451 Query 1 3542 use `test`; insert into t1 values( 365 ) +master-bin.000001 3542 Query 1 3633 use `test`; insert into t1 values( 364 ) +master-bin.000001 3633 Query 1 3724 use `test`; insert into t1 values( 363 ) +master-bin.000001 3724 Query 1 3815 use `test`; insert into t1 values( 362 ) +master-bin.000001 3815 Query 1 3906 use `test`; insert into t1 values( 361 ) +master-bin.000001 3906 Query 1 3997 use `test`; insert into t1 values( 360 ) +master-bin.000001 3997 Query 1 4088 use `test`; insert into t1 values( 359 ) +master-bin.000001 4088 Query 1 4179 use `test`; insert into t1 values( 358 ) +master-bin.000001 4179 Query 1 4270 use `test`; insert into t1 values( 357 ) +master-bin.000001 4270 Query 1 4361 use `test`; insert into t1 values( 356 ) +master-bin.000001 4361 Query 1 4452 use `test`; insert into t1 values( 355 ) +master-bin.000001 4452 Query 1 4543 use `test`; insert into t1 values( 354 ) +master-bin.000001 4543 Query 1 4634 use `test`; insert into t1 values( 353 ) +master-bin.000001 4634 Query 1 4725 use `test`; insert into t1 values( 352 ) +master-bin.000001 4725 Query 1 4816 use `test`; insert into t1 values( 351 ) +master-bin.000001 4816 Query 1 4907 use `test`; insert into t1 values( 350 ) +master-bin.000001 4907 Query 1 4998 use `test`; insert into t1 values( 349 ) +master-bin.000001 4998 Query 1 5089 use `test`; insert into t1 values( 348 ) +master-bin.000001 5089 Query 1 5180 use `test`; insert into t1 values( 347 ) +master-bin.000001 5180 Query 1 5271 use `test`; insert into t1 values( 346 ) +master-bin.000001 5271 Query 1 5362 use `test`; insert into t1 values( 345 ) +master-bin.000001 5362 Query 1 5453 use `test`; insert into t1 values( 344 ) +master-bin.000001 5453 Query 1 5544 use `test`; insert into t1 values( 343 ) +master-bin.000001 5544 Query 1 5635 use `test`; insert into t1 values( 342 ) +master-bin.000001 5635 Query 1 5726 use `test`; insert into t1 values( 341 ) +master-bin.000001 5726 Query 1 5817 use `test`; insert into t1 values( 340 ) +master-bin.000001 5817 Query 1 5908 use `test`; insert into t1 values( 339 ) +master-bin.000001 5908 Query 1 5999 use `test`; insert into t1 values( 338 ) +master-bin.000001 5999 Query 1 6090 use `test`; insert into t1 values( 337 ) +master-bin.000001 6090 Query 1 6181 use `test`; insert into t1 values( 336 ) +master-bin.000001 6181 Query 1 6272 use `test`; insert into t1 values( 335 ) +master-bin.000001 6272 Query 1 6363 use `test`; insert into t1 values( 334 ) +master-bin.000001 6363 Query 1 6454 use `test`; insert into t1 values( 333 ) +master-bin.000001 6454 Query 1 6545 use `test`; insert into t1 values( 332 ) +master-bin.000001 6545 Query 1 6636 use `test`; insert into t1 values( 331 ) +master-bin.000001 6636 Query 1 6727 use `test`; insert into t1 values( 330 ) +master-bin.000001 6727 Query 1 6818 use `test`; insert into t1 values( 329 ) +master-bin.000001 6818 Query 1 6909 use `test`; insert into t1 values( 328 ) +master-bin.000001 6909 Query 1 7000 use `test`; insert into t1 values( 327 ) +master-bin.000001 7000 Query 1 7091 use `test`; insert into t1 values( 326 ) +master-bin.000001 7091 Query 1 7182 use `test`; insert into t1 values( 325 ) +master-bin.000001 7182 Query 1 7273 use `test`; insert into t1 values( 324 ) +master-bin.000001 7273 Query 1 7364 use `test`; insert into t1 values( 323 ) +master-bin.000001 7364 Query 1 7455 use `test`; insert into t1 values( 322 ) +master-bin.000001 7455 Query 1 7546 use `test`; insert into t1 values( 321 ) +master-bin.000001 7546 Query 1 7637 use `test`; insert into t1 values( 320 ) +master-bin.000001 7637 Query 1 7728 use `test`; insert into t1 values( 319 ) +master-bin.000001 7728 Query 1 7819 use `test`; insert into t1 values( 318 ) +master-bin.000001 7819 Query 1 7910 use `test`; insert into t1 values( 317 ) +master-bin.000001 7910 Query 1 8001 use `test`; insert into t1 values( 316 ) +master-bin.000001 8001 Query 1 8092 use `test`; insert into t1 values( 315 ) +master-bin.000001 8092 Query 1 8183 use `test`; insert into t1 values( 314 ) +master-bin.000001 8183 Query 1 8274 use `test`; insert into t1 values( 313 ) +master-bin.000001 8274 Query 1 8365 use `test`; insert into t1 values( 312 ) +master-bin.000001 8365 Query 1 8456 use `test`; insert into t1 values( 311 ) +master-bin.000001 8456 Query 1 8547 use `test`; insert into t1 values( 310 ) +master-bin.000001 8547 Query 1 8638 use `test`; insert into t1 values( 309 ) +master-bin.000001 8638 Query 1 8729 use `test`; insert into t1 values( 308 ) +master-bin.000001 8729 Query 1 8820 use `test`; insert into t1 values( 307 ) +master-bin.000001 8820 Query 1 8911 use `test`; insert into t1 values( 306 ) +master-bin.000001 8911 Query 1 9002 use `test`; insert into t1 values( 305 ) +master-bin.000001 9002 Query 1 9093 use `test`; insert into t1 values( 304 ) +master-bin.000001 9093 Query 1 9184 use `test`; insert into t1 values( 303 ) +master-bin.000001 9184 Query 1 9275 use `test`; insert into t1 values( 302 ) +master-bin.000001 9275 Query 1 9366 use `test`; insert into t1 values( 301 ) +master-bin.000001 9366 Query 1 9457 use `test`; insert into t1 values( 300 ) +master-bin.000001 9457 Query 1 9548 use `test`; insert into t1 values( 299 ) +master-bin.000001 9548 Query 1 9639 use `test`; insert into t1 values( 298 ) +master-bin.000001 9639 Query 1 9730 use `test`; insert into t1 values( 297 ) +master-bin.000001 9730 Query 1 9821 use `test`; insert into t1 values( 296 ) +master-bin.000001 9821 Query 1 9912 use `test`; insert into t1 values( 295 ) +master-bin.000001 9912 Query 1 10003 use `test`; insert into t1 values( 294 ) +master-bin.000001 10003 Query 1 10094 use `test`; insert into t1 values( 293 ) +master-bin.000001 10094 Query 1 10185 use `test`; insert into t1 values( 292 ) +master-bin.000001 10185 Query 1 10276 use `test`; insert into t1 values( 291 ) +master-bin.000001 10276 Query 1 10367 use `test`; insert into t1 values( 290 ) +master-bin.000001 10367 Query 1 10458 use `test`; insert into t1 values( 289 ) +master-bin.000001 10458 Query 1 10549 use `test`; insert into t1 values( 288 ) +master-bin.000001 10549 Query 1 10640 use `test`; insert into t1 values( 287 ) +master-bin.000001 10640 Query 1 10731 use `test`; insert into t1 values( 286 ) +master-bin.000001 10731 Query 1 10822 use `test`; insert into t1 values( 285 ) +master-bin.000001 10822 Query 1 10913 use `test`; insert into t1 values( 284 ) +master-bin.000001 10913 Query 1 11004 use `test`; insert into t1 values( 283 ) +master-bin.000001 11004 Query 1 11095 use `test`; insert into t1 values( 282 ) +master-bin.000001 11095 Query 1 11186 use `test`; insert into t1 values( 281 ) +master-bin.000001 11186 Query 1 11277 use `test`; insert into t1 values( 280 ) +master-bin.000001 11277 Query 1 11368 use `test`; insert into t1 values( 279 ) +master-bin.000001 11368 Query 1 11459 use `test`; insert into t1 values( 278 ) +master-bin.000001 11459 Query 1 11550 use `test`; insert into t1 values( 277 ) +master-bin.000001 11550 Query 1 11641 use `test`; insert into t1 values( 276 ) +master-bin.000001 11641 Query 1 11732 use `test`; insert into t1 values( 275 ) +master-bin.000001 11732 Query 1 11823 use `test`; insert into t1 values( 274 ) +master-bin.000001 11823 Query 1 11914 use `test`; insert into t1 values( 273 ) +master-bin.000001 11914 Query 1 12005 use `test`; insert into t1 values( 272 ) +master-bin.000001 12005 Query 1 12096 use `test`; insert into t1 values( 271 ) +master-bin.000001 12096 Query 1 12187 use `test`; insert into t1 values( 270 ) +master-bin.000001 12187 Query 1 12278 use `test`; insert into t1 values( 269 ) +master-bin.000001 12278 Query 1 12369 use `test`; insert into t1 values( 268 ) +master-bin.000001 12369 Query 1 12460 use `test`; insert into t1 values( 267 ) +master-bin.000001 12460 Query 1 12551 use `test`; insert into t1 values( 266 ) +master-bin.000001 12551 Query 1 12642 use `test`; insert into t1 values( 265 ) +master-bin.000001 12642 Query 1 12733 use `test`; insert into t1 values( 264 ) +master-bin.000001 12733 Query 1 12824 use `test`; insert into t1 values( 263 ) +master-bin.000001 12824 Query 1 12915 use `test`; insert into t1 values( 262 ) +master-bin.000001 12915 Query 1 13006 use `test`; insert into t1 values( 261 ) +master-bin.000001 13006 Query 1 13097 use `test`; insert into t1 values( 260 ) +master-bin.000001 13097 Query 1 13188 use `test`; insert into t1 values( 259 ) +master-bin.000001 13188 Query 1 13279 use `test`; insert into t1 values( 258 ) +master-bin.000001 13279 Query 1 13370 use `test`; insert into t1 values( 257 ) +master-bin.000001 13370 Query 1 13461 use `test`; insert into t1 values( 256 ) +master-bin.000001 13461 Query 1 13552 use `test`; insert into t1 values( 255 ) +master-bin.000001 13552 Query 1 13643 use `test`; insert into t1 values( 254 ) +master-bin.000001 13643 Query 1 13734 use `test`; insert into t1 values( 253 ) +master-bin.000001 13734 Query 1 13825 use `test`; insert into t1 values( 252 ) +master-bin.000001 13825 Query 1 13916 use `test`; insert into t1 values( 251 ) +master-bin.000001 13916 Query 1 14007 use `test`; insert into t1 values( 250 ) +master-bin.000001 14007 Query 1 14098 use `test`; insert into t1 values( 249 ) +master-bin.000001 14098 Query 1 14189 use `test`; insert into t1 values( 248 ) +master-bin.000001 14189 Query 1 14280 use `test`; insert into t1 values( 247 ) +master-bin.000001 14280 Query 1 14371 use `test`; insert into t1 values( 246 ) +master-bin.000001 14371 Query 1 14462 use `test`; insert into t1 values( 245 ) +master-bin.000001 14462 Query 1 14553 use `test`; insert into t1 values( 244 ) +master-bin.000001 14553 Query 1 14644 use `test`; insert into t1 values( 243 ) +master-bin.000001 14644 Query 1 14735 use `test`; insert into t1 values( 242 ) +master-bin.000001 14735 Query 1 14826 use `test`; insert into t1 values( 241 ) +master-bin.000001 14826 Query 1 14917 use `test`; insert into t1 values( 240 ) +master-bin.000001 14917 Query 1 15008 use `test`; insert into t1 values( 239 ) +master-bin.000001 15008 Query 1 15099 use `test`; insert into t1 values( 238 ) +master-bin.000001 15099 Query 1 15190 use `test`; insert into t1 values( 237 ) +master-bin.000001 15190 Query 1 15281 use `test`; insert into t1 values( 236 ) +master-bin.000001 15281 Query 1 15372 use `test`; insert into t1 values( 235 ) +master-bin.000001 15372 Query 1 15463 use `test`; insert into t1 values( 234 ) +master-bin.000001 15463 Query 1 15554 use `test`; insert into t1 values( 233 ) +master-bin.000001 15554 Query 1 15645 use `test`; insert into t1 values( 232 ) +master-bin.000001 15645 Query 1 15736 use `test`; insert into t1 values( 231 ) +master-bin.000001 15736 Query 1 15827 use `test`; insert into t1 values( 230 ) +master-bin.000001 15827 Query 1 15918 use `test`; insert into t1 values( 229 ) +master-bin.000001 15918 Query 1 16009 use `test`; insert into t1 values( 228 ) +master-bin.000001 16009 Query 1 16100 use `test`; insert into t1 values( 227 ) +master-bin.000001 16100 Query 1 16191 use `test`; insert into t1 values( 226 ) +master-bin.000001 16191 Query 1 16282 use `test`; insert into t1 values( 225 ) +master-bin.000001 16282 Query 1 16373 use `test`; insert into t1 values( 224 ) +master-bin.000001 16373 Query 1 16464 use `test`; insert into t1 values( 223 ) +master-bin.000001 16464 Query 1 16555 use `test`; insert into t1 values( 222 ) +master-bin.000001 16555 Query 1 16646 use `test`; insert into t1 values( 221 ) +master-bin.000001 16646 Query 1 16737 use `test`; insert into t1 values( 220 ) +master-bin.000001 16737 Query 1 16828 use `test`; insert into t1 values( 219 ) +master-bin.000001 16828 Query 1 16919 use `test`; insert into t1 values( 218 ) +master-bin.000001 16919 Query 1 17010 use `test`; insert into t1 values( 217 ) +master-bin.000001 17010 Query 1 17101 use `test`; insert into t1 values( 216 ) +master-bin.000001 17101 Query 1 17192 use `test`; insert into t1 values( 215 ) +master-bin.000001 17192 Query 1 17283 use `test`; insert into t1 values( 214 ) +master-bin.000001 17283 Query 1 17374 use `test`; insert into t1 values( 213 ) +master-bin.000001 17374 Query 1 17465 use `test`; insert into t1 values( 212 ) +master-bin.000001 17465 Query 1 17556 use `test`; insert into t1 values( 211 ) +master-bin.000001 17556 Query 1 17647 use `test`; insert into t1 values( 210 ) +master-bin.000001 17647 Query 1 17738 use `test`; insert into t1 values( 209 ) +master-bin.000001 17738 Query 1 17829 use `test`; insert into t1 values( 208 ) +master-bin.000001 17829 Query 1 17920 use `test`; insert into t1 values( 207 ) +master-bin.000001 17920 Query 1 18011 use `test`; insert into t1 values( 206 ) +master-bin.000001 18011 Query 1 18102 use `test`; insert into t1 values( 205 ) +master-bin.000001 18102 Query 1 18193 use `test`; insert into t1 values( 204 ) +master-bin.000001 18193 Query 1 18284 use `test`; insert into t1 values( 203 ) +master-bin.000001 18284 Query 1 18375 use `test`; insert into t1 values( 202 ) +master-bin.000001 18375 Query 1 18466 use `test`; insert into t1 values( 201 ) +master-bin.000001 18466 Query 1 18557 use `test`; insert into t1 values( 200 ) +master-bin.000001 18557 Query 1 18648 use `test`; insert into t1 values( 199 ) +master-bin.000001 18648 Query 1 18739 use `test`; insert into t1 values( 198 ) +master-bin.000001 18739 Query 1 18830 use `test`; insert into t1 values( 197 ) +master-bin.000001 18830 Query 1 18921 use `test`; insert into t1 values( 196 ) +master-bin.000001 18921 Query 1 19012 use `test`; insert into t1 values( 195 ) +master-bin.000001 19012 Query 1 19103 use `test`; insert into t1 values( 194 ) +master-bin.000001 19103 Query 1 19194 use `test`; insert into t1 values( 193 ) +master-bin.000001 19194 Query 1 19285 use `test`; insert into t1 values( 192 ) +master-bin.000001 19285 Query 1 19376 use `test`; insert into t1 values( 191 ) +master-bin.000001 19376 Query 1 19467 use `test`; insert into t1 values( 190 ) +master-bin.000001 19467 Query 1 19558 use `test`; insert into t1 values( 189 ) +master-bin.000001 19558 Query 1 19649 use `test`; insert into t1 values( 188 ) +master-bin.000001 19649 Query 1 19740 use `test`; insert into t1 values( 187 ) +master-bin.000001 19740 Query 1 19831 use `test`; insert into t1 values( 186 ) +master-bin.000001 19831 Query 1 19922 use `test`; insert into t1 values( 185 ) +master-bin.000001 19922 Query 1 20013 use `test`; insert into t1 values( 184 ) +master-bin.000001 20013 Query 1 20104 use `test`; insert into t1 values( 183 ) +master-bin.000001 20104 Query 1 20195 use `test`; insert into t1 values( 182 ) +master-bin.000001 20195 Query 1 20286 use `test`; insert into t1 values( 181 ) +master-bin.000001 20286 Query 1 20377 use `test`; insert into t1 values( 180 ) +master-bin.000001 20377 Query 1 20468 use `test`; insert into t1 values( 179 ) +master-bin.000001 20468 Query 1 20559 use `test`; insert into t1 values( 178 ) +master-bin.000001 20559 Query 1 20650 use `test`; insert into t1 values( 177 ) +master-bin.000001 20650 Query 1 20741 use `test`; insert into t1 values( 176 ) +master-bin.000001 20741 Query 1 20832 use `test`; insert into t1 values( 175 ) +master-bin.000001 20832 Query 1 20923 use `test`; insert into t1 values( 174 ) +master-bin.000001 20923 Query 1 21014 use `test`; insert into t1 values( 173 ) +master-bin.000001 21014 Query 1 21105 use `test`; insert into t1 values( 172 ) +master-bin.000001 21105 Query 1 21196 use `test`; insert into t1 values( 171 ) +master-bin.000001 21196 Query 1 21287 use `test`; insert into t1 values( 170 ) +master-bin.000001 21287 Query 1 21378 use `test`; insert into t1 values( 169 ) +master-bin.000001 21378 Query 1 21469 use `test`; insert into t1 values( 168 ) +master-bin.000001 21469 Query 1 21560 use `test`; insert into t1 values( 167 ) +master-bin.000001 21560 Query 1 21651 use `test`; insert into t1 values( 166 ) +master-bin.000001 21651 Query 1 21742 use `test`; insert into t1 values( 165 ) +master-bin.000001 21742 Query 1 21833 use `test`; insert into t1 values( 164 ) +master-bin.000001 21833 Query 1 21924 use `test`; insert into t1 values( 163 ) +master-bin.000001 21924 Query 1 22015 use `test`; insert into t1 values( 162 ) +master-bin.000001 22015 Query 1 22106 use `test`; insert into t1 values( 161 ) +master-bin.000001 22106 Query 1 22197 use `test`; insert into t1 values( 160 ) +master-bin.000001 22197 Query 1 22288 use `test`; insert into t1 values( 159 ) +master-bin.000001 22288 Query 1 22379 use `test`; insert into t1 values( 158 ) +master-bin.000001 22379 Query 1 22470 use `test`; insert into t1 values( 157 ) +master-bin.000001 22470 Query 1 22561 use `test`; insert into t1 values( 156 ) +master-bin.000001 22561 Query 1 22652 use `test`; insert into t1 values( 155 ) +master-bin.000001 22652 Query 1 22743 use `test`; insert into t1 values( 154 ) +master-bin.000001 22743 Query 1 22834 use `test`; insert into t1 values( 153 ) +master-bin.000001 22834 Query 1 22925 use `test`; insert into t1 values( 152 ) +master-bin.000001 22925 Query 1 23016 use `test`; insert into t1 values( 151 ) +master-bin.000001 23016 Query 1 23107 use `test`; insert into t1 values( 150 ) +master-bin.000001 23107 Query 1 23198 use `test`; insert into t1 values( 149 ) +master-bin.000001 23198 Query 1 23289 use `test`; insert into t1 values( 148 ) +master-bin.000001 23289 Query 1 23380 use `test`; insert into t1 values( 147 ) +master-bin.000001 23380 Query 1 23471 use `test`; insert into t1 values( 146 ) +master-bin.000001 23471 Query 1 23562 use `test`; insert into t1 values( 145 ) +master-bin.000001 23562 Query 1 23653 use `test`; insert into t1 values( 144 ) +master-bin.000001 23653 Query 1 23744 use `test`; insert into t1 values( 143 ) +master-bin.000001 23744 Query 1 23835 use `test`; insert into t1 values( 142 ) +master-bin.000001 23835 Query 1 23926 use `test`; insert into t1 values( 141 ) +master-bin.000001 23926 Query 1 24017 use `test`; insert into t1 values( 140 ) +master-bin.000001 24017 Query 1 24108 use `test`; insert into t1 values( 139 ) +master-bin.000001 24108 Query 1 24199 use `test`; insert into t1 values( 138 ) +master-bin.000001 24199 Query 1 24290 use `test`; insert into t1 values( 137 ) +master-bin.000001 24290 Query 1 24381 use `test`; insert into t1 values( 136 ) +master-bin.000001 24381 Query 1 24472 use `test`; insert into t1 values( 135 ) +master-bin.000001 24472 Query 1 24563 use `test`; insert into t1 values( 134 ) +master-bin.000001 24563 Query 1 24654 use `test`; insert into t1 values( 133 ) +master-bin.000001 24654 Query 1 24745 use `test`; insert into t1 values( 132 ) +master-bin.000001 24745 Query 1 24836 use `test`; insert into t1 values( 131 ) +master-bin.000001 24836 Query 1 24927 use `test`; insert into t1 values( 130 ) +master-bin.000001 24927 Query 1 25018 use `test`; insert into t1 values( 129 ) +master-bin.000001 25018 Query 1 25109 use `test`; insert into t1 values( 128 ) +master-bin.000001 25109 Query 1 25200 use `test`; insert into t1 values( 127 ) +master-bin.000001 25200 Query 1 25291 use `test`; insert into t1 values( 126 ) +master-bin.000001 25291 Query 1 25382 use `test`; insert into t1 values( 125 ) +master-bin.000001 25382 Query 1 25473 use `test`; insert into t1 values( 124 ) +master-bin.000001 25473 Query 1 25564 use `test`; insert into t1 values( 123 ) +master-bin.000001 25564 Query 1 25655 use `test`; insert into t1 values( 122 ) +master-bin.000001 25655 Query 1 25746 use `test`; insert into t1 values( 121 ) +master-bin.000001 25746 Query 1 25837 use `test`; insert into t1 values( 120 ) +master-bin.000001 25837 Query 1 25928 use `test`; insert into t1 values( 119 ) +master-bin.000001 25928 Query 1 26019 use `test`; insert into t1 values( 118 ) +master-bin.000001 26019 Query 1 26110 use `test`; insert into t1 values( 117 ) +master-bin.000001 26110 Query 1 26201 use `test`; insert into t1 values( 116 ) +master-bin.000001 26201 Query 1 26292 use `test`; insert into t1 values( 115 ) +master-bin.000001 26292 Query 1 26383 use `test`; insert into t1 values( 114 ) +master-bin.000001 26383 Query 1 26474 use `test`; insert into t1 values( 113 ) +master-bin.000001 26474 Query 1 26565 use `test`; insert into t1 values( 112 ) +master-bin.000001 26565 Query 1 26656 use `test`; insert into t1 values( 111 ) +master-bin.000001 26656 Query 1 26747 use `test`; insert into t1 values( 110 ) +master-bin.000001 26747 Query 1 26838 use `test`; insert into t1 values( 109 ) +master-bin.000001 26838 Query 1 26929 use `test`; insert into t1 values( 108 ) +master-bin.000001 26929 Query 1 27020 use `test`; insert into t1 values( 107 ) +master-bin.000001 27020 Query 1 27111 use `test`; insert into t1 values( 106 ) +master-bin.000001 27111 Query 1 27202 use `test`; insert into t1 values( 105 ) +master-bin.000001 27202 Query 1 27293 use `test`; insert into t1 values( 104 ) +master-bin.000001 27293 Query 1 27384 use `test`; insert into t1 values( 103 ) +master-bin.000001 27384 Query 1 27475 use `test`; insert into t1 values( 102 ) +master-bin.000001 27475 Query 1 27566 use `test`; insert into t1 values( 101 ) +master-bin.000001 27566 Query 1 27657 use `test`; insert into t1 values( 100 ) +master-bin.000001 27657 Query 1 27747 use `test`; insert into t1 values( 99 ) +master-bin.000001 27747 Query 1 27837 use `test`; insert into t1 values( 98 ) +master-bin.000001 27837 Query 1 27927 use `test`; insert into t1 values( 97 ) +master-bin.000001 27927 Query 1 28017 use `test`; insert into t1 values( 96 ) +master-bin.000001 28017 Query 1 28107 use `test`; insert into t1 values( 95 ) +master-bin.000001 28107 Query 1 28197 use `test`; insert into t1 values( 94 ) +master-bin.000001 28197 Query 1 28287 use `test`; insert into t1 values( 93 ) +master-bin.000001 28287 Query 1 28377 use `test`; insert into t1 values( 92 ) +master-bin.000001 28377 Query 1 28467 use `test`; insert into t1 values( 91 ) +master-bin.000001 28467 Query 1 28557 use `test`; insert into t1 values( 90 ) +master-bin.000001 28557 Query 1 28647 use `test`; insert into t1 values( 89 ) +master-bin.000001 28647 Query 1 28737 use `test`; insert into t1 values( 88 ) +master-bin.000001 28737 Query 1 28827 use `test`; insert into t1 values( 87 ) +master-bin.000001 28827 Query 1 28917 use `test`; insert into t1 values( 86 ) +master-bin.000001 28917 Query 1 29007 use `test`; insert into t1 values( 85 ) +master-bin.000001 29007 Query 1 29097 use `test`; insert into t1 values( 84 ) +master-bin.000001 29097 Query 1 29187 use `test`; insert into t1 values( 83 ) +master-bin.000001 29187 Query 1 29277 use `test`; insert into t1 values( 82 ) +master-bin.000001 29277 Query 1 29367 use `test`; insert into t1 values( 81 ) +master-bin.000001 29367 Query 1 29457 use `test`; insert into t1 values( 80 ) +master-bin.000001 29457 Query 1 29547 use `test`; insert into t1 values( 79 ) +master-bin.000001 29547 Query 1 29637 use `test`; insert into t1 values( 78 ) +master-bin.000001 29637 Query 1 29727 use `test`; insert into t1 values( 77 ) +master-bin.000001 29727 Query 1 29817 use `test`; insert into t1 values( 76 ) +master-bin.000001 29817 Query 1 29907 use `test`; insert into t1 values( 75 ) +master-bin.000001 29907 Query 1 29997 use `test`; insert into t1 values( 74 ) +master-bin.000001 29997 Query 1 30087 use `test`; insert into t1 values( 73 ) +master-bin.000001 30087 Query 1 30177 use `test`; insert into t1 values( 72 ) +master-bin.000001 30177 Query 1 30267 use `test`; insert into t1 values( 71 ) +master-bin.000001 30267 Query 1 30357 use `test`; insert into t1 values( 70 ) +master-bin.000001 30357 Query 1 30447 use `test`; insert into t1 values( 69 ) +master-bin.000001 30447 Query 1 30537 use `test`; insert into t1 values( 68 ) +master-bin.000001 30537 Query 1 30627 use `test`; insert into t1 values( 67 ) +master-bin.000001 30627 Query 1 30717 use `test`; insert into t1 values( 66 ) +master-bin.000001 30717 Query 1 30807 use `test`; insert into t1 values( 65 ) +master-bin.000001 30807 Query 1 30897 use `test`; insert into t1 values( 64 ) +master-bin.000001 30897 Query 1 30987 use `test`; insert into t1 values( 63 ) +master-bin.000001 30987 Query 1 31077 use `test`; insert into t1 values( 62 ) +master-bin.000001 31077 Query 1 31167 use `test`; insert into t1 values( 61 ) +master-bin.000001 31167 Query 1 31257 use `test`; insert into t1 values( 60 ) +master-bin.000001 31257 Query 1 31347 use `test`; insert into t1 values( 59 ) +master-bin.000001 31347 Query 1 31437 use `test`; insert into t1 values( 58 ) +master-bin.000001 31437 Query 1 31527 use `test`; insert into t1 values( 57 ) +master-bin.000001 31527 Query 1 31617 use `test`; insert into t1 values( 56 ) +master-bin.000001 31617 Query 1 31707 use `test`; insert into t1 values( 55 ) +master-bin.000001 31707 Query 1 31797 use `test`; insert into t1 values( 54 ) +master-bin.000001 31797 Query 1 31887 use `test`; insert into t1 values( 53 ) +master-bin.000001 31887 Query 1 31977 use `test`; insert into t1 values( 52 ) +master-bin.000001 31977 Query 1 32067 use `test`; insert into t1 values( 51 ) +master-bin.000001 32067 Query 1 32157 use `test`; insert into t1 values( 50 ) +master-bin.000001 32157 Query 1 32247 use `test`; insert into t1 values( 49 ) +master-bin.000001 32247 Query 1 32337 use `test`; insert into t1 values( 48 ) +master-bin.000001 32337 Query 1 32427 use `test`; insert into t1 values( 47 ) +master-bin.000001 32427 Query 1 32517 use `test`; insert into t1 values( 46 ) +master-bin.000001 32517 Query 1 32607 use `test`; insert into t1 values( 45 ) +master-bin.000001 32607 Query 1 32697 use `test`; insert into t1 values( 44 ) +master-bin.000001 32697 Query 1 32787 use `test`; insert into t1 values( 43 ) +master-bin.000001 32787 Query 1 32877 use `test`; insert into t1 values( 42 ) +master-bin.000001 32877 Query 1 32967 use `test`; insert into t1 values( 41 ) +master-bin.000001 32967 Query 1 33057 use `test`; insert into t1 values( 40 ) +master-bin.000001 33057 Query 1 33147 use `test`; insert into t1 values( 39 ) +master-bin.000001 33147 Query 1 33237 use `test`; insert into t1 values( 38 ) +master-bin.000001 33237 Query 1 33327 use `test`; insert into t1 values( 37 ) +master-bin.000001 33327 Query 1 33417 use `test`; insert into t1 values( 36 ) +master-bin.000001 33417 Query 1 33507 use `test`; insert into t1 values( 35 ) +master-bin.000001 33507 Query 1 33597 use `test`; insert into t1 values( 34 ) +master-bin.000001 33597 Query 1 33687 use `test`; insert into t1 values( 33 ) +master-bin.000001 33687 Query 1 33777 use `test`; insert into t1 values( 32 ) +master-bin.000001 33777 Query 1 33867 use `test`; insert into t1 values( 31 ) +master-bin.000001 33867 Query 1 33957 use `test`; insert into t1 values( 30 ) +master-bin.000001 33957 Query 1 34047 use `test`; insert into t1 values( 29 ) +master-bin.000001 34047 Query 1 34137 use `test`; insert into t1 values( 28 ) +master-bin.000001 34137 Query 1 34227 use `test`; insert into t1 values( 27 ) +master-bin.000001 34227 Query 1 34317 use `test`; insert into t1 values( 26 ) +master-bin.000001 34317 Query 1 34407 use `test`; insert into t1 values( 25 ) +master-bin.000001 34407 Query 1 34497 use `test`; insert into t1 values( 24 ) +master-bin.000001 34497 Query 1 34587 use `test`; insert into t1 values( 23 ) +master-bin.000001 34587 Query 1 34677 use `test`; insert into t1 values( 22 ) +master-bin.000001 34677 Query 1 34767 use `test`; insert into t1 values( 21 ) +master-bin.000001 34767 Query 1 34857 use `test`; insert into t1 values( 20 ) +master-bin.000001 34857 Query 1 34947 use `test`; insert into t1 values( 19 ) +master-bin.000001 34947 Query 1 35037 use `test`; insert into t1 values( 18 ) +master-bin.000001 35037 Query 1 35127 use `test`; insert into t1 values( 17 ) +master-bin.000001 35127 Query 1 35217 use `test`; insert into t1 values( 16 ) +master-bin.000001 35217 Query 1 35307 use `test`; insert into t1 values( 15 ) +master-bin.000001 35307 Query 1 35397 use `test`; insert into t1 values( 14 ) +master-bin.000001 35397 Query 1 35487 use `test`; insert into t1 values( 13 ) +master-bin.000001 35487 Query 1 35577 use `test`; insert into t1 values( 12 ) +master-bin.000001 35577 Query 1 35667 use `test`; insert into t1 values( 11 ) +master-bin.000001 35667 Query 1 35757 use `test`; insert into t1 values( 10 ) +master-bin.000001 35757 Query 1 35846 use `test`; insert into t1 values( 9 ) +master-bin.000001 35846 Query 1 35935 use `test`; insert into t1 values( 8 ) +master-bin.000001 35935 Query 1 36024 use `test`; insert into t1 values( 7 ) +master-bin.000001 36024 Query 1 36113 use `test`; insert into t1 values( 6 ) +master-bin.000001 36113 Query 1 36202 use `test`; insert into t1 values( 5 ) +master-bin.000001 36202 Query 1 36291 use `test`; insert into t1 values( 4 ) +master-bin.000001 36291 Query 1 36380 use `test`; insert into t1 values( 3 ) +master-bin.000001 36380 Query 1 36469 use `test`; insert into t1 values( 2 ) +master-bin.000001 36469 Query 1 36558 use `test`; insert into t1 values( 1 ) +master-bin.000001 36558 Xid 1 36585 COMMIT /* XID */ +master-bin.000001 36585 Rotate 1 36629 master-bin.000002;pos=4 +drop table t1; +set global binlog_cache_size=@bcs; +set session autocommit = @ac; +End of 5.0 tests diff --git a/mysql-test/r/binlog_innodb.result b/mysql-test/r/binlog_innodb.result new file mode 100644 index 00000000000..93414a13ba1 --- /dev/null +++ b/mysql-test/r/binlog_innodb.result @@ -0,0 +1,23 @@ +show status like "binlog_cache_use"; +Variable_name Value +Binlog_cache_use 0 +show status like "binlog_cache_disk_use"; +Variable_name Value +Binlog_cache_disk_use 0 +create table t1 (a int) engine=innodb; +show status like "binlog_cache_use"; +Variable_name Value +Binlog_cache_use 1 +show status like "binlog_cache_disk_use"; +Variable_name Value +Binlog_cache_disk_use 1 +begin; +delete from t1; +commit; +show status like "binlog_cache_use"; +Variable_name Value +Binlog_cache_use 2 +show status like "binlog_cache_disk_use"; +Variable_name Value +Binlog_cache_disk_use 1 +drop table t1; diff --git a/mysql-test/r/binlog_killed.result b/mysql-test/r/binlog_killed.result new file mode 100644 index 00000000000..ba4f38fb4c1 --- /dev/null +++ b/mysql-test/r/binlog_killed.result @@ -0,0 +1,12 @@ +create table t1 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB; +create table t2 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=MyISAM; +create table t3 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB; +select get_lock("a", 20); +get_lock("a", 20) +1 +reset master; +insert into t2 values (null, null), (null, get_lock("a", 10)); +select @result /* must be zero either way */; +@result +0 +drop table t1,t2,t3; diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index e1262c7d2c2..e692dbf3938 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -13,7 +13,7 @@ Warnings: Note 1050 Table 't1' already exists insert into t1 values (""),(null); Warnings: -Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'b' at row 2 +Warning 1048 Column 'b' cannot be null select * from t1; b @@ -865,4 +865,642 @@ unlock tables; drop table t1, t2; create table t1 (upgrade int); drop table t1; +create table t1 ( +c1 int, c2 int, c3 int, c4 int, c5 int, c6 int, c7 int, c8 int, +c9 int, c10 int, c11 int, c12 int, c13 int, c14 int, c15 int, c16 int, +key a001_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a002_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a003_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a004_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a005_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a006_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a007_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a008_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a009_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a010_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a011_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a012_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a013_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a014_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a015_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a016_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a017_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a018_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a019_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a020_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a021_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a022_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a023_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a024_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a025_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a026_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a027_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a028_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a029_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a030_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a031_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a032_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a033_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a034_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a035_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a036_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a037_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a038_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a039_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a040_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a041_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a042_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a043_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a044_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a045_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a046_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a047_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a048_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a049_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a050_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a051_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a052_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a053_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a054_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a055_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a056_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a057_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a058_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a059_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a060_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a061_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a062_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a063_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a064_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16) +); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) default NULL, + `c2` int(11) default NULL, + `c3` int(11) default NULL, + `c4` int(11) default NULL, + `c5` int(11) default NULL, + `c6` int(11) default NULL, + `c7` int(11) default NULL, + `c8` int(11) default NULL, + `c9` int(11) default NULL, + `c10` int(11) default NULL, + `c11` int(11) default NULL, + `c12` int(11) default NULL, + `c13` int(11) default NULL, + `c14` int(11) default NULL, + `c15` int(11) default NULL, + `c16` int(11) default NULL, + KEY `a001_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a002_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a003_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a004_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a005_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a006_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a007_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a008_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a009_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a010_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a011_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a012_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a013_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a014_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a015_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a016_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a017_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a018_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a019_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a020_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a021_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a022_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a023_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a024_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a025_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a026_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a027_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a028_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a029_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a030_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a031_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a032_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a033_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a034_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a035_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a036_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a037_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a038_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a039_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a040_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a041_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a042_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a043_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a044_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a045_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a046_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a047_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a048_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a049_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a050_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a051_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a052_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a053_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a054_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a055_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a056_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a057_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a058_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a059_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a060_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a061_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a062_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a063_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a064_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +flush tables; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) default NULL, + `c2` int(11) default NULL, + `c3` int(11) default NULL, + `c4` int(11) default NULL, + `c5` int(11) default NULL, + `c6` int(11) default NULL, + `c7` int(11) default NULL, + `c8` int(11) default NULL, + `c9` int(11) default NULL, + `c10` int(11) default NULL, + `c11` int(11) default NULL, + `c12` int(11) default NULL, + `c13` int(11) default NULL, + `c14` int(11) default NULL, + `c15` int(11) default NULL, + `c16` int(11) default NULL, + KEY `a001_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a002_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a003_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a004_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a005_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a006_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a007_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a008_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a009_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a010_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a011_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a012_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a013_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a014_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a015_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a016_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a017_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a018_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a019_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a020_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a021_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a022_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a023_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a024_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a025_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a026_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a027_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a028_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a029_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a030_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a031_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a032_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a033_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a034_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a035_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a036_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a037_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a038_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a039_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a040_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a041_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a042_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a043_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a044_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a045_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a046_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a047_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a048_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a049_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a050_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a051_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a052_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a053_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a054_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a055_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a056_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a057_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a058_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a059_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a060_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a061_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a062_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a063_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a064_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 (c1 int, c2 int, c3 int, c4 int, c5 int, c6 int, c7 int, +c8 int, c9 int, c10 int, c11 int, c12 int, c13 int, c14 int, c15 int, c16 int); +alter table t1 +add key a001_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a002_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a003_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a004_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a005_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a006_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a007_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a008_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a009_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a010_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a011_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a012_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a013_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a014_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a015_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a016_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a017_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a018_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a019_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a020_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a021_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a022_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a023_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a024_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a025_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a026_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a027_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a028_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a029_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a030_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a031_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a032_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a033_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a034_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a035_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a036_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a037_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a038_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a039_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a040_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a041_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a042_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a043_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a044_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a045_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a046_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a047_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a048_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a049_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a050_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a051_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a052_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a053_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a054_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a055_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a056_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a057_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a058_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a059_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a060_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a061_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a062_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a063_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a064_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) default NULL, + `c2` int(11) default NULL, + `c3` int(11) default NULL, + `c4` int(11) default NULL, + `c5` int(11) default NULL, + `c6` int(11) default NULL, + `c7` int(11) default NULL, + `c8` int(11) default NULL, + `c9` int(11) default NULL, + `c10` int(11) default NULL, + `c11` int(11) default NULL, + `c12` int(11) default NULL, + `c13` int(11) default NULL, + `c14` int(11) default NULL, + `c15` int(11) default NULL, + `c16` int(11) default NULL, + KEY `a001_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a002_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a003_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a004_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a005_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a006_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a007_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a008_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a009_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a010_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a011_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a012_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a013_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a014_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a015_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a016_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a017_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a018_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a019_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a020_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a021_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a022_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a023_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a024_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a025_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a026_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a027_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a028_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a029_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a030_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a031_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a032_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a033_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a034_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a035_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a036_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a037_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a038_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a039_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a040_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a041_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a042_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a043_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a044_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a045_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a046_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a047_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a048_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a049_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a050_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a051_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a052_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a053_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a054_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a055_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a056_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a057_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a058_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a059_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a060_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a061_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a062_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a063_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a064_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +flush tables; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) default NULL, + `c2` int(11) default NULL, + `c3` int(11) default NULL, + `c4` int(11) default NULL, + `c5` int(11) default NULL, + `c6` int(11) default NULL, + `c7` int(11) default NULL, + `c8` int(11) default NULL, + `c9` int(11) default NULL, + `c10` int(11) default NULL, + `c11` int(11) default NULL, + `c12` int(11) default NULL, + `c13` int(11) default NULL, + `c14` int(11) default NULL, + `c15` int(11) default NULL, + `c16` int(11) default NULL, + KEY `a001_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a002_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a003_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a004_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a005_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a006_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a007_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a008_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a009_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a010_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a011_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a012_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a013_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a014_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a015_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a016_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a017_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a018_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a019_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a020_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a021_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a022_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a023_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a024_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a025_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a026_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a027_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a028_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a029_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a030_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a031_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a032_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a033_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a034_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a035_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a036_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a037_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a038_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a039_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a040_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a041_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a042_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a043_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a044_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a045_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a046_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a047_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a048_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a049_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a050_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a051_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a052_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a053_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a054_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a055_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a056_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a057_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a058_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a059_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a060_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a061_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a062_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a063_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a064_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +alter table t1 add key +a065_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16); +ERROR 42000: Too many keys specified; max 64 keys allowed +drop table t1; +create table t1 (c1 int, c2 int, c3 int, c4 int, c5 int, c6 int, c7 int, +c8 int, c9 int, c10 int, c11 int, c12 int, c13 int, c14 int, c15 int, +c16 int, c17 int); +alter table t1 add key i1 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16, c17); +ERROR 42000: Too many key parts specified; max 16 parts allowed +alter table t1 add key +a001_long_123456789_123456789_123456789_123456789_123456789_12345 (c1); +ERROR 42000: Identifier name 'a001_long_123456789_123456789_123456789_123456789_123456789_12345' is too long +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) default NULL, + `c2` int(11) default NULL, + `c3` int(11) default NULL, + `c4` int(11) default NULL, + `c5` int(11) default NULL, + `c6` int(11) default NULL, + `c7` int(11) default NULL, + `c8` int(11) default NULL, + `c9` int(11) default NULL, + `c10` int(11) default NULL, + `c11` int(11) default NULL, + `c12` int(11) default NULL, + `c13` int(11) default NULL, + `c14` int(11) default NULL, + `c15` int(11) default NULL, + `c16` int(11) default NULL, + `c17` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; End of 5.0 tests diff --git a/mysql-test/r/csv.result b/mysql-test/r/csv.result index 8ec79e9d7a9..3900597d2a6 100644 --- a/mysql-test/r/csv.result +++ b/mysql-test/r/csv.result @@ -5009,3 +5009,24 @@ select * from bug15205; val drop table bug15205; drop table bug15205_2; +set names latin1; +create table t1 ( +c varchar(1), +name varchar(64) +) character set latin1 engine=csv; +insert into t1 values (0xC0,'LATIN CAPITAL LETTER A WITH GRAVE'); +insert into t1 values (0xE0,'LATIN SMALL LETTER A WITH GRAVE'); +insert into t1 values (0xEE,'LATIN SMALL LETTER I WITH CIRCUMFLEX'); +insert into t1 values (0xFE,'LATIN SMALL LETTER THORN'); +insert into t1 values (0xF7,'DIVISION SIGN'); +insert into t1 values (0xFF,'LATIN SMALL LETTER Y WITH DIAERESIS'); +select hex(c), c, name from t1 order by 1; +hex(c) c name +C0 À LATIN CAPITAL LETTER A WITH GRAVE +E0 à LATIN SMALL LETTER A WITH GRAVE +EE î LATIN SMALL LETTER I WITH CIRCUMFLEX +F7 ÷ DIVISION SIGN +FE þ LATIN SMALL LETTER THORN +FF ÿ LATIN SMALL LETTER Y WITH DIAERESIS +drop table t1; +End of 5.0 tests diff --git a/mysql-test/r/ctype_big5.result b/mysql-test/r/ctype_big5.result index 6574908101c..3f1a87838cf 100644 --- a/mysql-test/r/ctype_big5.result +++ b/mysql-test/r/ctype_big5.result @@ -192,3 +192,16 @@ drop table t1; select hex(convert(_big5 0xC84041 using ucs2)); hex(convert(_big5 0xC84041 using ucs2)) 003F0041 +End of 4.1 tests +create table t1 (a blob); +insert into t1 values (0xEE00); +delete from t1; +select hex(load_file('test/t1.txt')); +hex(load_file('test/t1.txt')) +5CEE5C300A +load data infile 't1.txt' into table t1; +select hex(a) from t1; +hex(a) +EE00 +drop table t1; +End of 5.0 tests diff --git a/mysql-test/r/ctype_collate.result b/mysql-test/r/ctype_collate.result index 66266d40fb3..52ee76d1948 100644 --- a/mysql-test/r/ctype_collate.result +++ b/mysql-test/r/ctype_collate.result @@ -595,3 +595,11 @@ EXPLAIN SELECT * FROM t1 WHERE s2 LIKE 'a' COLLATE latin1_german1_ci; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL s2 NULL NULL NULL 10 Using where DROP TABLE t1; +create table t1(f1 varchar(10) character set latin2 collate latin2_hungarian_ci, key(f1)); +insert into t1 set f1=0x3F3F9DC73F; +insert into t1 set f1=0x3F3F1E563F; +insert into t1 set f1=0x3F3F; +check table t1 extended; +Table Op Msg_type Msg_text +test.t1 check status OK +drop table t1; diff --git a/mysql-test/r/ctype_cp932_binlog.result b/mysql-test/r/ctype_cp932_binlog.result index ff295961008..3385cd20ec4 100644 --- a/mysql-test/r/ctype_cp932_binlog.result +++ b/mysql-test/r/ctype_cp932_binlog.result @@ -9,8 +9,7 @@ EXECUTE stmt1 USING @var1; SHOW BINLOG EVENTS FROM 98; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 98 Query 1 188 use `test`; CREATE TABLE t1(f1 blob) -master-bin.000001 188 User var 1 227 @`var1`=_binary 0x8300 COLLATE binary -master-bin.000001 227 Query 1 323 use `test`; INSERT INTO t1 VALUES(@'var1') +master-bin.000001 188 Query 1 283 use `test`; INSERT INTO t1 VALUES(0x8300) SELECT HEX(f1) FROM t1; HEX(f1) 8300 @@ -30,17 +29,17 @@ HEX(s1) HEX(s2) d 466F6F2773206120426172 ED40ED41ED42 47.93 DROP PROCEDURE bug18293| DROP TABLE t4| -SHOW BINLOG EVENTS FROM 402| +SHOW BINLOG EVENTS FROM 362| Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 402 Query 1 568 use `test`; CREATE TABLE t4 (s1 CHAR(50) CHARACTER SET latin1, +master-bin.000001 362 Query 1 528 use `test`; CREATE TABLE t4 (s1 CHAR(50) CHARACTER SET latin1, s2 CHAR(50) CHARACTER SET cp932, d DECIMAL(10,2)) -master-bin.000001 568 Query 1 816 use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE bug18293 (IN ins1 CHAR(50), +master-bin.000001 528 Query 1 776 use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE bug18293 (IN ins1 CHAR(50), IN ins2 CHAR(50) CHARACTER SET cp932, IN ind DECIMAL(10,2)) BEGIN INSERT INTO t4 VALUES (ins1, ins2, ind); END -master-bin.000001 816 Query 1 1035 use `test`; INSERT INTO t4 VALUES ( NAME_CONST('ins1',_latin1 0x466F6F2773206120426172), NAME_CONST('ins2',_cp932 0xED40ED41ED42), NAME_CONST('ind',47.93)) -master-bin.000001 1035 Query 1 1124 use `test`; DROP PROCEDURE bug18293 -master-bin.000001 1124 Query 1 1203 use `test`; DROP TABLE t4 +master-bin.000001 776 Query 1 995 use `test`; INSERT INTO t4 VALUES ( NAME_CONST('ins1',_latin1 0x466F6F2773206120426172), NAME_CONST('ins2',_cp932 0xED40ED41ED42), NAME_CONST('ind',47.93)) +master-bin.000001 995 Query 1 1084 use `test`; DROP PROCEDURE bug18293 +master-bin.000001 1084 Query 1 1163 use `test`; DROP TABLE t4 diff --git a/mysql-test/r/ctype_cp932_notembedded.result b/mysql-test/r/ctype_cp932_notembedded.result deleted file mode 100644 index c58bfc65454..00000000000 --- a/mysql-test/r/ctype_cp932_notembedded.result +++ /dev/null @@ -1,17 +0,0 @@ -drop table if exists t1; -set names cp932; -set character_set_database = cp932; -RESET MASTER; -CREATE TABLE t1(f1 blob); -PREPARE stmt1 FROM 'INSERT INTO t1 VALUES(?)'; -SET @var1= x'8300'; -EXECUTE stmt1 USING @var1; -SHOW BINLOG EVENTS FROM 98; -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 98 Query 1 188 use `test`; CREATE TABLE t1(f1 blob) -master-bin.000001 188 User var 1 227 @`var1`=_binary 0x8300 COLLATE binary -master-bin.000001 227 Query 1 323 use `test`; INSERT INTO t1 VALUES(@'var1') -SELECT HEX(f1) FROM t1; -HEX(f1) -8300 -DROP table t1; diff --git a/mysql-test/r/ctype_ldml.result b/mysql-test/r/ctype_ldml.result new file mode 100644 index 00000000000..f3d3ff700f0 --- /dev/null +++ b/mysql-test/r/ctype_ldml.result @@ -0,0 +1,296 @@ +drop table if exists t1; +set names utf8; +show variables like 'character_sets_dir%'; +Variable_name Value +character_sets_dir MYSQL_TEST_DIR/std_data/ +show collation like 'utf8_test_ci'; +Collation Charset Id Default Compiled Sortlen +utf8_test_ci utf8 240 8 +create table t1 (c1 char(1) character set utf8 collate utf8_test_ci); +insert into t1 values ('a'); +select * from t1 where c1='b'; +c1 +a +drop table t1; +show collation like 'ucs2_test_ci'; +Collation Charset Id Default Compiled Sortlen +ucs2_test_ci ucs2 241 8 +create table t1 (c1 char(1) character set ucs2 collate ucs2_test_ci); +insert into t1 values ('a'); +select * from t1 where c1='b'; +c1 +a +drop table t1; +show collation like 'ucs2_vn_ci'; +Collation Charset Id Default Compiled Sortlen +ucs2_vn_ci ucs2 242 8 +create table t1 (c1 char(1) character set ucs2 collate ucs2_vn_ci); +insert into t1 values (0x0061),(0x0041),(0x00E0),(0x00C0),(0x1EA3),(0x1EA2), +(0x00E3),(0x00C3),(0x00E1),(0x00C1),(0x1EA1),(0x1EA0); +insert into t1 values (0x0103),(0x0102),(0x1EB1),(0x1EB0),(0x1EB3),(0x1EB2), +(0x1EB5),(0x1EB4),(0x1EAF),(0x1EAE),(0x1EB7),(0x1EB6); +insert into t1 values (0x00E2),(0x00C2),(0x1EA7),(0x1EA6),(0x1EA9),(0x1EA8), +(0x1EAB),(0x1EAA),(0x1EA5),(0x1EA4),(0x1EAD),(0x1EAC); +insert into t1 values ('b'),('B'),('c'),('C'); +insert into t1 values ('d'),('D'),(0x0111),(0x0110); +insert into t1 values (0x0065),(0x0045),(0x00E8),(0x00C8),(0x1EBB),(0x1EBA), +(0x1EBD),(0x1EBC),(0x00E9),(0x00C9),(0x1EB9),(0x1EB8); +insert into t1 values (0x00EA),(0x00CA),(0x1EC1),(0x1EC0),(0x1EC3),(0x1EC2), +(0x1EC5),(0x1EC4),(0x1EBF),(0x1EBE),(0x1EC7),(0x1EC6); +insert into t1 values ('g'),('G'),('h'),('H'); +insert into t1 values (0x0069),(0x0049),(0x00EC),(0x00CC),(0x1EC9),(0x1EC8), +(0x0129),(0x0128),(0x00ED),(0x00CD),(0x1ECB),(0x1ECA); +insert into t1 values ('k'),('K'),('l'),('L'),('m'),('M'); +insert into t1 values (0x006F),(0x004F),(0x00F2),(0x00D2),(0x1ECF),(0x1ECE), +(0x00F5),(0x00D5),(0x00F3),(0x00D3),(0x1ECD),(0x1ECC); +insert into t1 values (0x00F4),(0x00D4),(0x1ED3),(0x1ED2),(0x1ED5),(0x1ED4), +(0x1ED7),(0x1ED6),(0x1ED1),(0x1ED0),(0x1ED9),(0x1ED8); +insert into t1 values (0x01A1),(0x01A0),(0x1EDD),(0x1EDC),(0x1EDF),(0x1EDE), +(0x1EE1),(0x1EE0),(0x1EDB),(0x1EDA),(0x1EE3),(0x1EE2); +insert into t1 values ('p'),('P'),('q'),('Q'),('r'),('R'),('s'),('S'),('t'),('T'); +insert into t1 values (0x0075),(0x0055),(0x00F9),(0x00D9),(0x1EE7),(0x1EE6), +(0x0169),(0x0168),(0x00FA),(0x00DA),(0x1EE5),(0x1EE4); +insert into t1 values (0x01B0),(0x01AF),(0x1EEB),(0x1EEA),(0x1EED),(0x1EEC), +(0x1EEF),(0x1EEE),(0x1EE9),(0x1EE8),(0x1EF1),(0x1EF0); +insert into t1 values ('v'),('V'),('x'),('X'); +insert into t1 values (0x0079),(0x0059),(0x1EF3),(0x1EF2),(0x1EF7),(0x1EF6), +(0x1EF9),(0x1EF8),(0x00FD),(0x00DD),(0x1EF5),(0x1EF4); +select hex(c1) as h, c1 from t1 order by c1, h; +h c1 +0041 A +0061 a +00C0 À +00C1 à +00C3 à +00E0 à +00E1 á +00E3 ã +1EA0 Ạ +1EA1 ạ +1EA2 Ả +1EA3 ả +0102 Ä‚ +0103 ă +1EAE Ắ +1EAF ắ +1EB0 Ằ +1EB1 ằ +1EB2 Ẳ +1EB3 ẳ +1EB4 Ẵ +1EB5 ẵ +1EB6 Ặ +1EB7 ặ +00C2  +00E2 â +1EA4 Ấ +1EA5 ấ +1EA6 Ầ +1EA7 ầ +1EA8 Ẩ +1EA9 ẩ +1EAA Ẫ +1EAB ẫ +1EAC Ậ +1EAD ậ +0042 B +0062 b +0043 C +0063 c +0044 D +0064 d +0110 Ä +0111 Ä‘ +0045 E +0065 e +00C8 È +00C9 É +00E8 è +00E9 é +1EB8 Ẹ +1EB9 ẹ +1EBA Ẻ +1EBB ẻ +1EBC Ẽ +1EBD ẽ +00CA Ê +00EA ê +1EBE Ế +1EBF ế +1EC0 Ề +1EC1 á» +1EC2 Ể +1EC3 ể +1EC4 Ễ +1EC5 á»… +1EC6 Ệ +1EC7 ệ +0047 G +0067 g +0048 H +0068 h +0049 I +0069 i +00CC ÃŒ +00CD à +00EC ì +00ED í +0128 Ĩ +0129 Ä© +1EC8 Ỉ +1EC9 ỉ +1ECA Ị +1ECB ị +004B K +006B k +004C L +006C l +004D M +006D m +004F O +006F o +00D2 Ã’ +00D3 Ó +00D5 Õ +00F2 ò +00F3 ó +00F5 õ +1ECC Ọ +1ECD á» +1ECE Ỏ +1ECF á» +00D4 Ô +00F4 ô +1ED0 á» +1ED1 ố +1ED2 á»’ +1ED3 ồ +1ED4 á»” +1ED5 ổ +1ED6 á»– +1ED7 á»— +1ED8 Ộ +1ED9 á»™ +01A0 Æ  +01A1 Æ¡ +1EDA Ớ +1EDB á»› +1EDC Ờ +1EDD á» +1EDE Ở +1EDF ở +1EE0 á»  +1EE1 ỡ +1EE2 Ợ +1EE3 ợ +0050 P +0070 p +0051 Q +0071 q +0052 R +0072 r +0053 S +0073 s +0054 T +0074 t +0055 U +0075 u +00D9 Ù +00DA Ú +00F9 ù +00FA ú +0168 Ũ +0169 Å© +1EE4 Ụ +1EE5 ụ +1EE6 Ủ +1EE7 á»§ +01AF Ư +01B0 ư +1EE8 Ứ +1EE9 ứ +1EEA Ừ +1EEB ừ +1EEC Ử +1EED á»­ +1EEE á»® +1EEF ữ +1EF0 á»° +1EF1 á»± +0056 V +0076 v +0058 X +0078 x +0059 Y +0079 y +00DD à +00FD ý +1EF2 Ỳ +1EF3 ỳ +1EF4 á»´ +1EF5 ỵ +1EF6 á»¶ +1EF7 á»· +1EF8 Ỹ +1EF9 ỹ +select group_concat(hex(c1) order by hex(c1)) from t1 group by c1; +group_concat(hex(c1) order by hex(c1)) +0041,0061,00C0,00C1,00C3,00E0,00E1,00E3,1EA0,1EA1,1EA2,1EA3 +0102,0103,1EAE,1EAF,1EB0,1EB1,1EB2,1EB3,1EB4,1EB5,1EB6,1EB7 +00C2,00E2,1EA4,1EA5,1EA6,1EA7,1EA8,1EA9,1EAA,1EAB,1EAC,1EAD +0042,0062 +0043,0063 +0044,0064 +0110,0111 +0045,0065,00C8,00C9,00E8,00E9,1EB8,1EB9,1EBA,1EBB,1EBC,1EBD +00CA,00EA,1EBE,1EBF,1EC0,1EC1,1EC2,1EC3,1EC4,1EC5,1EC6,1EC7 +0047,0067 +0048,0068 +0049,0069,00CC,00CD,00EC,00ED,0128,0129,1EC8,1EC9,1ECA,1ECB +004B,006B +004C,006C +004D,006D +004F,006F,00D2,00D3,00D5,00F2,00F3,00F5,1ECC,1ECD,1ECE,1ECF +00D4,00F4,1ED0,1ED1,1ED2,1ED3,1ED4,1ED5,1ED6,1ED7,1ED8,1ED9 +01A0,01A1,1EDA,1EDB,1EDC,1EDD,1EDE,1EDF,1EE0,1EE1,1EE2,1EE3 +0050,0070 +0051,0071 +0052,0072 +0053,0073 +0054,0074 +0055,0075,00D9,00DA,00F9,00FA,0168,0169,1EE4,1EE5,1EE6,1EE7 +01AF,01B0,1EE8,1EE9,1EEA,1EEB,1EEC,1EED,1EEE,1EEF,1EF0,1EF1 +0056,0076 +0058,0078 +0059,0079,00DD,00FD,1EF2,1EF3,1EF4,1EF5,1EF6,1EF7,1EF8,1EF9 +select group_concat(c1 order by hex(c1) SEPARATOR '') from t1 group by c1; +group_concat(c1 order by hex(c1) SEPARATOR '') +AaÀÃÃàáãẠạẢả +ĂăẮắẰằẲẳẴẵẶặ +ÂâẤấẦầẨẩẪẫẬậ +Bb +Cc +Dd +ÄÄ‘ +EeÈÉèéẸẹẺẻẼẽ +ÊêẾếỀá»á»‚ểỄễỆệ +Gg +Hh +IiÃŒÃìíĨĩỈỉỊị +Kk +Ll +Mm +OoÒÓÕòóõỌá»á»Žá» +Ôôá»á»‘ỒồỔổỖỗỘộ +ƠơỚớỜá»á»žá»Ÿá» á»¡á»¢á»£ +Pp +Qq +Rr +Ss +Tt +UuÙÚùúŨũỤụỦủ +ƯưỨứỪừỬửỮữỰự +Vv +Xx +YyÃýỲỳỴỵỶỷỸỹ +drop table t1; diff --git a/mysql-test/r/ctype_uca.result b/mysql-test/r/ctype_uca.result index 1fd1493bf1e..889702e380c 100644 --- a/mysql-test/r/ctype_uca.result +++ b/mysql-test/r/ctype_uca.result @@ -2663,3 +2663,95 @@ COUNT(*) c1 1 1 a DROP TABLE IF EXISTS t1; +set names utf8; +create table t1 ( +a varchar(255), +key a(a) +) character set utf8 collate utf8_danish_ci; +insert into t1 values ('Ã¥aaaa'),('ååaaa'),('aaaaa'); +select a as like_a from t1 where a like 'a%'; +like_a +aaaaa +select a as like_aa from t1 where a like 'aa%'; +like_aa +aaaaa +select a as like_aaa from t1 where a like 'aaa%'; +like_aaa +aaaaa +select a as like_aaaa from t1 where a like 'aaaa%'; +like_aaaa +aaaaa +select a as like_aaaaa from t1 where a like 'aaaaa%'; +like_aaaaa +aaaaa +alter table t1 convert to character set ucs2 collate ucs2_danish_ci; +select a as like_a from t1 where a like 'a%'; +like_a +aaaaa +select a as like_aa from t1 where a like 'aa%'; +like_aa +aaaaa +select a as like_aaa from t1 where a like 'aaa%'; +like_aaa +aaaaa +select a as like_aaaa from t1 where a like 'aaaa%'; +like_aaaa +aaaaa +select a as like_aaaaa from t1 where a like 'aaaaa%'; +like_aaaaa +aaaaa +drop table t1; +create table t1 ( +a varchar(255), +key(a) +) character set utf8 collate utf8_spanish2_ci; +insert into t1 values ('aaaaa'),('lllll'),('zzzzz'); +select a as like_l from t1 where a like 'l%'; +like_l +lllll +select a as like_ll from t1 where a like 'll%'; +like_ll +lllll +select a as like_lll from t1 where a like 'lll%'; +like_lll +lllll +select a as like_llll from t1 where a like 'llll%'; +like_llll +lllll +select a as like_lllll from t1 where a like 'lllll%'; +like_lllll +lllll +alter table t1 convert to character set ucs2 collate ucs2_spanish2_ci; +select a as like_l from t1 where a like 'l%'; +like_l +lllll +select a as like_ll from t1 where a like 'll%'; +like_ll +lllll +select a as like_lll from t1 where a like 'lll%'; +like_lll +lllll +select a as like_llll from t1 where a like 'llll%'; +like_llll +lllll +select a as like_lllll from t1 where a like 'lllll%'; +like_lllll +lllll +drop table t1; +create table t1 ( +a varchar(255), +key a(a) +) character set utf8 collate utf8_czech_ci; +insert into t1 values +('b'),('c'),('d'),('e'),('f'),('g'),('h'),('ch'),('i'),('j'); +select * from t1 where a like 'c%'; +a +c +ch +alter table t1 convert to character set ucs2 collate ucs2_czech_ci; +select * from t1 where a like 'c%'; +a +c +ch +drop table t1; +End for 5.0 tests diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result index 960953b3c5e..0183a0c5c4b 100644 --- a/mysql-test/r/ctype_ucs.result +++ b/mysql-test/r/ctype_ucs.result @@ -865,4 +865,25 @@ blob 65535 65535 text 65535 65535 text 65535 32767 drop table t1; +create table t1 (a char(1) character set ucs2); +insert into t1 values ('a'),('b'),('c'); +select hex(group_concat(a)) from t1; +hex(group_concat(a)) +0061002C0062002C0063 +select collation(group_concat(a)) from t1; +collation(group_concat(a)) +ucs2_general_ci +drop table t1; +set names latin1; +create table t1 (a char(1) character set latin1); +insert into t1 values ('a'),('b'),('c'); +set character_set_connection=ucs2; +select hex(group_concat(a separator ',')) from t1; +hex(group_concat(a separator ',')) +612C622C63 +select collation(group_concat(a separator ',')) from t1; +collation(group_concat(a separator ',')) +latin1_swedish_ci +drop table t1; +set names latin1; End of 5.0 tests diff --git a/mysql-test/r/ctype_ucs2_def.result b/mysql-test/r/ctype_ucs2_def.result index 2f9dc4ae616..d838c5d66b0 100644 --- a/mysql-test/r/ctype_ucs2_def.result +++ b/mysql-test/r/ctype_ucs2_def.result @@ -7,3 +7,18 @@ character_set_server ucs2 DROP TABLE IF EXISTS t1; create table t1 (a int); drop table t1; +End of 4.1 tests +create table t1 (a char(1) character set latin1); +insert into t1 values ('a'),('b'),('c'); +select hex(group_concat(a)) from t1; +hex(group_concat(a)) +612C622C63 +drop table t1; +CREATE TABLE t1(col1 VARCHAR(32) CHARACTER SET ucs2 COLLATE ucs2_bin NOT NULL, +col2 VARCHAR(32) CHARACTER SET ucs2 COLLATE ucs2_bin NOT NULL, +UNIQUE KEY key1 USING HASH (col1, col2)) ENGINE=MEMORY; +INSERT INTO t1 VALUES('A', 'A'), ('B', 'B'), ('C', 'C'); +INSERT INTO t1 VALUES('A ', 'A '); +ERROR 23000: Duplicate entry '' for key 1 +DROP TABLE t1; +End of 5.0 tests diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result index 216b5f393fb..d38480dced1 100644 --- a/mysql-test/r/ctype_utf8.result +++ b/mysql-test/r/ctype_utf8.result @@ -1657,3 +1657,40 @@ colA colB colA colB 1 foo 1 foo 2 foo bar 2 foo bar DROP TABLE t1, t2; +SELECT 'н1234567890' UNION SELECT _binary '1'; +н1234567890 +н1234567890 +1 +SELECT 'н1234567890' UNION SELECT 1; +н1234567890 +н1234567890 +1 +SELECT '1' UNION SELECT 'н1234567890'; +1 +1 +н1234567890 +SELECT 1 UNION SELECT 'н1234567890'; +1 +1 +н1234567890 +CREATE TABLE t1 (c VARCHAR(11)) CHARACTER SET utf8; +CREATE TABLE t2 (b CHAR(1) CHARACTER SET binary, i INT); +INSERT INTO t1 (c) VALUES ('н1234567890'); +INSERT INTO t2 (b, i) VALUES ('1', 1); +SELECT c FROM t1 UNION SELECT b FROM t2; +c +н1234567890 +1 +SELECT c FROM t1 UNION SELECT i FROM t2; +c +н1234567890 +1 +SELECT b FROM t2 UNION SELECT c FROM t1; +b +1 +н1234567890 +SELECT i FROM t2 UNION SELECT c FROM t1; +i +1 +н1234567890 +DROP TABLE t1, t2; diff --git a/mysql-test/r/error_simulation.result b/mysql-test/r/error_simulation.result new file mode 100644 index 00000000000..805e8fabbd8 --- /dev/null +++ b/mysql-test/r/error_simulation.result @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 't1' +CREATE TABLE t1 ( +a varchar(32) character set utf8 collate utf8_bin NOT NULL, +b varchar(32) character set utf8 collate utf8_bin NOT NULL ) +ENGINE=MyISAM DEFAULT CHARSET=utf8; +INSERT INTO t1 VALUES +('AAAAAAAAAA','AAAAAAAAAA'), ('AAAAAAAAAB','AAAAAAAAAB '), +('AAAAAAAAAB','AAAAAAAAAB'), ('AAAAAAAAAC','AAAAAAAAAC'), +('AAAAAAAAAD','AAAAAAAAAD'), ('AAAAAAAAAE','AAAAAAAAAE'), +('AAAAAAAAAF','AAAAAAAAAF'), ('AAAAAAAAAG','AAAAAAAAAG'), +('AAAAAAAAAH','AAAAAAAAAH'), ('AAAAAAAAAI','AAAAAAAAAI'), +('AAAAAAAAAJ','AAAAAAAAAJ'), ('AAAAAAAAAK','AAAAAAAAAK'); +set tmp_table_size=1024; +SELECT MAX(a) FROM t1 GROUP BY a,b; +ERROR 23000: Can't write; duplicate key in table '' +set tmp_table_size=default; +DROP TABLE t1; diff --git a/mysql-test/r/errors.result b/mysql-test/r/errors.result index 94debb1785f..022a32d9c9b 100644 --- a/mysql-test/r/errors.result +++ b/mysql-test/r/errors.result @@ -41,3 +41,17 @@ SELECT a FROM t1 WHERE a IN(1, (SELECT IF(1=0,1,2/0))); a 1 DROP TABLE t1; +CREATE TABLE t1( a INT ); +SELECT b FROM t1; +ERROR 42S22: Unknown column 'b' in 'field list' +SHOW ERRORS; +Level Code Message +Error 1054 Unknown column 'b' in 'field list' +CREATE TABLE t2 SELECT b FROM t1; +ERROR 42S22: Unknown column 'b' in 'field list' +SHOW ERRORS; +Level Code Message +Error 1054 Unknown column 'b' in 'field list' +INSERT INTO t1 SELECT b FROM t1; +ERROR 42S22: Unknown column 'b' in 'field list' +DROP TABLE t1; diff --git a/mysql-test/r/federated.result b/mysql-test/r/federated.result index cecffbb1471..4bef92319fb 100644 --- a/mysql-test/r/federated.result +++ b/mysql-test/r/federated.result @@ -1843,6 +1843,45 @@ C3A4C3B6C3BCC39F D18DD184D184D0B5D0BAD182D0B8D0B2D0BDD183D18E drop table federated.t1; drop table federated.t1; +create table federated.t1 (a int primary key, b varchar(64)) +DEFAULT CHARSET=utf8; +create table federated.t1 (a int primary key, b varchar(64)) +ENGINE=FEDERATED +connection='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1' + DEFAULT CHARSET=utf8; +insert ignore into federated.t1 values (1,"Larry"), (2,"Curly"), (1,"Moe"); +select * from federated.t1; +a b +1 Larry +2 Curly +truncate federated.t1; +replace into federated.t1 values (1,"Larry"), (2,"Curly"), (1,"Moe"); +select * from federated.t1; +a b +1 Moe +2 Curly +update ignore federated.t1 set a=a+1; +select * from federated.t1; +a b +1 Moe +3 Curly +drop table federated.t1; +drop table federated.t1; +create table federated.t1 (a int primary key, b varchar(64)) +DEFAULT CHARSET=utf8; +create table federated.t1 (a int primary key, b varchar(64)) +ENGINE=FEDERATED +connection='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1' + DEFAULT CHARSET=utf8; +insert into federated.t1 values (1,"Larry"), (2,"Curly"), (1,"Moe") +on duplicate key update a=a+100; +ERROR 23000: Can't write; duplicate key in table 't1' +select * from federated.t1; +a b +1 Larry +2 Curly +drop table federated.t1; +drop table federated.t1; DROP TABLE IF EXISTS federated.t1; DROP DATABASE IF EXISTS federated; DROP TABLE IF EXISTS federated.t1; diff --git a/mysql-test/r/federated_innodb.result b/mysql-test/r/federated_innodb.result new file mode 100644 index 00000000000..70ba3acb279 --- /dev/null +++ b/mysql-test/r/federated_innodb.result @@ -0,0 +1,34 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +stop slave; +DROP DATABASE IF EXISTS federated; +CREATE DATABASE federated; +DROP DATABASE IF EXISTS federated; +CREATE DATABASE federated; +create table federated.t1 (a int primary key, b varchar(64)) +engine=myisam; +create table federated.t1 (a int primary key, b varchar(64)) +engine=federated +connection='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; +insert into federated.t1 values (1,"Larry"), (2,"Curly"), (1,"Moe"); +ERROR 23000: Can't write; duplicate key in table 't1' +select * from federated.t1; +a b +1 Larry +2 Curly +truncate federated.t1; +alter table federated.t1 engine=innodb; +insert into federated.t1 values (1,"Larry"), (2,"Curly"), (1,"Moe"); +ERROR 23000: Can't write; duplicate key in table 't1' +select * from federated.t1; +a b +drop table federated.t1; +drop table federated.t1; +DROP TABLE IF EXISTS federated.t1; +DROP DATABASE IF EXISTS federated; +DROP TABLE IF EXISTS federated.t1; +DROP DATABASE IF EXISTS federated; diff --git a/mysql-test/r/fulltext3.result b/mysql-test/r/fulltext3.result new file mode 100644 index 00000000000..019d5f472ed --- /dev/null +++ b/mysql-test/r/fulltext3.result @@ -0,0 +1,13 @@ +DROP TABLE IF EXISTS t1; +CREATE TABLE t1(a VARCHAR(255) CHARACTER SET gbk, FULLTEXT(a)); +SET NAMES utf8; +INSERT INTO t1 VALUES(0xF043616161),(0xBEF361616197C22061616161); +SELECT HEX(a) FROM t1 WHERE MATCH(a) AGAINST(0x97C22061616161 IN BOOLEAN MODE); +HEX(a) +BEF361616197C22061616161 +DELETE FROM t1 LIMIT 1; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SET NAMES latin1; +DROP TABLE t1; diff --git a/mysql-test/r/func_date_add.result b/mysql-test/r/func_date_add.result index ac5709260fd..a7f2383848d 100644 --- a/mysql-test/r/func_date_add.result +++ b/mysql-test/r/func_date_add.result @@ -84,4 +84,15 @@ CAST('2006-09-26' AS DATE) + INTERVAL 1 YEAR SELECT CAST('2006-09-26' AS DATE) + INTERVAL 1 WEEK; CAST('2006-09-26' AS DATE) + INTERVAL 1 WEEK 2006-10-03 +create table t1 (a int, b varchar(10)); +insert into t1 values (1, '2001-01-01'),(2, '2002-02-02'); +select '2007-01-01' + interval a day from t1; +'2007-01-01' + interval a day +2007-01-02 +2007-01-03 +select b + interval a day from t1; +b + interval a day +2001-01-02 +2002-02-04 +drop table t1; End of 5.0 tests diff --git a/mysql-test/r/func_gconcat.result b/mysql-test/r/func_gconcat.result index 20df776ec1b..8b71ad1940e 100644 --- a/mysql-test/r/func_gconcat.result +++ b/mysql-test/r/func_gconcat.result @@ -763,4 +763,51 @@ Warnings: Warning 1260 1 line(s) were cut by GROUP_CONCAT() SET group_concat_max_len = DEFAULT; DROP TABLE t1; +SET group_concat_max_len= 65535; +CREATE TABLE t1( a TEXT, b INTEGER ); +INSERT INTO t1 VALUES ( 'a', 0 ), ( 'b', 1 ); +SELECT GROUP_CONCAT( a ORDER BY b ) FROM t1; +GROUP_CONCAT( a ORDER BY b ) +a,b +SELECT GROUP_CONCAT(DISTINCT a ORDER BY b) FROM t1; +GROUP_CONCAT(DISTINCT a ORDER BY b) +a,b +SELECT GROUP_CONCAT(DISTINCT a) FROM t1; +GROUP_CONCAT(DISTINCT a) +a,b +SET group_concat_max_len= 10; +SELECT GROUP_CONCAT(a ORDER BY b) FROM t1; +GROUP_CONCAT(a ORDER BY b) +a,b +SELECT GROUP_CONCAT(DISTINCT a ORDER BY b) FROM t1; +GROUP_CONCAT(DISTINCT a ORDER BY b) +a,b +SELECT GROUP_CONCAT(DISTINCT a) FROM t1; +GROUP_CONCAT(DISTINCT a) +a,b +SET group_concat_max_len= 65535; +CREATE TABLE t2( a TEXT ); +INSERT INTO t2 VALUES( REPEAT( 'a', 5000 ) ); +INSERT INTO t2 VALUES( REPEAT( 'b', 5000 ) ); +INSERT INTO t2 VALUES( REPEAT( 'a', 5000 ) ); +SELECT LENGTH( GROUP_CONCAT( DISTINCT a ) ) FROM t2; +LENGTH( GROUP_CONCAT( DISTINCT a ) ) +10001 +CREATE TABLE t3( a TEXT, b INT ); +INSERT INTO t3 VALUES( REPEAT( 'a', 65534 ), 1 ); +INSERT INTO t3 VALUES( REPEAT( 'a', 65535 ), 2 ); +INSERT INTO t3 VALUES( REPEAT( 'a', 65536 ), 3 ); +Warnings: +Warning 1265 Data truncated for column 'a' at row 1 +SELECT LENGTH( GROUP_CONCAT( a ) ) FROM t3 WHERE b = 1; +LENGTH( GROUP_CONCAT( a ) ) +65534 +SELECT LENGTH( GROUP_CONCAT( a ) ) FROM t3 WHERE b = 2; +LENGTH( GROUP_CONCAT( a ) ) +65535 +SELECT LENGTH( GROUP_CONCAT( a ) ) FROM t3 WHERE b = 3; +LENGTH( GROUP_CONCAT( a ) ) +65535 +SET group_concat_max_len= DEFAULT; +DROP TABLE t1, t2, t3; End of 5.0 tests diff --git a/mysql-test/r/func_in.result b/mysql-test/r/func_in.result index a3e0773649f..99b16d29eb9 100644 --- a/mysql-test/r/func_in.result +++ b/mysql-test/r/func_in.result @@ -431,15 +431,17 @@ insert into t2 values(13491727406643098568), (0x8000000400000001), (0x8000004000000001), (0x8000040000000001); -SELECT HEX(a) FROM t2 WHERE a IN (0xBB3C3E98175D33C8, 42); +SELECT HEX(a) FROM t2 WHERE a IN +(CAST(0xBB3C3E98175D33C8 AS UNSIGNED), +42); HEX(a) BB3C3E98175D33C8 SELECT HEX(a) FROM t2 WHERE a IN -(0xBB3C3E98175D33C8, -0x7fffffffffffffff, -0x8000000000000000, -0x8000000000000400, -0x8000000000000401, +(CAST(0xBB3C3E98175D33C8 AS UNSIGNED), +CAST(0x7fffffffffffffff AS UNSIGNED), +CAST(0x8000000000000000 AS UNSIGNED), +CAST(0x8000000000000400 AS UNSIGNED), +CAST(0x8000000000000401 AS UNSIGNED), 42); HEX(a) BB3C3E98175D33C8 @@ -447,15 +449,22 @@ BB3C3E98175D33C8 8000000000000000 8000000000000400 8000000000000401 -SELECT HEX(a) FROM t2 WHERE a IN (0x7fffffffffffffff,0x8000000000000001); +SELECT HEX(a) FROM t2 WHERE a IN +(CAST(0x7fffffffffffffff AS UNSIGNED), +CAST(0x8000000000000001 AS UNSIGNED)); HEX(a) 7FFFFFFFFFFFFFFF 8000000000000001 -SELECT HEX(a) FROM t2 WHERE a IN (0x7ffffffffffffffe,0x7fffffffffffffff); +SELECT HEX(a) FROM t2 WHERE a IN +(CAST(0x7ffffffffffffffe AS UNSIGNED), +CAST(0x7fffffffffffffff AS UNSIGNED)); HEX(a) 7FFFFFFFFFFFFFFE 7FFFFFFFFFFFFFFF -SELECT HEX(a) FROM t2 WHERE a IN (0x7ffffffffffffffe,0x7fffffffffffffff,'abc'); +SELECT HEX(a) FROM t2 WHERE a IN +(0x7ffffffffffffffe, +0x7fffffffffffffff, +'abc'); HEX(a) 7FFFFFFFFFFFFFFE 7FFFFFFFFFFFFFFF diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result index d8afbe13c76..ce9633006af 100644 --- a/mysql-test/r/func_str.result +++ b/mysql-test/r/func_str.result @@ -2061,4 +2061,96 @@ C 2707236321 DROP TABLE t1, t2; DROP VIEW v1; +SELECT LOCATE('foo', NULL) FROM DUAL; +LOCATE('foo', NULL) +NULL +SELECT LOCATE(NULL, 'o') FROM DUAL; +LOCATE(NULL, 'o') +NULL +SELECT LOCATE(NULL, NULL) FROM DUAL; +LOCATE(NULL, NULL) +NULL +SELECT LOCATE('foo', NULL) IS NULL FROM DUAL; +LOCATE('foo', NULL) IS NULL +1 +SELECT LOCATE(NULL, 'o') IS NULL FROM DUAL; +LOCATE(NULL, 'o') IS NULL +1 +SELECT LOCATE(NULL, NULL) IS NULL FROM DUAL; +LOCATE(NULL, NULL) IS NULL +1 +SELECT ISNULL(LOCATE('foo', NULL)) FROM DUAL; +ISNULL(LOCATE('foo', NULL)) +1 +SELECT ISNULL(LOCATE(NULL, 'o')) FROM DUAL; +ISNULL(LOCATE(NULL, 'o')) +1 +SELECT ISNULL(LOCATE(NULL, NULL)) FROM DUAL; +ISNULL(LOCATE(NULL, NULL)) +1 +SELECT LOCATE('foo', NULL) <=> NULL FROM DUAL; +LOCATE('foo', NULL) <=> NULL +1 +SELECT LOCATE(NULL, 'o') <=> NULL FROM DUAL; +LOCATE(NULL, 'o') <=> NULL +1 +SELECT LOCATE(NULL, NULL) <=> NULL FROM DUAL; +LOCATE(NULL, NULL) <=> NULL +1 +CREATE TABLE t1 (id int NOT NULL PRIMARY KEY, a varchar(10), p varchar(10)); +INSERT INTO t1 VALUES (1, 'foo', 'o'); +INSERT INTO t1 VALUES (2, 'foo', NULL); +INSERT INTO t1 VALUES (3, NULL, 'o'); +INSERT INTO t1 VALUES (4, NULL, NULL); +SELECT id, LOCATE(a,p) FROM t1; +id LOCATE(a,p) +1 0 +2 NULL +3 NULL +4 NULL +SELECT id, LOCATE(a,p) IS NULL FROM t1; +id LOCATE(a,p) IS NULL +1 0 +2 1 +3 1 +4 1 +SELECT id, ISNULL(LOCATE(a,p)) FROM t1; +id ISNULL(LOCATE(a,p)) +1 0 +2 1 +3 1 +4 1 +SELECT id, LOCATE(a,p) <=> NULL FROM t1; +id LOCATE(a,p) <=> NULL +1 0 +2 1 +3 1 +4 1 +SELECT id FROM t1 WHERE LOCATE(a,p) IS NULL; +id +2 +3 +4 +SELECT id FROM t1 WHERE LOCATE(a,p) <=> NULL; +id +2 +3 +4 +DROP TABLE t1; +SELECT SUBSTR('foo',1,0) FROM DUAL; +SUBSTR('foo',1,0) + +SELECT SUBSTR('foo',1,CAST(0 AS SIGNED)) FROM DUAL; +SUBSTR('foo',1,CAST(0 AS SIGNED)) + +SELECT SUBSTR('foo',1,CAST(0 AS UNSIGNED)) FROM DUAL; +SUBSTR('foo',1,CAST(0 AS UNSIGNED)) + +CREATE TABLE t1 (a varchar(10), len int unsigned); +INSERT INTO t1 VALUES ('bar', 2), ('foo', 0); +SELECT SUBSTR(a,1,len) FROM t1; +SUBSTR(a,1,len) +ba + +DROP TABLE t1; End of 5.0 tests diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result index 73e5b054f80..edf017f24d4 100644 --- a/mysql-test/r/gis.result +++ b/mysql-test/r/gis.result @@ -864,4 +864,28 @@ SELECT Overlaps(@horiz1, @point2) FROM DUAL; Overlaps(@horiz1, @point2) 0 DROP TABLE t1; +create table t1(f1 geometry, f2 point, f3 linestring); +select f1 from t1 union select f1 from t1; +f1 +insert into t1 (f2,f3) values (GeomFromText('POINT(1 1)'), +GeomFromText('LINESTRING(0 0,1 1,2 2)')); +select AsText(f2),AsText(f3) from t1; +AsText(f2) AsText(f3) +POINT(1 1) LINESTRING(0 0,1 1,2 2) +select AsText(a) from (select f2 as a from t1 union select f3 from t1) t; +AsText(a) +POINT(1 1) +LINESTRING(0 0,1 1,2 2) +create table t2 as select f2 as a from t1 union select f3 from t1; +desc t2; +Field Type Null Key Default Extra +a point YES NULL +select AsText(a) from t2; +AsText(a) +POINT(1 1) +LINESTRING(0 0,1 1,2 2) +drop table t1, t2; +SELECT 1; +1 +1 End of 5.0 tests diff --git a/mysql-test/r/grant2.result b/mysql-test/r/grant2.result index ff9b7bc6f1f..6de9a83aeed 100644 --- a/mysql-test/r/grant2.result +++ b/mysql-test/r/grant2.result @@ -380,3 +380,45 @@ drop function f2; drop table t2; REVOKE ALL PRIVILEGES, GRANT OPTION FROM `a@`@localhost; drop user `a@`@localhost; +drop database if exists mysqltest_1; +drop database if exists mysqltest_2; +drop user mysqltest_u1@localhost; +create database mysqltest_1; +create database mysqltest_2; +grant all on mysqltest_1.* to mysqltest_u1@localhost; +use mysqltest_2; +create table t1 (i int); +show create table mysqltest_2.t1; +ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table 't1' +create table t1 like mysqltest_2.t1; +ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table 't1' +grant select on mysqltest_2.t1 to mysqltest_u1@localhost; +show create table mysqltest_2.t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `i` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +create table t1 like mysqltest_2.t1; +use test; +drop database mysqltest_1; +drop database mysqltest_2; +drop user mysqltest_u1@localhost; +grant all on `mysqltest\_%`.* to mysqltest_1@localhost with grant option; +grant usage on *.* to mysqltest_2@localhost; +create database mysqltest_1; +use mysqltest_1; +create table t1 (f1 int); +grant create on `mysqltest\_1`.* to mysqltest_2@localhost; +grant select on mysqltest_1.t1 to mysqltest_2@localhost; +create database mysqltest_3; +ERROR 42000: Access denied for user 'mysqltest_2'@'localhost' to database 'mysqltest_3' +use mysqltest_1; +create table t2(f1 int); +select * from t1; +f1 +drop database mysqltest_1; +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; +End of 5.0 tests diff --git a/mysql-test/r/group_min_max.result b/mysql-test/r/group_min_max.result index 7583aa14db8..2e5193f8563 100644 --- a/mysql-test/r/group_min_max.result +++ b/mysql-test/r/group_min_max.result @@ -2286,3 +2286,24 @@ Variable_name Value Handler_read_key 8 Handler_read_next 1 DROP TABLE t1,t2,t3; +CREATE TABLE t1 (a int, INDEX idx(a)); +INSERT INTO t1 VALUES +(4), (2), (1), (2), (4), (2), (1), (4), +(4), (2), (1), (2), (2), (4), (1), (4); +EXPLAIN SELECT DISTINCT(a) FROM t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range NULL idx 5 NULL 9 Using index for group-by +SELECT DISTINCT(a) FROM t1; +a +1 +2 +4 +EXPLAIN SELECT SQL_BIG_RESULT DISTINCT(a) FROM t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range NULL idx 5 NULL 9 Using index for group-by +SELECT SQL_BIG_RESULT DISTINCT(a) FROM t1; +a +1 +2 +4 +DROP TABLE t1; diff --git a/mysql-test/r/have_log_bin.require b/mysql-test/r/have_log_bin.require index cacdf8df0ce..d4fd77e4f8d 100644 --- a/mysql-test/r/have_log_bin.require +++ b/mysql-test/r/have_log_bin.require @@ -1,2 +1,2 @@ Variable_name Value -have_log_bin ON +log_bin ON diff --git a/mysql-test/r/heap_hash.result b/mysql-test/r/heap_hash.result index 80abcebbfea..cb47573b502 100644 --- a/mysql-test/r/heap_hash.result +++ b/mysql-test/r/heap_hash.result @@ -366,3 +366,19 @@ explain select a from t1 where a in (1,3); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range a a 5 NULL 4 Using where drop table t1; +End of 4.1 tests +CREATE TABLE t1(col1 VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, +col2 VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, +UNIQUE KEY key1 USING HASH (col1, col2)) ENGINE=MEMORY; +INSERT INTO t1 VALUES('A', 'A'); +INSERT INTO t1 VALUES('A ', 'A '); +ERROR 23000: Duplicate entry 'A -A ' for key 1 +DROP TABLE t1; +CREATE TABLE t1(col1 VARCHAR(32) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL, +col2 VARCHAR(32) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL, +UNIQUE KEY key1 USING HASH (col1, col2)) ENGINE=MEMORY; +INSERT INTO t1 VALUES('A', 'A'); +INSERT INTO t1 VALUES('A ', 'A '); +ERROR 23000: Duplicate entry 'A -A ' for key 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 db703df1f52..4947fd7aecc 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -1315,3 +1315,14 @@ TABLE_PRIVILEGES information_schema.TABLE_PRIVILEGES 1 TRIGGERS information_schema.TRIGGERS 1 USER_PRIVILEGES information_schema.USER_PRIVILEGES 1 VIEWS information_schema.VIEWS 1 +create table t1(f1 int); +create view v1 as select f1+1 as a from t1; +create table t2 (f1 int, f2 int); +create view v2 as select f1+1 as a, f2 as b from t2; +select table_name, is_updatable from information_schema.views; +table_name is_updatable +v1 NO +v2 YES +delete from v1; +drop view v1,v2; +drop table t1,t2; diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result index 9f327ca1901..80b46e5098a 100644 --- a/mysql-test/r/innodb.result +++ b/mysql-test/r/innodb.result @@ -1086,6 +1086,39 @@ n d 1 30 2 20 drop table t1,t2; +CREATE TABLE `t1` ( +`a` int(11) NOT NULL auto_increment, +`b` int(11) default NULL, +PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 ; +CREATE TABLE `t2` ( +`a` int(11) NOT NULL auto_increment, +`b` int(11) default NULL, +PRIMARY KEY (`a`) +) ENGINE=INNODB DEFAULT CHARSET=latin1 ; +insert into t1 values (1,1),(2,2); +insert into t2 values (1,1),(4,4); +reset master; +UPDATE t2,t1 SET t2.a=t1.a+2; +ERROR 23000: Duplicate entry '3' for key 1 +select * from t2 /* must be (3,1), (4,4) */; +a b +1 1 +4 4 +show master status /* there must no UPDATE in binlog */; +File Position Binlog_Do_DB Binlog_Ignore_DB +master-bin.000001 98 +delete from t1; +delete from t2; +insert into t1 values (1,2),(3,4),(4,4); +insert into t2 values (1,2),(3,4),(4,4); +reset master; +UPDATE t2,t1 SET t2.a=t2.b where t2.a=t1.a; +ERROR 23000: Duplicate entry '4' for key 1 +show master status /* there must be no UPDATE query event */; +File Position Binlog_Do_DB Binlog_Ignore_DB +master-bin.000001 98 +drop table t1, t2; create table t1 (a int, b int) engine=innodb; insert into t1 values(20,null); select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on @@ -1640,29 +1673,6 @@ t2 CREATE TABLE `t2` ( CONSTRAINT `t2_ibfk_2` FOREIGN KEY (`b`) REFERENCES `t1` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 drop table t2, t1; -show status like "binlog_cache_use"; -Variable_name Value -Binlog_cache_use 155 -show status like "binlog_cache_disk_use"; -Variable_name Value -Binlog_cache_disk_use 0 -create table t1 (a int) engine=innodb; -show status like "binlog_cache_use"; -Variable_name Value -Binlog_cache_use 156 -show status like "binlog_cache_disk_use"; -Variable_name Value -Binlog_cache_disk_use 1 -begin; -delete from t1; -commit; -show status like "binlog_cache_use"; -Variable_name Value -Binlog_cache_use 157 -show status like "binlog_cache_disk_use"; -Variable_name Value -Binlog_cache_disk_use 1 -drop table t1; create table t1 (c char(10), index (c,c)) engine=innodb; ERROR 42S21: Duplicate column name 'c' create table t1 (c1 char(10), c2 char(10), index (c1,c2,c1)) engine=innodb; @@ -1782,13 +1792,13 @@ Variable_name Value Innodb_page_size 16384 show status like "Innodb_rows_deleted"; Variable_name Value -Innodb_rows_deleted 2070 +Innodb_rows_deleted 72 show status like "Innodb_rows_inserted"; Variable_name Value -Innodb_rows_inserted 31727 +Innodb_rows_inserted 29732 show status like "Innodb_rows_updated"; Variable_name Value -Innodb_rows_updated 29530 +Innodb_rows_updated 29532 show status like "Innodb_row_lock_waits"; Variable_name Value Innodb_row_lock_waits 0 diff --git a/mysql-test/r/innodb_mysql.result b/mysql-test/r/innodb_mysql.result index 45cb116f08b..4535710c905 100644 --- a/mysql-test/r/innodb_mysql.result +++ b/mysql-test/r/innodb_mysql.result @@ -1,4 +1,4 @@ -drop table if exists t1,t2; +drop table if exists t1,t2,t3,t4; create table t1 ( c_id int(11) not null default '0', org_id int(11) default null, @@ -617,4 +617,122 @@ EXPLAIN SELECT COUNT(*) FROM t2 WHERE stat_id IN (1,3) AND acct_id=785; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 range idx1,idx2 idx1 9 NULL 2 Using where; Using index DROP TABLE t1,t2; +create table t1(a int) engine=innodb; +alter table t1 comment '123'; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) default NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='123' +drop table t1; +CREATE TABLE t1 (a CHAR(2), KEY (a)) ENGINE = InnoDB DEFAULT CHARSET=UTF8; +INSERT INTO t1 VALUES ('uk'),('bg'); +SELECT * FROM t1 WHERE a = 'uk'; +a +uk +DELETE FROM t1 WHERE a = 'uk'; +SELECT * FROM t1 WHERE a = 'uk'; +a +UPDATE t1 SET a = 'us' WHERE a = 'uk'; +SELECT * FROM t1 WHERE a = 'uk'; +a +CREATE TABLE t2 (a CHAR(2), KEY (a)) ENGINE = InnoDB; +INSERT INTO t2 VALUES ('uk'),('bg'); +SELECT * FROM t2 WHERE a = 'uk'; +a +uk +DELETE FROM t2 WHERE a = 'uk'; +SELECT * FROM t2 WHERE a = 'uk'; +a +INSERT INTO t2 VALUES ('uk'); +UPDATE t2 SET a = 'us' WHERE a = 'uk'; +SELECT * FROM t2 WHERE a = 'uk'; +a +CREATE TABLE t3 (a CHAR(2), KEY (a)) ENGINE = MyISAM; +INSERT INTO t3 VALUES ('uk'),('bg'); +SELECT * FROM t3 WHERE a = 'uk'; +a +uk +DELETE FROM t3 WHERE a = 'uk'; +SELECT * FROM t3 WHERE a = 'uk'; +a +INSERT INTO t3 VALUES ('uk'); +UPDATE t3 SET a = 'us' WHERE a = 'uk'; +SELECT * FROM t3 WHERE a = 'uk'; +a +DROP TABLE t1,t2,t3; +create table t1 (a int) engine=innodb; +select * from t2; +ERROR 42S02: Table 'test.t2' doesn't exist +drop table t1; +drop table t2; +ERROR 42S02: Unknown table 't2' +create table t2 (a int); +drop table t2; +CREATE TABLE t1 (a INT) ENGINE=InnoDB; +CREATE TABLE t2 (a INT) ENGINE=InnoDB; +switch to connection c1 +SET AUTOCOMMIT=0; +INSERT INTO t2 VALUES (1); +switch to connection c2 +SET AUTOCOMMIT=0; +LOCK TABLES t1 READ, t2 READ; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +switch to connection c1 +COMMIT; +INSERT INTO t1 VALUES (1); +switch to connection default +SET AUTOCOMMIT=default; +DROP TABLE t1,t2; +CREATE TABLE t1 ( +id int NOT NULL auto_increment PRIMARY KEY, +b int NOT NULL, +c datetime NOT NULL, +INDEX idx_b(b), +INDEX idx_c(c) +) ENGINE=InnoDB; +CREATE TABLE t2 ( +b int NOT NULL auto_increment PRIMARY KEY, +c datetime NOT NULL +) ENGINE= MyISAM; +INSERT INTO t2(c) VALUES ('2007-01-01'); +INSERT INTO t2(c) SELECT c FROM t2; +INSERT INTO t2(c) SELECT c FROM t2; +INSERT INTO t2(c) SELECT c FROM t2; +INSERT INTO t2(c) SELECT c FROM t2; +INSERT INTO t2(c) SELECT c FROM t2; +INSERT INTO t2(c) SELECT c FROM t2; +INSERT INTO t2(c) SELECT c FROM t2; +INSERT INTO t2(c) SELECT c FROM t2; +INSERT INTO t2(c) SELECT c FROM t2; +INSERT INTO t2(c) SELECT c FROM t2; +INSERT INTO t1(b,c) SELECT b,c FROM t2; +UPDATE t2 SET c='2007-01-02'; +INSERT INTO t1(b,c) SELECT b,c FROM t2; +UPDATE t2 SET c='2007-01-03'; +INSERT INTO t1(b,c) SELECT b,c FROM t2; +set @@sort_buffer_size=8192; +SELECT COUNT(*) FROM t1; +COUNT(*) +3072 +EXPLAIN +SELECT COUNT(*) FROM t1 +WHERE (c >= '2007-01-02' AND c <= '2007-01-03') OR b >= 1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL idx_b,idx_c NULL NULL NULL # Using where +SELECT COUNT(*) FROM t1 +WHERE (c >= '2007-01-02' AND c <= '2007-01-03') OR b >= 1; +COUNT(*) +3072 +EXPLAIN +SELECT COUNT(*) FROM t1 FORCE INDEX(idx_b, idx_c) +WHERE (c >= '2007-01-02' AND c <= '2007-01-03') OR b >= 1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index_merge idx_b,idx_c idx_c,idx_b 8,4 NULL # Using sort_union(idx_c,idx_b); Using where +SELECT COUNT(*) FROM t1 FORCE INDEX(idx_b, idx_c) +WHERE (c >= '2007-01-02' AND c <= '2007-01-03') OR b >= 1; +COUNT(*) +3072 +set @@sort_buffer_size=default; +DROP TABLE t1,t2; End of 5.0 tests diff --git a/mysql-test/r/insert.result b/mysql-test/r/insert.result index fa6e23d09f9..8a0a3ba848c 100644 --- a/mysql-test/r/insert.result +++ b/mysql-test/r/insert.result @@ -63,7 +63,7 @@ insert into t1 values(NULL); ERROR 23000: Column 'id' cannot be null insert into t1 values (1), (NULL), (2); Warnings: -Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'id' at row 2 +Warning 1048 Column 'id' cannot be null select * from t1; id 1 diff --git a/mysql-test/r/insert_select.result b/mysql-test/r/insert_select.result index a96add7eb9a..8cb94072818 100644 --- a/mysql-test/r/insert_select.result +++ b/mysql-test/r/insert_select.result @@ -606,8 +606,8 @@ NULL 2 100 create table t2(No int not null, Field int not null, Count int not null); insert into t2 Select null, Field, Count From t1 Where Month=20030901 and Type=2; Warnings: -Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'No' at row 1 -Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'No' at row 2 +Warning 1048 Column 'No' cannot be null +Warning 1048 Column 'No' cannot be null select * from t2; No Field Count 0 1 100 @@ -688,7 +688,16 @@ ERROR 42S22: Unknown column 't2.x' in 'field list' drop table t1,t2; CREATE TABLE t1 (a int PRIMARY KEY); INSERT INTO t1 values (1), (2); +flush status; INSERT INTO t1 SELECT a + 2 FROM t1 LIMIT 1; +show status like 'Handler_read%'; +Variable_name Value +Handler_read_first 1 +Handler_read_key 0 +Handler_read_next 0 +Handler_read_prev 0 +Handler_read_rnd 0 +Handler_read_rnd_next 1 DROP TABLE t1; CREATE TABLE t1 (x int, y int); CREATE TABLE t2 (z int, y int); @@ -773,3 +782,25 @@ d 20 20 DROP TABLE t1,t2; +CREATE TABLE t1 ( +id INT AUTO_INCREMENT PRIMARY KEY, +prev_id INT, +join_id INT DEFAULT 0); +INSERT INTO t1 (prev_id) VALUES (NULL), (1), (2); +SELECT * FROM t1; +id prev_id join_id +1 NULL 0 +2 1 0 +3 2 0 +CREATE TABLE t2 (join_id INT); +INSERT INTO t2 (join_id) VALUES (0); +INSERT INTO t1 (prev_id) SELECT id +FROM t2 LEFT JOIN t1 ON t1.join_id = t2.join_id +ORDER BY id DESC LIMIT 1; +SELECT * FROM t1; +id prev_id join_id +1 NULL 0 +2 1 0 +3 2 0 +4 3 0 +DROP TABLE t1,t2; diff --git a/mysql-test/r/insert_update.result b/mysql-test/r/insert_update.result index 375961292a3..20cde86101e 100644 --- a/mysql-test/r/insert_update.result +++ b/mysql-test/r/insert_update.result @@ -378,7 +378,7 @@ id c1 cnt INSERT IGNORE INTO t1 (id,c1) SELECT 1,NULL ON DUPLICATE KEY UPDATE c1=NULL, cnt=cnt+1; Warnings: -Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'c1' at row 1 +Warning 1048 Column 'c1' cannot be null Error 1048 Column 'c1' cannot be null SELECT * FROM t1; id c1 cnt @@ -386,10 +386,24 @@ id c1 cnt INSERT IGNORE INTO t1 (id,c1) SELECT * FROM t2 ON DUPLICATE KEY UPDATE c1=NULL, cnt=cnt+1; Warnings: -Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'c1' at row 1 +Warning 1048 Column 'c1' cannot be null Error 1048 Column 'c1' cannot be null SELECT * FROM t1; id c1 cnt 1 0 3 2 2 1 DROP TABLE t1; +create table t1(f1 int primary key, +f2 timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP); +insert into t1(f1) values(1); +select @stamp1:=f2 from t1; +@stamp1:=f2 +# +insert into t1(f1) values(1) on duplicate key update f1=1; +select @stamp2:=f2 from t1; +@stamp2:=f2 +# +select if( @stamp1 = @stamp2, "correct", "wrong"); +if( @stamp1 = @stamp2, "correct", "wrong") +correct +drop table t1; diff --git a/mysql-test/r/join_outer.result b/mysql-test/r/join_outer.result index c62601946c2..1366a8fe97a 100644 --- a/mysql-test/r/join_outer.result +++ b/mysql-test/r/join_outer.result @@ -1239,3 +1239,18 @@ Handler_read_prev 0 Handler_read_rnd 0 Handler_read_rnd_next 6 DROP TABLE t1,t2; +CREATE TABLE t1 (c int PRIMARY KEY, e int NOT NULL); +INSERT INTO t1 VALUES (1,0), (2,1); +CREATE TABLE t2 (d int PRIMARY KEY); +INSERT INTO t2 VALUES (1), (2), (3); +EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON e<>0 WHERE c=1 AND d IS NULL; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 +1 SIMPLE t2 index NULL PRIMARY 4 NULL 3 Using where; Using index; Not exists +SELECT * FROM t1 LEFT JOIN t2 ON e<>0 WHERE c=1 AND d IS NULL; +c e d +1 0 NULL +SELECT * FROM t1 LEFT JOIN t2 ON e<>0 WHERE c=1 AND d<=>NULL; +c e d +1 0 NULL +DROP TABLE t1,t2; diff --git a/mysql-test/r/key.result b/mysql-test/r/key.result index ec15eaa97f5..5a707770ab8 100644 --- a/mysql-test/r/key.result +++ b/mysql-test/r/key.result @@ -159,8 +159,8 @@ CREATE TABLE t1 (c CHAR(10) NOT NULL,i INT NOT NULL AUTO_INCREMENT, UNIQUE (c,i)); INSERT INTO t1 (c) VALUES (NULL),(NULL); Warnings: -Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'c' at row 1 -Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'c' at row 2 +Warning 1048 Column 'c' cannot be null +Warning 1048 Column 'c' cannot be null SELECT * FROM t1; c i 1 @@ -455,3 +455,11 @@ ORDER BY c.b, c.d a b c d e f g h i j a b c d 2 2 1 2004-11-30 12:00:00 1 0 0 0 0 0 2 3388000 -553000 NULL DROP TABLE t1, t2; +CREATE TABLE t1( a TINYINT, KEY(a) ) ENGINE=MyISAM; +INSERT INTO t1 VALUES( 1 ); +ALTER TABLE t1 DISABLE KEYS; +EXPLAIN SELECT MAX(a) FROM t1 FORCE INDEX(a); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 system NULL NULL NULL NULL 1 +DROP TABLE t1; +End of 5.0 tests. diff --git a/mysql-test/r/key_cache.result b/mysql-test/r/key_cache.result index a1bf3d0e128..08d8059f61b 100644 --- a/mysql-test/r/key_cache.result +++ b/mysql-test/r/key_cache.result @@ -191,10 +191,8 @@ cache index t1 in unknown_key_cache; ERROR HY000: Unknown key cache 'unknown_key_cache' cache index t1 key (unknown_key) in keycache1; Table Op Msg_type Msg_text -test.t1 assign_to_keycache error Key 'unknown_key' doesn't exist in table 't1' +test.t1 assign_to_keycache Error Key 'unknown_key' doesn't exist in table 't1' test.t1 assign_to_keycache status Operation failed -Warnings: -Error 1176 Key 'unknown_key' doesn't exist in table 't1' select @@keycache2.key_buffer_size; @@keycache2.key_buffer_size 4194304 @@ -341,3 +339,30 @@ Warning 1438 Cannot drop default keycache select @@global.key_buffer_size; @@global.key_buffer_size 2097152 +SET @bug28478_key_cache_block_size= @@global.key_cache_block_size; +SET GLOBAL key_cache_block_size= 1536; +CREATE TABLE t1 ( +id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY, +c1 CHAR(150), +c2 CHAR(150), +c3 CHAR(150), +KEY(c1, c2, c3) +) ENGINE= MyISAM; +INSERT INTO t1 (c1, c2, c3) VALUES +('a', 'b', 'c'), ('b', 'c', 'd'), ('c', 'd', 'e'), ('d', 'e', 'f'), +('e', 'f', 'g'), ('f', 'g', 'h'), ('g', 'h', 'i'), ('h', 'i', 'j'), +('i', 'j', 'k'), ('j', 'k', 'l'), ('k', 'l', 'm'), ('l', 'm', 'n'), +('m', 'n', 'o'), ('n', 'o', 'p'), ('o', 'p', 'q'), ('p', 'q', 'r'), +('q', 'r', 's'), ('r', 's', 't'), ('s', 't', 'u'), ('t', 'u', 'v'), +('u', 'v', 'w'), ('v', 'w', 'x'), ('w', 'x', 'y'), ('x', 'y', 'z'); +INSERT INTO t1 (c1, c2, c3) SELECT c1, c2, c3 from t1; +INSERT INTO t1 (c1, c2, c3) SELECT c1, c2, c3 from t1; +INSERT INTO t1 (c1, c2, c3) SELECT c1, c2, c3 from t1; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SHOW VARIABLES LIKE 'key_cache_block_size'; +Variable_name Value +key_cache_block_size 1536 +SET GLOBAL key_cache_block_size= @bug28478_key_cache_block_size; +DROP TABLE t1; diff --git a/mysql-test/r/kill.result b/mysql-test/r/kill.result index cf5486d1091..7ddabe74c5f 100644 --- a/mysql-test/r/kill.result +++ b/mysql-test/r/kill.result @@ -22,7 +22,7 @@ create table t2 (id int unsigned not null); insert into t2 select id from t1; create table t3 (kill_id int); insert into t3 values(connection_id()); -select id from t1 where id in (select distinct id from t2); +select id from t1 where id in (select distinct a.id from t2 a, t2 b, t2 c, t2 d group by a.id, b.id, c.id, d.id having a.id between 10 and 20); select ((@id := kill_id) - kill_id) from t3; ((@id := kill_id) - kill_id) 0 @@ -41,3 +41,87 @@ select 1; select RELEASE_LOCK("a"); RELEASE_LOCK("a") 1 +create table t1(f1 int); +create function bug27563() returns int(11) +deterministic +begin +declare continue handler for sqlstate '70100' set @a:= 'killed'; +declare continue handler for sqlexception set @a:= 'exception'; +set @a= get_lock("lock27563", 10); +return 1; +end| +select get_lock("lock27563",10); +get_lock("lock27563",10) +1 +insert into t1 values (bug27563()); +ERROR 70100: Query execution was interrupted +select @a; +@a +NULL +select * from t1; +f1 +insert into t1 values(0); +update t1 set f1= bug27563(); +ERROR 70100: Query execution was interrupted +select @a; +@a +NULL +select * from t1; +f1 +0 +insert into t1 values(1); +delete from t1 where bug27563() is null; +ERROR 70100: Query execution was interrupted +select @a; +@a +NULL +select * from t1; +f1 +0 +1 +select * from t1 where f1= bug27563(); +ERROR 70100: Query execution was interrupted +select @a; +@a +NULL +create procedure proc27563() +begin +declare continue handler for sqlstate '70100' set @a:= 'killed'; +declare continue handler for sqlexception set @a:= 'exception'; +select get_lock("lock27563",10); +select "shouldn't be selected"; +end| +call proc27563(); +get_lock("lock27563",10) +NULL +ERROR 70100: Query execution was interrupted +select @a; +@a +NULL +create table t2 (f2 int); +create trigger trg27563 before insert on t1 for each row +begin +declare continue handler for sqlstate '70100' set @a:= 'killed'; +declare continue handler for sqlexception set @a:= 'exception'; +set @a:= get_lock("lock27563",10); +insert into t2 values(1); +end| +insert into t1 values(2),(3); +ERROR 70100: Query execution was interrupted +select @a; +@a +NULL +select * from t1; +f1 +0 +1 +select * from t2; +f2 +select release_lock("lock27563"); +release_lock("lock27563") +1 +drop table t1, t2; +drop function bug27563; +drop procedure proc27563; +PREPARE stmt FROM 'EXPLAIN SELECT * FROM t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40 WHERE a1=a2 AND a2=a3 AND a3=a4 AND a4=a5 AND a5=a6 AND a6=a7 AND a7=a8 AND a8=a9 AND a9=a10 AND a10=a11 AND a11=a12 AND a12=a13 AND a13=a14 AND a14=a15 AND a15=a16 AND a16=a17 AND a17=a18 AND a18=a19 AND a19=a20 AND a20=a21 AND a21=a22 AND a22=a23 AND a23=a24 AND a24=a25 AND a25=a26 AND a26=a27 AND a27=a28 AND a28=a29 AND a29=a30 AND a30=a31 AND a31=a32 AND a32=a33 AND a33=a34 AND a34=a35 AND a35=a36 AND a36=a37 AND a37=a38 AND a38=a39 AND a39=a40 '; +EXECUTE stmt; diff --git a/mysql-test/r/limit.result b/mysql-test/r/limit.result index ac96ac8ff17..01d7d7ca218 100644 --- a/mysql-test/r/limit.result +++ b/mysql-test/r/limit.result @@ -91,3 +91,14 @@ select sum(a) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3; c 28 drop table t1; +prepare s from "select 1 limit ?"; +set @a='qwe'; +execute s using @a; +ERROR HY000: Incorrect arguments to EXECUTE +prepare s from "select 1 limit 1, ?"; +execute s using @a; +ERROR HY000: Incorrect arguments to EXECUTE +prepare s from "select 1 limit ?, ?"; +execute s using @a, @a; +ERROR HY000: Incorrect arguments to EXECUTE +End of 5.0 tests diff --git a/mysql-test/r/loaddata.result b/mysql-test/r/loaddata.result index a02aaccf8f6..7fff2700779 100644 --- a/mysql-test/r/loaddata.result +++ b/mysql-test/r/loaddata.result @@ -86,6 +86,60 @@ field1 field2 a"b cd"ef a"b c"d"e drop table t1; +CREATE TABLE t1 ( +id INT AUTO_INCREMENT PRIMARY KEY, +c1 VARCHAR(255) +); +CREATE TABLE t2 ( +id INT, +c2 VARCHAR(255) +); +INSERT INTO t1 (c1) VALUES +('r'), ('rr'), ('rrr'), ('rrrr'), +('.r'), ('.rr'), ('.rrr'), ('.rrrr'), +('r.'), ('rr.'), ('rrr.'), ('rrrr.'), +('.r.'), ('.rr.'), ('.rrr.'), ('.rrrr.'); +SELECT * FROM t1; +id c1 +1 r +2 rr +3 rrr +4 rrrr +5 .r +6 .rr +7 .rrr +8 .rrrr +9 r. +10 rr. +11 rrr. +12 rrrr. +13 .r. +14 .rr. +15 .rrr. +16 .rrrr. +SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1' FIELDS ENCLOSED BY 'r' FROM t1; +r1r rrrr +r2r rrrrrr +r3r rrrrrrrr +r4r rrrrrrrrrr +r5r r.rrr +r6r r.rrrrr +r7r r.rrrrrrr +r8r r.rrrrrrrrr +r9r rrr.r +r10r rrrrr.r +r11r rrrrrrr.r +r12r rrrrrrrrr.r +r13r r.rr.r +r14r r.rrrr.r +r15r r.rrrrrr.r +r16r r.rrrrrrrr.r +LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1' INTO TABLE t2 FIELDS ENCLOSED BY 'r'; +SELECT t1.id, c1, c2 FROM t1 LEFT JOIN t2 ON t1.id=t2.id WHERE c1 != c2; +id c1 c2 +SELECT t1.id, c1, c2 FROM t1 RIGHT JOIN t2 ON t1.id=t2.id WHERE c1 != c2; +id c1 c2 +DROP TABLE t1,t2; create table t1 (a int default 100, b int, c varchar(60)); load data infile '../std_data_ln/rpl_loaddata.dat' into table t1 (a, @b) set b=@b+10, c=concat("b=",@b); select * from t1; @@ -184,3 +238,17 @@ f1 1 2 drop table t1,t2; +CREATE TABLE t1 (c1 INT, c2 TIMESTAMP, c3 REAL, c4 DOUBLE); +INSERT INTO t1 (c1, c2, c3, c4) VALUES (10, '1970-02-01 01:02:03', 1.1E-100, 1.1E+100); +SELECT * FROM t1; +c1 c2 c3 c4 +10 1970-02-01 01:02:03 1.1e-100 1.1e+100 +SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1' FIELDS ENCLOSED BY '-' FROM t1; +-10- -1970\-02\-01 01:02:03- -1.1e\-100- -1.1e+100- +EOF +TRUNCATE t1; +LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1' INTO TABLE t1 FIELDS ENCLOSED BY '-'; +SELECT * FROM t1; +c1 c2 c3 c4 +10 1970-02-01 01:02:03 1.1e-100 1.1e+100 +DROP TABLE t1; diff --git a/mysql-test/r/lock.result b/mysql-test/r/lock.result index 079b0253ff6..a5a78ecc986 100644 --- a/mysql-test/r/lock.result +++ b/mysql-test/r/lock.result @@ -40,7 +40,8 @@ test.t1 check status OK lock tables t1 write; check table t2; Table Op Msg_type Msg_text -test.t2 check error Table 't2' was not locked with LOCK TABLES +test.t2 check Error Table 't2' was not locked with LOCK TABLES +test.t2 check error Corrupt insert into t1 select index1,nr from t1; ERROR HY000: Table 't1' was not locked with LOCK TABLES unlock tables; diff --git a/mysql-test/r/long_tmpdir.result b/mysql-test/r/long_tmpdir.result new file mode 100644 index 00000000000..7e6dd34ced1 --- /dev/null +++ b/mysql-test/r/long_tmpdir.result @@ -0,0 +1,3 @@ +create view v1 as select table_name from information_schema.tables; +drop view v1; +End of 5.0 tests diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result index 27465dd96f6..42669eeb66f 100644 --- a/mysql-test/r/merge.result +++ b/mysql-test/r/merge.result @@ -844,4 +844,36 @@ insert into t1 values (1); ERROR HY000: Table 't1' is read only drop table t2; drop table t1; +CREATE TABLE tm1(a INT) ENGINE=MERGE UNION=(t1, t2); +SELECT * FROM tm1; +ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist +CHECK TABLE tm1; +Table Op Msg_type Msg_text +test.tm1 check Error Table 'test.t1' is differently defined or of non-MyISAM type or doesn't exist +test.tm1 check Error Table 'test.t2' is differently defined or of non-MyISAM type or doesn't exist +test.tm1 check Error Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist +test.tm1 check error Corrupt +CREATE TABLE t1(a INT); +SELECT * FROM tm1; +ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist +CHECK TABLE tm1; +Table Op Msg_type Msg_text +test.tm1 check Error Table 'test.t2' is differently defined or of non-MyISAM type or doesn't exist +test.tm1 check Error Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist +test.tm1 check error Corrupt +CREATE TABLE t2(a BLOB); +SELECT * FROM tm1; +ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist +CHECK TABLE tm1; +Table Op Msg_type Msg_text +test.tm1 check Error Table 'test.t2' is differently defined or of non-MyISAM type or doesn't exist +test.tm1 check Error Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist +test.tm1 check error Corrupt +ALTER TABLE t2 MODIFY a INT; +SELECT * FROM tm1; +a +CHECK TABLE tm1; +Table Op Msg_type Msg_text +test.tm1 check status OK +DROP TABLE tm1, t1, t2; End of 5.0 tests diff --git a/mysql-test/r/metadata.result b/mysql-test/r/metadata.result index 34e961395c4..4a776b6a253 100644 --- a/mysql-test/r/metadata.result +++ b/mysql-test/r/metadata.result @@ -130,3 +130,55 @@ def v3 renamed 8 12 0 Y 32896 0 63 renamed drop table t1; drop view v1,v2,v3; +select a.* from (select 2147483648 as v_large) a; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def a v_large v_large 8 10 10 N 32769 0 63 +v_large +2147483648 +select a.* from (select 214748364 as v_small) a; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def a v_small v_small 3 9 9 N 32769 0 63 +v_small +214748364 +CREATE TABLE t1 (c1 CHAR(1)); +CREATE TABLE t2 (c2 CHAR(1)); +CREATE VIEW v1 AS SELECT t1.c1 FROM t1; +CREATE VIEW v2 AS SELECT t2.c2 FROM t2; +INSERT INTO t1 VALUES ('1'), ('2'), ('3'); +INSERT INTO t2 VALUES ('1'), ('2'), ('3'), ('2'); +SELECT v1.c1 FROM v1 JOIN t2 ON c1=c2 ORDER BY 1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 v1 c1 c1 254 1 1 Y 0 0 8 +c1 +1 +2 +2 +3 +SELECT v1.c1, v2.c2 FROM v1 JOIN v2 ON c1=c2; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 v1 c1 c1 254 1 1 Y 0 0 8 +def test t2 v2 c2 c2 254 1 1 Y 0 0 8 +c1 c2 +1 1 +2 2 +3 3 +2 2 +SELECT v1.c1, v2.c2 FROM v1 JOIN v2 ON c1=c2 GROUP BY v1.c1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 v1 c1 c1 254 1 1 Y 32768 0 8 +def test t2 v2 c2 c2 254 1 1 Y 0 0 8 +c1 c2 +1 1 +2 2 +3 3 +SELECT v1.c1, v2.c2 FROM v1 JOIN v2 ON c1=c2 GROUP BY v1.c1 ORDER BY v2.c2; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 v1 c1 c1 254 1 1 Y 32768 0 8 +def test t2 v2 c2 c2 254 1 1 Y 0 0 8 +c1 c2 +1 1 +2 2 +3 3 +DROP VIEW v1,v2; +DROP TABLE t1,t2; +End of 5.0 tests diff --git a/mysql-test/r/mix_innodb_myisam_binlog.result b/mysql-test/r/mix_innodb_myisam_binlog.result index a8b132ae927..8fc5bfca3ef 100644 --- a/mysql-test/r/mix_innodb_myisam_binlog.result +++ b/mysql-test/r/mix_innodb_myisam_binlog.result @@ -11,7 +11,7 @@ Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 98 Query 1 # use `test`; BEGIN master-bin.000001 166 Query 1 # use `test`; insert into t1 values(1) master-bin.000001 253 Query 1 # use `test`; insert into t2 select * from t1 -master-bin.000001 347 Xid 1 # COMMIT /* xid=8 */ +master-bin.000001 347 Xid 1 # COMMIT /* XID */ delete from t1; delete from t2; reset master; @@ -47,7 +47,7 @@ master-bin.000001 253 Query 1 # use `test`; savepoint my_savepoint master-bin.000001 338 Query 1 # use `test`; insert into t1 values(4) master-bin.000001 425 Query 1 # use `test`; insert into t2 select * from t1 master-bin.000001 519 Query 1 # use `test`; rollback to savepoint my_savepoint -master-bin.000001 616 Xid 1 # COMMIT /* xid=25 */ +master-bin.000001 616 Xid 1 # COMMIT /* XID */ delete from t1; delete from t2; reset master; @@ -74,7 +74,7 @@ master-bin.000001 338 Query 1 # use `test`; insert into t1 values(6) master-bin.000001 425 Query 1 # use `test`; insert into t2 select * from t1 master-bin.000001 519 Query 1 # use `test`; rollback to savepoint my_savepoint master-bin.000001 616 Query 1 # use `test`; insert into t1 values(7) -master-bin.000001 703 Xid 1 # COMMIT /* xid=37 */ +master-bin.000001 703 Xid 1 # COMMIT /* XID */ delete from t1; delete from t2; reset master; @@ -101,7 +101,7 @@ insert into t2 select * from t1; show binlog events from 98; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 98 Query 1 # use `test`; insert into t1 values(9) -master-bin.000001 185 Xid 1 # COMMIT /* xid=60 */ +master-bin.000001 185 Xid 1 # COMMIT /* XID */ master-bin.000001 212 Query 1 # use `test`; insert into t2 select * from t1 delete from t1; delete from t2; @@ -112,18 +112,18 @@ insert into t2 select * from t1; show binlog events from 98; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 98 Query 1 # use `test`; insert into t1 values(10) -master-bin.000001 186 Xid 1 # COMMIT /* xid=66 */ +master-bin.000001 186 Xid 1 # COMMIT /* XID */ master-bin.000001 213 Query 1 # use `test`; insert into t2 select * from t1 insert into t1 values(11); commit; show binlog events from 98; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 98 Query 1 # use `test`; insert into t1 values(10) -master-bin.000001 186 Xid 1 # COMMIT /* xid=66 */ +master-bin.000001 186 Xid 1 # COMMIT /* XID */ master-bin.000001 213 Query 1 # use `test`; insert into t2 select * from t1 master-bin.000001 307 Query 1 # use `test`; BEGIN master-bin.000001 375 Query 1 # use `test`; insert into t1 values(11) -master-bin.000001 463 Xid 1 # COMMIT /* xid=68 */ +master-bin.000001 463 Xid 1 # COMMIT /* XID */ alter table t2 engine=INNODB; delete from t1; delete from t2; @@ -137,7 +137,7 @@ Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 98 Query 1 # use `test`; BEGIN master-bin.000001 166 Query 1 # use `test`; insert into t1 values(12) master-bin.000001 254 Query 1 # use `test`; insert into t2 select * from t1 -master-bin.000001 348 Xid 1 # COMMIT /* xid=78 */ +master-bin.000001 348 Xid 1 # COMMIT /* XID */ delete from t1; delete from t2; reset master; @@ -161,7 +161,7 @@ show binlog events from 98; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 98 Query 1 # use `test`; BEGIN master-bin.000001 166 Query 1 # use `test`; insert into t1 values(14) -master-bin.000001 254 Xid 1 # COMMIT /* xid=94 */ +master-bin.000001 254 Xid 1 # COMMIT /* XID */ delete from t1; delete from t2; reset master; @@ -182,7 +182,7 @@ Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 98 Query 1 # use `test`; BEGIN master-bin.000001 166 Query 1 # use `test`; insert into t1 values(16) master-bin.000001 254 Query 1 # use `test`; insert into t1 values(18) -master-bin.000001 342 Xid 1 # COMMIT /* xid=105 */ +master-bin.000001 342 Xid 1 # COMMIT /* XID */ delete from t1; delete from t2; alter table t2 type=MyISAM; @@ -234,19 +234,19 @@ Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 98 Query 1 # use `test`; BEGIN master-bin.000001 166 Query 1 # use `test`; insert into t1 values(16) master-bin.000001 254 Query 1 # use `test`; insert into t1 values(18) -master-bin.000001 342 Xid 1 # COMMIT /* xid=105 */ +master-bin.000001 342 Xid 1 # COMMIT /* XID */ master-bin.000001 369 Query 1 # use `test`; delete from t1 -master-bin.000001 446 Xid 1 # COMMIT /* xid=114 */ +master-bin.000001 446 Xid 1 # COMMIT /* XID */ master-bin.000001 473 Query 1 # use `test`; delete from t2 -master-bin.000001 550 Xid 1 # COMMIT /* xid=115 */ +master-bin.000001 550 Xid 1 # COMMIT /* XID */ master-bin.000001 577 Query 1 # use `test`; alter table t2 type=MyISAM master-bin.000001 666 Query 1 # use `test`; insert into t1 values (1) -master-bin.000001 754 Xid 1 # COMMIT /* xid=117 */ +master-bin.000001 754 Xid 1 # COMMIT /* XID */ master-bin.000001 781 Query 1 # use `test`; insert into t2 values (20) master-bin.000001 870 Query 1 # use `test`; drop table t1,t2 master-bin.000001 949 Query 1 # use `test`; create temporary table ti (a int) engine=innodb master-bin.000001 1059 Query 1 # use `test`; insert into ti values(1) -master-bin.000001 1146 Xid 1 # COMMIT /* xid=132 */ +master-bin.000001 1146 Xid 1 # COMMIT /* XID */ master-bin.000001 1173 Query 1 # use `test`; create temporary table t1 (a int) engine=myisam master-bin.000001 1283 Query 1 # use `test`; insert t1 values (1) master-bin.000001 1366 Query 1 # use `test`; create table t0 (n int) diff --git a/mysql-test/r/multi_update.result b/mysql-test/r/multi_update.result index 78872f27c47..0f624e3ee8d 100644 --- a/mysql-test/r/multi_update.result +++ b/mysql-test/r/multi_update.result @@ -524,3 +524,37 @@ a 30 drop view v1; drop table t1, t2; +CREATE TABLE `t1` ( +`a` int(11) NOT NULL auto_increment, +`b` int(11) default NULL, +PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 ; +CREATE TABLE `t2` ( +`a` int(11) NOT NULL auto_increment, +`b` int(11) default NULL, +PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 ; +insert into t1 values (1,1),(2,2); +insert into t2 values (1,1),(4,4); +reset master; +UPDATE t2,t1 SET t2.a=t1.a+2; +ERROR 23000: Duplicate entry '3' for key 1 +select * from t2 /* must be (3,1), (4,4) */; +a b +3 1 +4 4 +show master status /* there must be the UPDATE query event */; +File Position Binlog_Do_DB Binlog_Ignore_DB +master-bin.000001 189 +delete from t1; +delete from t2; +insert into t1 values (1,2),(3,4),(4,4); +insert into t2 values (1,2),(3,4),(4,4); +reset master; +UPDATE t2,t1 SET t2.a=t2.b where t2.a=t1.a; +ERROR 23000: Duplicate entry '4' for key 1 +show master status /* there must be the UPDATE query event */; +File Position Binlog_Do_DB Binlog_Ignore_DB +master-bin.000001 204 +drop table t1, t2; +end of tests diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result index 94f2f1f72b3..7fc29cd13ca 100644 --- a/mysql-test/r/myisam.result +++ b/mysql-test/r/myisam.result @@ -1780,4 +1780,30 @@ create table t3 (c1 int) engine=myisam pack_keys=default; create table t4 (c1 int) engine=myisam pack_keys=2; ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '2' at line 1 drop table t1, t2, t3; +CREATE TABLE t1(a INT, b INT, KEY inx (a), UNIQUE KEY uinx (b)) ENGINE=MyISAM; +INSERT INTO t1(a,b) VALUES (1,1),(2,2),(3,3),(4,4),(5,5); +SELECT a FROM t1 FORCE INDEX (inx) WHERE a=1; +a +1 +ALTER TABLE t1 DISABLE KEYS; +SELECT a FROM t1 FORCE INDEX (inx) WHERE a=1; +a +1 +SELECT a FROM t1 USE INDEX (inx) WHERE a=1; +a +1 +SELECT b FROM t1 FORCE INDEX (uinx) WHERE b=1; +b +1 +SELECT b FROM t1 USE INDEX (uinx) WHERE b=1; +b +1 +SELECT a FROM t1 FORCE INDEX (inx,uinx) WHERE a=1; +a +1 +ALTER TABLE t1 ENABLE KEYS; +SELECT a FROM t1 FORCE INDEX (inx) WHERE a=1; +a +1 +DROP TABLE t1; End of 5.0 tests diff --git a/mysql-test/r/mysqlbinlog.result b/mysql-test/r/mysqlbinlog.result index a50d131cca8..1ba198dfd75 100644 --- a/mysql-test/r/mysqlbinlog.result +++ b/mysql-test/r/mysqlbinlog.result @@ -312,4 +312,10 @@ DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +CREATE TABLE t1 (c1 CHAR(10)); +flush logs; +INSERT INTO t1 VALUES ('0123456789'); +flush logs; +DROP TABLE t1; +# Query thread_id=REMOVED exec_time=REMOVED error_code=REMOVED End of 5.0 tests diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result index 6ccca713948..8eac7c7e715 100644 --- a/mysql-test/r/mysqldump.result +++ b/mysql-test/r/mysqldump.result @@ -3206,7 +3206,7 @@ DROP TABLE t1; # CREATE TABLE t1(a int); INSERT INTO t1 VALUES (1), (2); -mysqldump: Input filename or options too long: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +mysqldump: Input filename too long: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa DROP TABLE t1; CREATE TABLE t2 (a int); CREATE TABLE t3 (a int); @@ -3310,5 +3310,16 @@ drop user user1; drop user user2; drop database mysqldump_test_db; # +# Bug #28522: buffer overrun by '\0' byte using --hex-blob. +# +CREATE TABLE t1 (c1 INT, c2 LONGBLOB); +INSERT INTO t1 SET c1=11, c2=REPEAT('q',509); +CREATE TABLE `t1` ( + `c1` int(11) default NULL, + `c2` longblob +); +INSERT INTO `t1` VALUES (11,0x7171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171); +DROP TABLE t1; +# # End of 5.0 tests # diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result index 35dcf9b62d2..55f78d22272 100644 --- a/mysql-test/r/mysqltest.result +++ b/mysql-test/r/mysqltest.result @@ -339,6 +339,7 @@ here is the sourced script In loop here is the sourced script +here is the sourced script mysqltest: At line 1: Missing argument to sleep mysqltest: At line 1: Missing argument to real_sleep mysqltest: At line 1: Invalid argument to sleep "abc" @@ -410,7 +411,6 @@ mysqltest: At line 1: Wrong column number to replace_column in 'replace_column a mysqltest: At line 1: Wrong column number to replace_column in 'replace_column a 1' mysqltest: At line 1: Wrong column number to replace_column in 'replace_column 1 b c ' mysqltest: At line 1: Invalid integer argument "10!" -mysqltest: At line 1: End of line junk detected: "!" mysqltest: At line 1: Invalid integer argument "a" mysqltest: At line 1: Missing required argument 'connection name' to command 'connect' mysqltest: At line 1: Missing required argument 'connection name' to command 'connect' @@ -420,7 +420,7 @@ mysqltest: At line 1: query 'connect con2,localhost,root,,illegal_db' failed: 1 mysqltest: At line 1: Illegal argument for port: 'illegal_port' mysqltest: At line 1: Illegal option to connect: SMTP OK -mysqltest: In included file "MYSQLTEST_VARDIR/tmp/mysqltest.sql": At line 7: Connection limit exhausted, you can have max 128 connections +mysqltest: The test didn't produce any output mysqltest: In included file "MYSQLTEST_VARDIR/tmp/mysqltest.sql": At line 3: connection 'test_con1' not found in connection pool mysqltest: In included file "MYSQLTEST_VARDIR/tmp/mysqltest.sql": At line 2: Connection test_con1 already exists connect(localhost,root,,test,MASTER_PORT,MASTER_SOCKET); @@ -666,4 +666,43 @@ INSERT INTO t1 SELECT f1 - 256 FROM t1; INSERT INTO t1 SELECT f1 - 512 FROM t1; SELECT * FROM t1; DROP TABLE t1; +CREATE TABLE t1( +a int, b varchar(255), c datetime +); +SHOW COLUMNS FROM t1; +Field Type Null Key Default Extra +a int(11) YES NULL +b varchar(255) YES NULL +c datetime YES NULL +statement=SHOW COLUMNS FROM t1 row_number=1, column_name="Type", Value=int(11) +statement="SHOW COLUMNS FROM t1" row_number=1, column_name="Type", Value=int(11) +statement=SHOW COLUMNS FROM t1 row_number=1, column_name=Default, Value=NULL +value= ->A B<- +value= 1 +mysqltest: At line 1: query_get_value - argument list started with '(' must be ended with ')' +mysqltest: At line 1: Missing required argument 'query' to command 'query_get_value' +mysqltest: At line 1: Missing required argument 'column name' to command 'query_get_value' +mysqltest: At line 1: Missing required argument 'row number' to command 'query_get_value' +value= No such row +value= No such row +mysqltest: At line 1: Invalid row number: 'notnumber' +mysqltest: At line 1: Could not find column 'column_not_exists' in the result of 'SHOW COLUMNS FROM t1' +mysqltest: At line 1: Query 'SET @A = 1' didn't return a result set +mysqltest: At line 1: Could not find column '1 AS B' in the result of 'SELECT 1 AS A' +value= No such row +mysqltest: At line 1: Error running query 'SHOW COLNS FROM t1': 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'COLNS FROM t1' at line 1 + +Field Type Null Key Default Extra +a int(11) YES -><- NULL +b varchar(255) YES -><- NULL +c datetime YES -><- NULL + +Number of columns with Default NULL: 3 + +SHOW COLUMNS FROM t1; +Field Type Null Key Default Extra +a int(11) YES NULL +b varchar(255) YES NULL +c datetime YES NULL +drop table t1; End of tests diff --git a/mysql-test/r/null.result b/mysql-test/r/null.result index daedfa50b80..c33adee76b2 100644 --- a/mysql-test/r/null.result +++ b/mysql-test/r/null.result @@ -97,39 +97,39 @@ Warnings: Warning 1265 Data truncated for column 'd' at row 1 UPDATE t1 SET d=NULL; Warnings: -Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'd' at row 1 +Warning 1048 Column 'd' cannot be null INSERT INTO t1 (a) values (null); ERROR 23000: Column 'a' cannot be null INSERT INTO t1 (a) values (1/null); ERROR 23000: Column 'a' cannot be null INSERT INTO t1 (a) values (null),(null); Warnings: -Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'a' at row 1 -Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'a' at row 2 +Warning 1048 Column 'a' cannot be null +Warning 1048 Column 'a' cannot be null INSERT INTO t1 (b) values (null); ERROR 23000: Column 'b' cannot be null INSERT INTO t1 (b) values (1/null); ERROR 23000: Column 'b' cannot be null INSERT INTO t1 (b) values (null),(null); Warnings: -Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'b' at row 1 -Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'b' at row 2 +Warning 1048 Column 'b' cannot be null +Warning 1048 Column 'b' cannot be null INSERT INTO t1 (c) values (null); ERROR 23000: Column 'c' cannot be null INSERT INTO t1 (c) values (1/null); ERROR 23000: Column 'c' cannot be null INSERT INTO t1 (c) values (null),(null); Warnings: -Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'c' at row 1 -Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'c' at row 2 +Warning 1048 Column 'c' cannot be null +Warning 1048 Column 'c' cannot be null INSERT INTO t1 (d) values (null); ERROR 23000: Column 'd' cannot be null INSERT INTO t1 (d) values (1/null); ERROR 23000: Column 'd' cannot be null INSERT INTO t1 (d) values (null),(null); Warnings: -Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'd' at row 1 -Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'd' at row 2 +Warning 1048 Column 'd' cannot be null +Warning 1048 Column 'd' cannot be null select * from t1; a b c d 0 0000-00-00 00:00:00 0 diff --git a/mysql-test/r/null_key.result b/mysql-test/r/null_key.result index 0b4ed15f659..8a440284c53 100644 --- a/mysql-test/r/null_key.result +++ b/mysql-test/r/null_key.result @@ -342,7 +342,7 @@ index (id2) ); insert into t1 values(null,null),(1,1); Warnings: -Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'id2' at row 1 +Warning 1048 Column 'id2' cannot be null select * from t1; id id2 NULL 0 diff --git a/mysql-test/r/olap.result b/mysql-test/r/olap.result index b1c29a5aadb..4a54b17316d 100644 --- a/mysql-test/r/olap.result +++ b/mysql-test/r/olap.result @@ -696,8 +696,8 @@ CREATE VIEW v1 AS SELECT a, LENGTH(a), COUNT(*) FROM t1 GROUP BY a WITH ROLLUP; DESC v1; Field Type Null Key Default Extra -a int(11) YES 0 -LENGTH(a) int(10) YES NULL +a bigint(11) YES NULL +LENGTH(a) bigint(10) YES NULL COUNT(*) bigint(21) NO 0 SELECT * FROM v1; a LENGTH(a) COUNT(*) diff --git a/mysql-test/r/preload.result b/mysql-test/r/preload.result index 145fd22ffb6..24a6e594a14 100644 --- a/mysql-test/r/preload.result +++ b/mysql-test/r/preload.result @@ -143,10 +143,9 @@ Key_read_requests 0 Key_reads 0 load index into cache t3, t2 key (primary,b) ; Table Op Msg_type Msg_text -test.t3 preload_keys error Table 'test.t3' doesn't exist +test.t3 preload_keys Error Table 'test.t3' doesn't exist +test.t3 preload_keys error Corrupt test.t2 preload_keys status OK -Warnings: -Error 1146 Table 'test.t3' doesn't exist show status like "key_read%"; Variable_name Value Key_read_requests 478 @@ -159,12 +158,10 @@ Key_read_requests 0 Key_reads 0 load index into cache t3 key (b), t2 key (c) ; Table Op Msg_type Msg_text -test.t3 preload_keys error Table 'test.t3' doesn't exist -test.t2 preload_keys error Key 'c' doesn't exist in table 't2' +test.t3 preload_keys Error Table 'test.t3' doesn't exist +test.t3 preload_keys error Corrupt +test.t2 preload_keys Error Key 'c' doesn't exist in table 't2' test.t2 preload_keys status Operation failed -Warnings: -Error 1146 Table 'test.t3' doesn't exist -Error 1176 Key 'c' doesn't exist in table 't2' show status like "key_read%"; Variable_name Value Key_read_requests 0 diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result index 8a10a52ee65..4db588e5cac 100644 --- a/mysql-test/r/ps.result +++ b/mysql-test/r/ps.result @@ -1378,45 +1378,39 @@ prepare stmt from "repair table t1, t4, t3"; execute stmt; Table Op Msg_type Msg_text test.t1 repair status OK -test.t4 repair error Table 'test.t4' doesn't exist +test.t4 repair Error Table 'test.t4' doesn't exist +test.t4 repair error Corrupt test.t3 repair status OK -Warnings: -Error 1146 Table 'test.t4' doesn't exist execute stmt; Table Op Msg_type Msg_text test.t1 repair status OK -test.t4 repair error Table 'test.t4' doesn't exist +test.t4 repair Error Table 'test.t4' doesn't exist +test.t4 repair error Corrupt test.t3 repair status OK -Warnings: -Error 1146 Table 'test.t4' doesn't exist prepare stmt from "optimize table t1, t3, t4"; execute stmt; Table Op Msg_type Msg_text test.t1 optimize status OK test.t3 optimize status OK -test.t4 optimize error Table 'test.t4' doesn't exist -Warnings: -Error 1146 Table 'test.t4' doesn't exist +test.t4 optimize Error Table 'test.t4' doesn't exist +test.t4 optimize error Corrupt execute stmt; Table Op Msg_type Msg_text test.t1 optimize status Table is already up to date test.t3 optimize status Table is already up to date -test.t4 optimize error Table 'test.t4' doesn't exist -Warnings: -Error 1146 Table 'test.t4' doesn't exist +test.t4 optimize Error Table 'test.t4' doesn't exist +test.t4 optimize error Corrupt prepare stmt from "analyze table t4, t1"; execute stmt; Table Op Msg_type Msg_text -test.t4 analyze error Table 'test.t4' doesn't exist +test.t4 analyze Error Table 'test.t4' doesn't exist +test.t4 analyze error Corrupt test.t1 analyze status Table is already up to date -Warnings: -Error 1146 Table 'test.t4' doesn't exist execute stmt; Table Op Msg_type Msg_text -test.t4 analyze error Table 'test.t4' doesn't exist +test.t4 analyze Error Table 'test.t4' doesn't exist +test.t4 analyze error Corrupt test.t1 analyze status Table is already up to date -Warnings: -Error 1146 Table 'test.t4' doesn't exist deallocate prepare stmt; drop table t1, t2, t3; create database mysqltest_long_database_name_to_thrash_heap; @@ -1683,4 +1677,13 @@ execute stmt; ERROR 42S22: Unknown column 'y.value' in 'field list' deallocate prepare stmt; drop tables t1; +prepare stmt from "create table t1 select ?"; +set @a=1.0; +execute stmt using @a; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `?` decimal(2,1) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; End of 5.0 tests. diff --git a/mysql-test/r/ps_1general.result b/mysql-test/r/ps_1general.result index df4ec793325..71f4bcbdf38 100644 --- a/mysql-test/r/ps_1general.result +++ b/mysql-test/r/ps_1general.result @@ -396,6 +396,8 @@ prepare stmt1 from ' execute stmt2 ' ; ERROR HY000: This command is not supported in the prepared statement protocol yet prepare stmt1 from ' deallocate prepare never_prepared ' ; ERROR HY000: This command is not supported in the prepared statement protocol yet +prepare stmt1 from 'alter view v1 as select 2'; +ERROR HY000: This command is not supported in the prepared statement protocol yet prepare stmt4 from ' use test ' ; ERROR HY000: This command is not supported in the prepared statement protocol yet prepare stmt3 from ' create database mysqltest '; @@ -466,7 +468,7 @@ def table 253 64 2 Y 0 31 8 def type 253 10 3 Y 0 31 8 def possible_keys 253 4096 0 Y 0 31 8 def key 253 64 0 Y 0 31 8 -def key_len 253 4096 0 Y 128 31 63 +def key_len 253 1365 0 Y 0 31 8 def ref 253 1024 0 Y 0 31 8 def rows 8 10 1 Y 32928 0 63 def Extra 253 255 14 N 1 31 8 @@ -482,7 +484,7 @@ def table 253 64 2 Y 0 31 8 def type 253 10 5 Y 0 31 8 def possible_keys 253 4096 7 Y 0 31 8 def key 253 64 7 Y 0 31 8 -def key_len 253 4096 1 Y 128 31 63 +def key_len 253 1365 1 Y 0 31 8 def ref 253 1024 0 Y 0 31 8 def rows 8 10 1 Y 32928 0 63 def Extra 253 255 27 N 1 31 8 diff --git a/mysql-test/r/ps_2myisam.result b/mysql-test/r/ps_2myisam.result index abd98067dae..7ccb41e6294 100644 --- a/mysql-test/r/ps_2myisam.result +++ b/mysql-test/r/ps_2myisam.result @@ -1158,7 +1158,7 @@ def table 253 64 2 Y 0 31 8 def type 253 10 3 Y 0 31 8 def possible_keys 253 4096 0 Y 0 31 8 def key 253 64 0 Y 0 31 8 -def key_len 253 4096 0 Y 128 31 63 +def key_len 253 1365 0 Y 0 31 8 def ref 253 1024 0 Y 0 31 8 def rows 8 10 1 Y 32928 0 63 def Extra 253 255 0 N 1 31 8 @@ -1304,7 +1304,7 @@ set @arg00=NULL; set @arg01=2; execute stmt1 using @arg00, @arg01; Warnings: -Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'a' at row 1 +Warning 1048 Column 'a' cannot be null select a,b from t1 order by a; a b 0 two @@ -1927,8 +1927,8 @@ def @arg07 253 23 1 Y 128 31 63 def @arg08 253 23 1 Y 128 31 63 def @arg09 253 23 1 Y 128 31 63 def @arg10 253 23 1 Y 128 31 63 -def @arg11 253 67 6 Y 128 30 63 -def @arg12 253 67 6 Y 128 30 63 +def @arg11 253 83 6 Y 128 30 63 +def @arg12 253 83 6 Y 128 30 63 def @arg13 253 8192 10 Y 128 31 63 def @arg14 253 8192 19 Y 128 31 63 def @arg15 253 8192 19 Y 128 31 63 @@ -1974,8 +1974,8 @@ def @arg07 253 23 0 Y 128 31 63 def @arg08 253 23 0 Y 128 31 63 def @arg09 253 23 0 Y 128 31 63 def @arg10 253 23 0 Y 128 31 63 -def @arg11 253 67 0 Y 128 30 63 -def @arg12 253 67 0 Y 128 30 63 +def @arg11 253 83 0 Y 128 30 63 +def @arg12 253 83 0 Y 128 30 63 def @arg13 253 8192 0 Y 128 31 63 def @arg14 253 8192 0 Y 128 31 63 def @arg15 253 8192 19 Y 128 31 63 @@ -2024,8 +2024,8 @@ def @arg07 253 23 1 Y 128 31 63 def @arg08 253 23 1 Y 128 31 63 def @arg09 253 23 1 Y 128 31 63 def @arg10 253 23 1 Y 128 31 63 -def @arg11 253 67 6 Y 128 30 63 -def @arg12 253 67 6 Y 128 30 63 +def @arg11 253 83 6 Y 128 30 63 +def @arg12 253 83 6 Y 128 30 63 def @arg13 253 8192 10 Y 128 31 63 def @arg14 253 8192 19 Y 128 31 63 def @arg15 253 8192 19 Y 128 31 63 @@ -2064,8 +2064,8 @@ def @arg07 253 23 0 Y 128 31 63 def @arg08 253 23 0 Y 128 31 63 def @arg09 253 23 0 Y 128 31 63 def @arg10 253 23 0 Y 128 31 63 -def @arg11 253 67 0 Y 128 30 63 -def @arg12 253 67 0 Y 128 30 63 +def @arg11 253 83 0 Y 128 30 63 +def @arg12 253 83 0 Y 128 30 63 def @arg13 253 8192 0 Y 128 31 63 def @arg14 253 8192 0 Y 128 31 63 def @arg15 253 8192 19 Y 128 31 63 @@ -2112,8 +2112,8 @@ def @arg07 253 23 1 Y 128 31 63 def @arg08 253 23 1 Y 128 31 63 def @arg09 253 23 1 Y 128 31 63 def @arg10 253 23 1 Y 128 31 63 -def @arg11 253 67 6 Y 128 30 63 -def @arg12 253 67 6 Y 128 30 63 +def @arg11 253 83 6 Y 128 30 63 +def @arg12 253 83 6 Y 128 30 63 def @arg13 253 8192 10 Y 128 31 63 def @arg14 253 8192 19 Y 128 31 63 def @arg15 253 8192 19 Y 128 31 63 @@ -2156,8 +2156,8 @@ def @arg07 253 23 0 Y 128 31 63 def @arg08 253 23 0 Y 128 31 63 def @arg09 253 23 0 Y 128 31 63 def @arg10 253 23 0 Y 128 31 63 -def @arg11 253 67 0 Y 128 30 63 -def @arg12 253 67 0 Y 128 30 63 +def @arg11 253 83 0 Y 128 30 63 +def @arg12 253 83 0 Y 128 30 63 def @arg13 253 8192 0 Y 128 31 63 def @arg14 253 8192 0 Y 128 31 63 def @arg15 253 8192 19 Y 128 31 63 @@ -2202,8 +2202,8 @@ def @arg07 253 23 1 Y 128 31 63 def @arg08 253 23 1 Y 128 31 63 def @arg09 253 23 1 Y 128 31 63 def @arg10 253 23 1 Y 128 31 63 -def @arg11 253 67 6 Y 128 30 63 -def @arg12 253 67 6 Y 128 30 63 +def @arg11 253 83 6 Y 128 30 63 +def @arg12 253 83 6 Y 128 30 63 def @arg13 253 8192 10 Y 128 31 63 def @arg14 253 8192 19 Y 128 31 63 def @arg15 253 8192 19 Y 128 31 63 @@ -2240,8 +2240,8 @@ def @arg07 253 23 0 Y 128 31 63 def @arg08 253 23 0 Y 128 31 63 def @arg09 253 23 0 Y 128 31 63 def @arg10 253 23 0 Y 128 31 63 -def @arg11 253 67 0 Y 128 30 63 -def @arg12 253 67 0 Y 128 30 63 +def @arg11 253 83 0 Y 128 30 63 +def @arg12 253 83 0 Y 128 30 63 def @arg13 253 8192 0 Y 128 31 63 def @arg14 253 8192 0 Y 128 31 63 def @arg15 253 8192 19 Y 128 31 63 diff --git a/mysql-test/r/ps_3innodb.result b/mysql-test/r/ps_3innodb.result index b90cf996db4..21d2b23f27b 100644 --- a/mysql-test/r/ps_3innodb.result +++ b/mysql-test/r/ps_3innodb.result @@ -1158,7 +1158,7 @@ def table 253 64 2 Y 0 31 8 def type 253 10 3 Y 0 31 8 def possible_keys 253 4096 0 Y 0 31 8 def key 253 64 0 Y 0 31 8 -def key_len 253 4096 0 Y 128 31 63 +def key_len 253 1365 0 Y 0 31 8 def ref 253 1024 0 Y 0 31 8 def rows 8 10 1 Y 32928 0 63 def Extra 253 255 0 N 1 31 8 @@ -1287,7 +1287,7 @@ set @arg00=NULL; set @arg01=2; execute stmt1 using @arg00, @arg01; Warnings: -Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'a' at row 1 +Warning 1048 Column 'a' cannot be null select a,b from t1 order by a; a b 0 two @@ -1910,8 +1910,8 @@ def @arg07 253 23 1 Y 128 31 63 def @arg08 253 23 1 Y 128 31 63 def @arg09 253 23 1 Y 128 31 63 def @arg10 253 23 1 Y 128 31 63 -def @arg11 253 67 6 Y 128 30 63 -def @arg12 253 67 6 Y 128 30 63 +def @arg11 253 83 6 Y 128 30 63 +def @arg12 253 83 6 Y 128 30 63 def @arg13 253 8192 10 Y 128 31 63 def @arg14 253 8192 19 Y 128 31 63 def @arg15 253 8192 19 Y 128 31 63 @@ -1957,8 +1957,8 @@ def @arg07 253 23 0 Y 128 31 63 def @arg08 253 23 0 Y 128 31 63 def @arg09 253 23 0 Y 128 31 63 def @arg10 253 23 0 Y 128 31 63 -def @arg11 253 67 0 Y 128 30 63 -def @arg12 253 67 0 Y 128 30 63 +def @arg11 253 83 0 Y 128 30 63 +def @arg12 253 83 0 Y 128 30 63 def @arg13 253 8192 0 Y 128 31 63 def @arg14 253 8192 0 Y 128 31 63 def @arg15 253 8192 19 Y 128 31 63 @@ -2007,8 +2007,8 @@ def @arg07 253 23 1 Y 128 31 63 def @arg08 253 23 1 Y 128 31 63 def @arg09 253 23 1 Y 128 31 63 def @arg10 253 23 1 Y 128 31 63 -def @arg11 253 67 6 Y 128 30 63 -def @arg12 253 67 6 Y 128 30 63 +def @arg11 253 83 6 Y 128 30 63 +def @arg12 253 83 6 Y 128 30 63 def @arg13 253 8192 10 Y 128 31 63 def @arg14 253 8192 19 Y 128 31 63 def @arg15 253 8192 19 Y 128 31 63 @@ -2047,8 +2047,8 @@ def @arg07 253 23 0 Y 128 31 63 def @arg08 253 23 0 Y 128 31 63 def @arg09 253 23 0 Y 128 31 63 def @arg10 253 23 0 Y 128 31 63 -def @arg11 253 67 0 Y 128 30 63 -def @arg12 253 67 0 Y 128 30 63 +def @arg11 253 83 0 Y 128 30 63 +def @arg12 253 83 0 Y 128 30 63 def @arg13 253 8192 0 Y 128 31 63 def @arg14 253 8192 0 Y 128 31 63 def @arg15 253 8192 19 Y 128 31 63 @@ -2095,8 +2095,8 @@ def @arg07 253 23 1 Y 128 31 63 def @arg08 253 23 1 Y 128 31 63 def @arg09 253 23 1 Y 128 31 63 def @arg10 253 23 1 Y 128 31 63 -def @arg11 253 67 6 Y 128 30 63 -def @arg12 253 67 6 Y 128 30 63 +def @arg11 253 83 6 Y 128 30 63 +def @arg12 253 83 6 Y 128 30 63 def @arg13 253 8192 10 Y 128 31 63 def @arg14 253 8192 19 Y 128 31 63 def @arg15 253 8192 19 Y 128 31 63 @@ -2139,8 +2139,8 @@ def @arg07 253 23 0 Y 128 31 63 def @arg08 253 23 0 Y 128 31 63 def @arg09 253 23 0 Y 128 31 63 def @arg10 253 23 0 Y 128 31 63 -def @arg11 253 67 0 Y 128 30 63 -def @arg12 253 67 0 Y 128 30 63 +def @arg11 253 83 0 Y 128 30 63 +def @arg12 253 83 0 Y 128 30 63 def @arg13 253 8192 0 Y 128 31 63 def @arg14 253 8192 0 Y 128 31 63 def @arg15 253 8192 19 Y 128 31 63 @@ -2185,8 +2185,8 @@ def @arg07 253 23 1 Y 128 31 63 def @arg08 253 23 1 Y 128 31 63 def @arg09 253 23 1 Y 128 31 63 def @arg10 253 23 1 Y 128 31 63 -def @arg11 253 67 6 Y 128 30 63 -def @arg12 253 67 6 Y 128 30 63 +def @arg11 253 83 6 Y 128 30 63 +def @arg12 253 83 6 Y 128 30 63 def @arg13 253 8192 10 Y 128 31 63 def @arg14 253 8192 19 Y 128 31 63 def @arg15 253 8192 19 Y 128 31 63 @@ -2223,8 +2223,8 @@ def @arg07 253 23 0 Y 128 31 63 def @arg08 253 23 0 Y 128 31 63 def @arg09 253 23 0 Y 128 31 63 def @arg10 253 23 0 Y 128 31 63 -def @arg11 253 67 0 Y 128 30 63 -def @arg12 253 67 0 Y 128 30 63 +def @arg11 253 83 0 Y 128 30 63 +def @arg12 253 83 0 Y 128 30 63 def @arg13 253 8192 0 Y 128 31 63 def @arg14 253 8192 0 Y 128 31 63 def @arg15 253 8192 19 Y 128 31 63 diff --git a/mysql-test/r/ps_4heap.result b/mysql-test/r/ps_4heap.result index aed2fcea1ce..6b31e95c6c8 100644 --- a/mysql-test/r/ps_4heap.result +++ b/mysql-test/r/ps_4heap.result @@ -1159,7 +1159,7 @@ def table 253 64 2 Y 0 31 8 def type 253 10 3 Y 0 31 8 def possible_keys 253 4096 0 Y 0 31 8 def key 253 64 0 Y 0 31 8 -def key_len 253 4096 0 Y 128 31 63 +def key_len 253 1365 0 Y 0 31 8 def ref 253 1024 0 Y 0 31 8 def rows 8 10 1 Y 32928 0 63 def Extra 253 255 0 N 1 31 8 @@ -1288,7 +1288,7 @@ set @arg00=NULL; set @arg01=2; execute stmt1 using @arg00, @arg01; Warnings: -Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'a' at row 1 +Warning 1048 Column 'a' cannot be null select a,b from t1 order by a; a b 0 two @@ -1911,8 +1911,8 @@ def @arg07 253 23 1 Y 128 31 63 def @arg08 253 23 1 Y 128 31 63 def @arg09 253 23 1 Y 128 31 63 def @arg10 253 23 1 Y 128 31 63 -def @arg11 253 67 6 Y 128 30 63 -def @arg12 253 67 6 Y 128 30 63 +def @arg11 253 83 6 Y 128 30 63 +def @arg12 253 83 6 Y 128 30 63 def @arg13 253 8192 10 Y 128 31 63 def @arg14 253 8192 19 Y 128 31 63 def @arg15 253 8192 19 Y 128 31 63 @@ -1958,8 +1958,8 @@ def @arg07 253 23 0 Y 128 31 63 def @arg08 253 23 0 Y 128 31 63 def @arg09 253 23 0 Y 128 31 63 def @arg10 253 23 0 Y 128 31 63 -def @arg11 253 67 0 Y 128 30 63 -def @arg12 253 67 0 Y 128 30 63 +def @arg11 253 83 0 Y 128 30 63 +def @arg12 253 83 0 Y 128 30 63 def @arg13 253 8192 0 Y 128 31 63 def @arg14 253 8192 0 Y 128 31 63 def @arg15 253 8192 19 Y 128 31 63 @@ -2008,8 +2008,8 @@ def @arg07 253 23 1 Y 128 31 63 def @arg08 253 23 1 Y 128 31 63 def @arg09 253 23 1 Y 128 31 63 def @arg10 253 23 1 Y 128 31 63 -def @arg11 253 67 6 Y 128 30 63 -def @arg12 253 67 6 Y 128 30 63 +def @arg11 253 83 6 Y 128 30 63 +def @arg12 253 83 6 Y 128 30 63 def @arg13 253 8192 10 Y 128 31 63 def @arg14 253 8192 19 Y 128 31 63 def @arg15 253 8192 19 Y 128 31 63 @@ -2048,8 +2048,8 @@ def @arg07 253 23 0 Y 128 31 63 def @arg08 253 23 0 Y 128 31 63 def @arg09 253 23 0 Y 128 31 63 def @arg10 253 23 0 Y 128 31 63 -def @arg11 253 67 0 Y 128 30 63 -def @arg12 253 67 0 Y 128 30 63 +def @arg11 253 83 0 Y 128 30 63 +def @arg12 253 83 0 Y 128 30 63 def @arg13 253 8192 0 Y 128 31 63 def @arg14 253 8192 0 Y 128 31 63 def @arg15 253 8192 19 Y 128 31 63 @@ -2096,8 +2096,8 @@ def @arg07 253 23 1 Y 128 31 63 def @arg08 253 23 1 Y 128 31 63 def @arg09 253 23 1 Y 128 31 63 def @arg10 253 23 1 Y 128 31 63 -def @arg11 253 67 6 Y 128 30 63 -def @arg12 253 67 6 Y 128 30 63 +def @arg11 253 83 6 Y 128 30 63 +def @arg12 253 83 6 Y 128 30 63 def @arg13 253 8192 10 Y 128 31 63 def @arg14 253 8192 19 Y 128 31 63 def @arg15 253 8192 19 Y 128 31 63 @@ -2140,8 +2140,8 @@ def @arg07 253 23 0 Y 128 31 63 def @arg08 253 23 0 Y 128 31 63 def @arg09 253 23 0 Y 128 31 63 def @arg10 253 23 0 Y 128 31 63 -def @arg11 253 67 0 Y 128 30 63 -def @arg12 253 67 0 Y 128 30 63 +def @arg11 253 83 0 Y 128 30 63 +def @arg12 253 83 0 Y 128 30 63 def @arg13 253 8192 0 Y 128 31 63 def @arg14 253 8192 0 Y 128 31 63 def @arg15 253 8192 19 Y 128 31 63 @@ -2186,8 +2186,8 @@ def @arg07 253 23 1 Y 128 31 63 def @arg08 253 23 1 Y 128 31 63 def @arg09 253 23 1 Y 128 31 63 def @arg10 253 23 1 Y 128 31 63 -def @arg11 253 67 6 Y 128 30 63 -def @arg12 253 67 6 Y 128 30 63 +def @arg11 253 83 6 Y 128 30 63 +def @arg12 253 83 6 Y 128 30 63 def @arg13 253 8192 10 Y 128 31 63 def @arg14 253 8192 19 Y 128 31 63 def @arg15 253 8192 19 Y 128 31 63 @@ -2224,8 +2224,8 @@ def @arg07 253 23 0 Y 128 31 63 def @arg08 253 23 0 Y 128 31 63 def @arg09 253 23 0 Y 128 31 63 def @arg10 253 23 0 Y 128 31 63 -def @arg11 253 67 0 Y 128 30 63 -def @arg12 253 67 0 Y 128 30 63 +def @arg11 253 83 0 Y 128 30 63 +def @arg12 253 83 0 Y 128 30 63 def @arg13 253 8192 0 Y 128 31 63 def @arg14 253 8192 0 Y 128 31 63 def @arg15 253 8192 19 Y 128 31 63 diff --git a/mysql-test/r/ps_5merge.result b/mysql-test/r/ps_5merge.result index ed85e4411aa..c7b20b774bd 100644 --- a/mysql-test/r/ps_5merge.result +++ b/mysql-test/r/ps_5merge.result @@ -1201,7 +1201,7 @@ def table 253 64 2 Y 0 31 8 def type 253 10 3 Y 0 31 8 def possible_keys 253 4096 0 Y 0 31 8 def key 253 64 0 Y 0 31 8 -def key_len 253 4096 0 Y 128 31 63 +def key_len 253 1365 0 Y 0 31 8 def ref 253 1024 0 Y 0 31 8 def rows 8 10 1 Y 32928 0 63 def Extra 253 255 0 N 1 31 8 @@ -1330,7 +1330,7 @@ set @arg00=NULL; set @arg01=2; execute stmt1 using @arg00, @arg01; Warnings: -Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'a' at row 1 +Warning 1048 Column 'a' cannot be null select a,b from t1 order by a; a b 0 two @@ -1847,8 +1847,8 @@ def @arg07 253 23 1 Y 128 31 63 def @arg08 253 23 1 Y 128 31 63 def @arg09 253 23 1 Y 128 31 63 def @arg10 253 23 1 Y 128 31 63 -def @arg11 253 67 6 Y 128 30 63 -def @arg12 253 67 6 Y 128 30 63 +def @arg11 253 83 6 Y 128 30 63 +def @arg12 253 83 6 Y 128 30 63 def @arg13 253 8192 10 Y 128 31 63 def @arg14 253 8192 19 Y 128 31 63 def @arg15 253 8192 19 Y 128 31 63 @@ -1894,8 +1894,8 @@ def @arg07 253 23 0 Y 128 31 63 def @arg08 253 23 0 Y 128 31 63 def @arg09 253 23 0 Y 128 31 63 def @arg10 253 23 0 Y 128 31 63 -def @arg11 253 67 0 Y 128 30 63 -def @arg12 253 67 0 Y 128 30 63 +def @arg11 253 83 0 Y 128 30 63 +def @arg12 253 83 0 Y 128 30 63 def @arg13 253 8192 0 Y 128 31 63 def @arg14 253 8192 0 Y 128 31 63 def @arg15 253 8192 19 Y 128 31 63 @@ -1944,8 +1944,8 @@ def @arg07 253 23 1 Y 128 31 63 def @arg08 253 23 1 Y 128 31 63 def @arg09 253 23 1 Y 128 31 63 def @arg10 253 23 1 Y 128 31 63 -def @arg11 253 67 6 Y 128 30 63 -def @arg12 253 67 6 Y 128 30 63 +def @arg11 253 83 6 Y 128 30 63 +def @arg12 253 83 6 Y 128 30 63 def @arg13 253 8192 10 Y 128 31 63 def @arg14 253 8192 19 Y 128 31 63 def @arg15 253 8192 19 Y 128 31 63 @@ -1984,8 +1984,8 @@ def @arg07 253 23 0 Y 128 31 63 def @arg08 253 23 0 Y 128 31 63 def @arg09 253 23 0 Y 128 31 63 def @arg10 253 23 0 Y 128 31 63 -def @arg11 253 67 0 Y 128 30 63 -def @arg12 253 67 0 Y 128 30 63 +def @arg11 253 83 0 Y 128 30 63 +def @arg12 253 83 0 Y 128 30 63 def @arg13 253 8192 0 Y 128 31 63 def @arg14 253 8192 0 Y 128 31 63 def @arg15 253 8192 19 Y 128 31 63 @@ -2032,8 +2032,8 @@ def @arg07 253 23 1 Y 128 31 63 def @arg08 253 23 1 Y 128 31 63 def @arg09 253 23 1 Y 128 31 63 def @arg10 253 23 1 Y 128 31 63 -def @arg11 253 67 6 Y 128 30 63 -def @arg12 253 67 6 Y 128 30 63 +def @arg11 253 83 6 Y 128 30 63 +def @arg12 253 83 6 Y 128 30 63 def @arg13 253 8192 10 Y 128 31 63 def @arg14 253 8192 19 Y 128 31 63 def @arg15 253 8192 19 Y 128 31 63 @@ -2076,8 +2076,8 @@ def @arg07 253 23 0 Y 128 31 63 def @arg08 253 23 0 Y 128 31 63 def @arg09 253 23 0 Y 128 31 63 def @arg10 253 23 0 Y 128 31 63 -def @arg11 253 67 0 Y 128 30 63 -def @arg12 253 67 0 Y 128 30 63 +def @arg11 253 83 0 Y 128 30 63 +def @arg12 253 83 0 Y 128 30 63 def @arg13 253 8192 0 Y 128 31 63 def @arg14 253 8192 0 Y 128 31 63 def @arg15 253 8192 19 Y 128 31 63 @@ -2122,8 +2122,8 @@ def @arg07 253 23 1 Y 128 31 63 def @arg08 253 23 1 Y 128 31 63 def @arg09 253 23 1 Y 128 31 63 def @arg10 253 23 1 Y 128 31 63 -def @arg11 253 67 6 Y 128 30 63 -def @arg12 253 67 6 Y 128 30 63 +def @arg11 253 83 6 Y 128 30 63 +def @arg12 253 83 6 Y 128 30 63 def @arg13 253 8192 10 Y 128 31 63 def @arg14 253 8192 19 Y 128 31 63 def @arg15 253 8192 19 Y 128 31 63 @@ -2160,8 +2160,8 @@ def @arg07 253 23 0 Y 128 31 63 def @arg08 253 23 0 Y 128 31 63 def @arg09 253 23 0 Y 128 31 63 def @arg10 253 23 0 Y 128 31 63 -def @arg11 253 67 0 Y 128 30 63 -def @arg12 253 67 0 Y 128 30 63 +def @arg11 253 83 0 Y 128 30 63 +def @arg12 253 83 0 Y 128 30 63 def @arg13 253 8192 0 Y 128 31 63 def @arg14 253 8192 0 Y 128 31 63 def @arg15 253 8192 19 Y 128 31 63 @@ -4222,7 +4222,7 @@ def table 253 64 2 Y 0 31 8 def type 253 10 3 Y 0 31 8 def possible_keys 253 4096 0 Y 0 31 8 def key 253 64 0 Y 0 31 8 -def key_len 253 4096 0 Y 128 31 63 +def key_len 253 1365 0 Y 0 31 8 def ref 253 1024 0 Y 0 31 8 def rows 8 10 1 Y 32928 0 63 def Extra 253 255 0 N 1 31 8 @@ -4351,7 +4351,7 @@ set @arg00=NULL; set @arg01=2; execute stmt1 using @arg00, @arg01; Warnings: -Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'a' at row 1 +Warning 1048 Column 'a' cannot be null select a,b from t1 order by a; a b 0 two @@ -4868,8 +4868,8 @@ def @arg07 253 23 1 Y 128 31 63 def @arg08 253 23 1 Y 128 31 63 def @arg09 253 23 1 Y 128 31 63 def @arg10 253 23 1 Y 128 31 63 -def @arg11 253 67 6 Y 128 30 63 -def @arg12 253 67 6 Y 128 30 63 +def @arg11 253 83 6 Y 128 30 63 +def @arg12 253 83 6 Y 128 30 63 def @arg13 253 8192 10 Y 128 31 63 def @arg14 253 8192 19 Y 128 31 63 def @arg15 253 8192 19 Y 128 31 63 @@ -4915,8 +4915,8 @@ def @arg07 253 23 0 Y 128 31 63 def @arg08 253 23 0 Y 128 31 63 def @arg09 253 23 0 Y 128 31 63 def @arg10 253 23 0 Y 128 31 63 -def @arg11 253 67 0 Y 128 30 63 -def @arg12 253 67 0 Y 128 30 63 +def @arg11 253 83 0 Y 128 30 63 +def @arg12 253 83 0 Y 128 30 63 def @arg13 253 8192 0 Y 128 31 63 def @arg14 253 8192 0 Y 128 31 63 def @arg15 253 8192 19 Y 128 31 63 @@ -4965,8 +4965,8 @@ def @arg07 253 23 1 Y 128 31 63 def @arg08 253 23 1 Y 128 31 63 def @arg09 253 23 1 Y 128 31 63 def @arg10 253 23 1 Y 128 31 63 -def @arg11 253 67 6 Y 128 30 63 -def @arg12 253 67 6 Y 128 30 63 +def @arg11 253 83 6 Y 128 30 63 +def @arg12 253 83 6 Y 128 30 63 def @arg13 253 8192 10 Y 128 31 63 def @arg14 253 8192 19 Y 128 31 63 def @arg15 253 8192 19 Y 128 31 63 @@ -5005,8 +5005,8 @@ def @arg07 253 23 0 Y 128 31 63 def @arg08 253 23 0 Y 128 31 63 def @arg09 253 23 0 Y 128 31 63 def @arg10 253 23 0 Y 128 31 63 -def @arg11 253 67 0 Y 128 30 63 -def @arg12 253 67 0 Y 128 30 63 +def @arg11 253 83 0 Y 128 30 63 +def @arg12 253 83 0 Y 128 30 63 def @arg13 253 8192 0 Y 128 31 63 def @arg14 253 8192 0 Y 128 31 63 def @arg15 253 8192 19 Y 128 31 63 @@ -5053,8 +5053,8 @@ def @arg07 253 23 1 Y 128 31 63 def @arg08 253 23 1 Y 128 31 63 def @arg09 253 23 1 Y 128 31 63 def @arg10 253 23 1 Y 128 31 63 -def @arg11 253 67 6 Y 128 30 63 -def @arg12 253 67 6 Y 128 30 63 +def @arg11 253 83 6 Y 128 30 63 +def @arg12 253 83 6 Y 128 30 63 def @arg13 253 8192 10 Y 128 31 63 def @arg14 253 8192 19 Y 128 31 63 def @arg15 253 8192 19 Y 128 31 63 @@ -5097,8 +5097,8 @@ def @arg07 253 23 0 Y 128 31 63 def @arg08 253 23 0 Y 128 31 63 def @arg09 253 23 0 Y 128 31 63 def @arg10 253 23 0 Y 128 31 63 -def @arg11 253 67 0 Y 128 30 63 -def @arg12 253 67 0 Y 128 30 63 +def @arg11 253 83 0 Y 128 30 63 +def @arg12 253 83 0 Y 128 30 63 def @arg13 253 8192 0 Y 128 31 63 def @arg14 253 8192 0 Y 128 31 63 def @arg15 253 8192 19 Y 128 31 63 @@ -5143,8 +5143,8 @@ def @arg07 253 23 1 Y 128 31 63 def @arg08 253 23 1 Y 128 31 63 def @arg09 253 23 1 Y 128 31 63 def @arg10 253 23 1 Y 128 31 63 -def @arg11 253 67 6 Y 128 30 63 -def @arg12 253 67 6 Y 128 30 63 +def @arg11 253 83 6 Y 128 30 63 +def @arg12 253 83 6 Y 128 30 63 def @arg13 253 8192 10 Y 128 31 63 def @arg14 253 8192 19 Y 128 31 63 def @arg15 253 8192 19 Y 128 31 63 @@ -5181,8 +5181,8 @@ def @arg07 253 23 0 Y 128 31 63 def @arg08 253 23 0 Y 128 31 63 def @arg09 253 23 0 Y 128 31 63 def @arg10 253 23 0 Y 128 31 63 -def @arg11 253 67 0 Y 128 30 63 -def @arg12 253 67 0 Y 128 30 63 +def @arg11 253 83 0 Y 128 30 63 +def @arg12 253 83 0 Y 128 30 63 def @arg13 253 8192 0 Y 128 31 63 def @arg14 253 8192 0 Y 128 31 63 def @arg15 253 8192 19 Y 128 31 63 diff --git a/mysql-test/r/ps_6bdb.result b/mysql-test/r/ps_6bdb.result index 3dc5859d304..5e97d5cf179 100644 --- a/mysql-test/r/ps_6bdb.result +++ b/mysql-test/r/ps_6bdb.result @@ -1158,7 +1158,7 @@ def table 253 64 2 Y 0 31 8 def type 253 10 3 Y 0 31 8 def possible_keys 253 4096 0 Y 0 31 8 def key 253 64 0 Y 0 31 8 -def key_len 253 4096 0 Y 128 31 63 +def key_len 253 1365 0 Y 0 31 8 def ref 253 1024 0 Y 0 31 8 def rows 8 10 1 Y 32928 0 63 def Extra 253 255 0 N 1 31 8 @@ -1287,7 +1287,7 @@ set @arg00=NULL; set @arg01=2; execute stmt1 using @arg00, @arg01; Warnings: -Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'a' at row 1 +Warning 1048 Column 'a' cannot be null select a,b from t1 order by a; a b 0 two @@ -1910,8 +1910,8 @@ def @arg07 253 23 1 Y 128 31 63 def @arg08 253 23 1 Y 128 31 63 def @arg09 253 23 1 Y 128 31 63 def @arg10 253 23 1 Y 128 31 63 -def @arg11 253 67 6 Y 128 30 63 -def @arg12 253 67 6 Y 128 30 63 +def @arg11 253 83 6 Y 128 30 63 +def @arg12 253 83 6 Y 128 30 63 def @arg13 253 8192 10 Y 128 31 63 def @arg14 253 8192 19 Y 128 31 63 def @arg15 253 8192 19 Y 128 31 63 @@ -1957,8 +1957,8 @@ def @arg07 253 23 0 Y 128 31 63 def @arg08 253 23 0 Y 128 31 63 def @arg09 253 23 0 Y 128 31 63 def @arg10 253 23 0 Y 128 31 63 -def @arg11 253 67 0 Y 128 30 63 -def @arg12 253 67 0 Y 128 30 63 +def @arg11 253 83 0 Y 128 30 63 +def @arg12 253 83 0 Y 128 30 63 def @arg13 253 8192 0 Y 128 31 63 def @arg14 253 8192 0 Y 128 31 63 def @arg15 253 8192 19 Y 128 31 63 @@ -2007,8 +2007,8 @@ def @arg07 253 23 1 Y 128 31 63 def @arg08 253 23 1 Y 128 31 63 def @arg09 253 23 1 Y 128 31 63 def @arg10 253 23 1 Y 128 31 63 -def @arg11 253 67 6 Y 128 30 63 -def @arg12 253 67 6 Y 128 30 63 +def @arg11 253 83 6 Y 128 30 63 +def @arg12 253 83 6 Y 128 30 63 def @arg13 253 8192 10 Y 128 31 63 def @arg14 253 8192 19 Y 128 31 63 def @arg15 253 8192 19 Y 128 31 63 @@ -2047,8 +2047,8 @@ def @arg07 253 23 0 Y 128 31 63 def @arg08 253 23 0 Y 128 31 63 def @arg09 253 23 0 Y 128 31 63 def @arg10 253 23 0 Y 128 31 63 -def @arg11 253 67 0 Y 128 30 63 -def @arg12 253 67 0 Y 128 30 63 +def @arg11 253 83 0 Y 128 30 63 +def @arg12 253 83 0 Y 128 30 63 def @arg13 253 8192 0 Y 128 31 63 def @arg14 253 8192 0 Y 128 31 63 def @arg15 253 8192 19 Y 128 31 63 @@ -2095,8 +2095,8 @@ def @arg07 253 23 1 Y 128 31 63 def @arg08 253 23 1 Y 128 31 63 def @arg09 253 23 1 Y 128 31 63 def @arg10 253 23 1 Y 128 31 63 -def @arg11 253 67 6 Y 128 30 63 -def @arg12 253 67 6 Y 128 30 63 +def @arg11 253 83 6 Y 128 30 63 +def @arg12 253 83 6 Y 128 30 63 def @arg13 253 8192 10 Y 128 31 63 def @arg14 253 8192 19 Y 128 31 63 def @arg15 253 8192 19 Y 128 31 63 @@ -2139,8 +2139,8 @@ def @arg07 253 23 0 Y 128 31 63 def @arg08 253 23 0 Y 128 31 63 def @arg09 253 23 0 Y 128 31 63 def @arg10 253 23 0 Y 128 31 63 -def @arg11 253 67 0 Y 128 30 63 -def @arg12 253 67 0 Y 128 30 63 +def @arg11 253 83 0 Y 128 30 63 +def @arg12 253 83 0 Y 128 30 63 def @arg13 253 8192 0 Y 128 31 63 def @arg14 253 8192 0 Y 128 31 63 def @arg15 253 8192 19 Y 128 31 63 @@ -2185,8 +2185,8 @@ def @arg07 253 23 1 Y 128 31 63 def @arg08 253 23 1 Y 128 31 63 def @arg09 253 23 1 Y 128 31 63 def @arg10 253 23 1 Y 128 31 63 -def @arg11 253 67 6 Y 128 30 63 -def @arg12 253 67 6 Y 128 30 63 +def @arg11 253 83 6 Y 128 30 63 +def @arg12 253 83 6 Y 128 30 63 def @arg13 253 8192 10 Y 128 31 63 def @arg14 253 8192 19 Y 128 31 63 def @arg15 253 8192 19 Y 128 31 63 @@ -2223,8 +2223,8 @@ def @arg07 253 23 0 Y 128 31 63 def @arg08 253 23 0 Y 128 31 63 def @arg09 253 23 0 Y 128 31 63 def @arg10 253 23 0 Y 128 31 63 -def @arg11 253 67 0 Y 128 30 63 -def @arg12 253 67 0 Y 128 30 63 +def @arg11 253 83 0 Y 128 30 63 +def @arg12 253 83 0 Y 128 30 63 def @arg13 253 8192 0 Y 128 31 63 def @arg14 253 8192 0 Y 128 31 63 def @arg15 253 8192 19 Y 128 31 63 diff --git a/mysql-test/r/ps_7ndb.result b/mysql-test/r/ps_7ndb.result index 0df2733aa7a..7ca18edc9cc 100644 --- a/mysql-test/r/ps_7ndb.result +++ b/mysql-test/r/ps_7ndb.result @@ -1158,7 +1158,7 @@ def table 253 64 2 Y 0 31 8 def type 253 10 3 Y 0 31 8 def possible_keys 253 4096 0 Y 0 31 8 def key 253 64 0 Y 0 31 8 -def key_len 253 4096 0 Y 128 31 63 +def key_len 253 1365 0 Y 0 31 8 def ref 253 1024 0 Y 0 31 8 def rows 8 10 1 Y 32928 0 63 def Extra 253 255 0 N 1 31 8 @@ -1287,7 +1287,7 @@ set @arg00=NULL; set @arg01=2; execute stmt1 using @arg00, @arg01; Warnings: -Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'a' at row 1 +Warning 1048 Column 'a' cannot be null select a,b from t1 order by a; a b 0 two @@ -1910,8 +1910,8 @@ def @arg07 253 23 1 Y 128 31 63 def @arg08 253 23 1 Y 128 31 63 def @arg09 253 23 1 Y 128 31 63 def @arg10 253 23 1 Y 128 31 63 -def @arg11 253 67 6 Y 128 30 63 -def @arg12 253 67 6 Y 128 30 63 +def @arg11 253 83 6 Y 128 30 63 +def @arg12 253 83 6 Y 128 30 63 def @arg13 253 8192 10 Y 128 31 63 def @arg14 253 8192 19 Y 128 31 63 def @arg15 253 8192 19 Y 128 31 63 @@ -1957,8 +1957,8 @@ def @arg07 253 23 0 Y 128 31 63 def @arg08 253 23 0 Y 128 31 63 def @arg09 253 23 0 Y 128 31 63 def @arg10 253 23 0 Y 128 31 63 -def @arg11 253 67 0 Y 128 30 63 -def @arg12 253 67 0 Y 128 30 63 +def @arg11 253 83 0 Y 128 30 63 +def @arg12 253 83 0 Y 128 30 63 def @arg13 253 8192 0 Y 128 31 63 def @arg14 253 8192 0 Y 128 31 63 def @arg15 253 8192 19 Y 128 31 63 @@ -2007,8 +2007,8 @@ def @arg07 253 23 1 Y 128 31 63 def @arg08 253 23 1 Y 128 31 63 def @arg09 253 23 1 Y 128 31 63 def @arg10 253 23 1 Y 128 31 63 -def @arg11 253 67 6 Y 128 30 63 -def @arg12 253 67 6 Y 128 30 63 +def @arg11 253 83 6 Y 128 30 63 +def @arg12 253 83 6 Y 128 30 63 def @arg13 253 8192 10 Y 128 31 63 def @arg14 253 8192 19 Y 128 31 63 def @arg15 253 8192 19 Y 128 31 63 @@ -2047,8 +2047,8 @@ def @arg07 253 23 0 Y 128 31 63 def @arg08 253 23 0 Y 128 31 63 def @arg09 253 23 0 Y 128 31 63 def @arg10 253 23 0 Y 128 31 63 -def @arg11 253 67 0 Y 128 30 63 -def @arg12 253 67 0 Y 128 30 63 +def @arg11 253 83 0 Y 128 30 63 +def @arg12 253 83 0 Y 128 30 63 def @arg13 253 8192 0 Y 128 31 63 def @arg14 253 8192 0 Y 128 31 63 def @arg15 253 8192 19 Y 128 31 63 @@ -2095,8 +2095,8 @@ def @arg07 253 23 1 Y 128 31 63 def @arg08 253 23 1 Y 128 31 63 def @arg09 253 23 1 Y 128 31 63 def @arg10 253 23 1 Y 128 31 63 -def @arg11 253 67 6 Y 128 30 63 -def @arg12 253 67 6 Y 128 30 63 +def @arg11 253 83 6 Y 128 30 63 +def @arg12 253 83 6 Y 128 30 63 def @arg13 253 8192 10 Y 128 31 63 def @arg14 253 8192 19 Y 128 31 63 def @arg15 253 8192 19 Y 128 31 63 @@ -2139,8 +2139,8 @@ def @arg07 253 23 0 Y 128 31 63 def @arg08 253 23 0 Y 128 31 63 def @arg09 253 23 0 Y 128 31 63 def @arg10 253 23 0 Y 128 31 63 -def @arg11 253 67 0 Y 128 30 63 -def @arg12 253 67 0 Y 128 30 63 +def @arg11 253 83 0 Y 128 30 63 +def @arg12 253 83 0 Y 128 30 63 def @arg13 253 8192 0 Y 128 31 63 def @arg14 253 8192 0 Y 128 31 63 def @arg15 253 8192 19 Y 128 31 63 @@ -2185,8 +2185,8 @@ def @arg07 253 23 1 Y 128 31 63 def @arg08 253 23 1 Y 128 31 63 def @arg09 253 23 1 Y 128 31 63 def @arg10 253 23 1 Y 128 31 63 -def @arg11 253 67 6 Y 128 30 63 -def @arg12 253 67 6 Y 128 30 63 +def @arg11 253 83 6 Y 128 30 63 +def @arg12 253 83 6 Y 128 30 63 def @arg13 253 8192 10 Y 128 31 63 def @arg14 253 8192 19 Y 128 31 63 def @arg15 253 8192 19 Y 128 31 63 @@ -2223,8 +2223,8 @@ def @arg07 253 23 0 Y 128 31 63 def @arg08 253 23 0 Y 128 31 63 def @arg09 253 23 0 Y 128 31 63 def @arg10 253 23 0 Y 128 31 63 -def @arg11 253 67 0 Y 128 30 63 -def @arg12 253 67 0 Y 128 30 63 +def @arg11 253 83 0 Y 128 30 63 +def @arg12 253 83 0 Y 128 30 63 def @arg13 253 8192 0 Y 128 31 63 def @arg14 253 8192 0 Y 128 31 63 def @arg15 253 8192 19 Y 128 31 63 diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result index 79471ee5c02..b0f3fb77c0e 100644 --- a/mysql-test/r/query_cache.result +++ b/mysql-test/r/query_cache.result @@ -179,12 +179,22 @@ a 1 2 3 +select * from t1 where a IN (select sql_cache a from t1); +a +1 +2 +3 +select * from t1 where a IN (select a from t1 union select sql_cache a from t1); +a +1 +2 +3 show status like "Qcache_hits"; Variable_name Value Qcache_hits 4 show status like "Qcache_queries_in_cache"; Variable_name Value -Qcache_queries_in_cache 2 +Qcache_queries_in_cache 1 set query_cache_type=on; reset query cache; show status like "Qcache_queries_in_cache"; @@ -195,6 +205,41 @@ a 1 2 3 +select * from t1 union select sql_no_cache * from t1; +a +1 +2 +3 +select * from t1 where a IN (select sql_no_cache a from t1); +a +1 +2 +3 +select * from t1 where a IN (select a from t1 union select sql_no_cache a from t1); +a +1 +2 +3 +select sql_cache sql_no_cache * from t1; +a +1 +2 +3 +select sql_cache * from t1 union select sql_no_cache * from t1; +a +1 +2 +3 +select sql_cache * from t1 where a IN (select sql_no_cache a from t1); +a +1 +2 +3 +select sql_cache * from t1 where a IN (select a from t1 union select sql_no_cache a from t1); +a +1 +2 +3 show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 0 @@ -1405,7 +1450,20 @@ Only MyISAM tables support collections 1 Function MATCH ... AGAINST() is used to do a search 1 Full-text search in MySQL implements vector space model 1 drop function change_global; +drop table t1; set GLOBAL query_cache_type=default; set GLOBAL query_cache_limit=default; set GLOBAL query_cache_min_res_unit=default; set GLOBAL query_cache_size= default; +set GLOBAL query_cache_size=1000000; +create table t1 (a char); +insert into t1 values ('c'); +a +drop table t1; +set GLOBAL query_cache_size= default; +set GLOBAL query_cache_size=1000000; +create table t1 (a char); +insert into t1 values ('c'); +a +drop table t1; +set GLOBAL query_cache_size= default; diff --git a/mysql-test/r/repair.result b/mysql-test/r/repair.result index 417a5e0c990..bd746711f1f 100644 --- a/mysql-test/r/repair.result +++ b/mysql-test/r/repair.result @@ -26,16 +26,14 @@ t1 1 st_key 1 st A NULL NULL NULL YES BTREE disabled drop table t1; repair table t1 use_frm; Table Op Msg_type Msg_text -test.t1 repair error Table 'test.t1' doesn't exist -Warnings: -Error 1146 Table 'test.t1' doesn't exist +test.t1 repair Error Table 'test.t1' doesn't exist +test.t1 repair error Corrupt create table t1 engine=myisam SELECT 1,"table 1"; flush tables; repair table t1; Table Op Msg_type Msg_text -test.t1 repair error Incorrect file format 't1' -Warnings: -Error 130 Incorrect file format 't1' +test.t1 repair Error Incorrect file format 't1' +test.t1 repair error Corrupt repair table t1 use_frm; Table Op Msg_type Msg_text test.t1 repair warning Number of rows changed from 0 to 1 diff --git a/mysql-test/r/rpl_change_master.result b/mysql-test/r/rpl_change_master.result index 7f2ba568fb3..98c42069470 100644 --- a/mysql-test/r/rpl_change_master.result +++ b/mysql-test/r/rpl_change_master.result @@ -12,12 +12,74 @@ insert into t1 values(1); insert into t1 values(2); stop slave; show slave status; -Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master -# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 357 # # master-bin.000001 No No 0 0 183 # None 0 No # +Slave_IO_State # +Master_Host 127.0.0.1 +Master_User root +Master_Port MASTER_MYPORT +Connect_Retry 1 +Master_Log_File master-bin.000001 +Read_Master_Log_Pos 357 +Relay_Log_File # +Relay_Log_Pos # +Relay_Master_Log_File master-bin.000001 +Slave_IO_Running No +Slave_SQL_Running No +Replicate_Do_DB +Replicate_Ignore_DB +Replicate_Do_Table +Replicate_Ignore_Table +Replicate_Wild_Do_Table +Replicate_Wild_Ignore_Table +Last_Errno 0 +Last_Error +Skip_Counter 0 +Exec_Master_Log_Pos 183 +Relay_Log_Space # +Until_Condition None +Until_Log_File +Until_Log_Pos 0 +Master_SSL_Allowed No +Master_SSL_CA_File +Master_SSL_CA_Path +Master_SSL_Cert +Master_SSL_Cipher +Master_SSL_Key +Seconds_Behind_Master # change master to master_user='root'; show slave status; -Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master -# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 183 # # master-bin.000001 No No 0 0 183 # None 0 No # +Slave_IO_State # +Master_Host 127.0.0.1 +Master_User root +Master_Port MASTER_MYPORT +Connect_Retry 1 +Master_Log_File master-bin.000001 +Read_Master_Log_Pos 183 +Relay_Log_File # +Relay_Log_Pos # +Relay_Master_Log_File master-bin.000001 +Slave_IO_Running No +Slave_SQL_Running No +Replicate_Do_DB +Replicate_Ignore_DB +Replicate_Do_Table +Replicate_Ignore_Table +Replicate_Wild_Do_Table +Replicate_Wild_Ignore_Table +Last_Errno 0 +Last_Error +Skip_Counter 0 +Exec_Master_Log_Pos 183 +Relay_Log_Space # +Until_Condition None +Until_Log_File +Until_Log_Pos 0 +Master_SSL_Allowed No +Master_SSL_CA_File +Master_SSL_CA_Path +Master_SSL_Cert +Master_SSL_Cipher +Master_SSL_Key +Seconds_Behind_Master # start slave; select * from t1; n diff --git a/mysql-test/r/rpl_failed_optimize.result b/mysql-test/r/rpl_failed_optimize.result index c2c07dc6343..33a8cdc4a2f 100644 --- a/mysql-test/r/rpl_failed_optimize.result +++ b/mysql-test/r/rpl_failed_optimize.result @@ -15,7 +15,6 @@ Warnings: Error 1205 Lock wait timeout exceeded; try restarting transaction OPTIMIZE TABLE non_existing; Table Op Msg_type Msg_text -test.non_existing optimize error Table 'test.non_existing' doesn't exist -Warnings: -Error 1146 Table 'test.non_existing' doesn't exist +test.non_existing optimize Error Table 'test.non_existing' doesn't exist +test.non_existing optimize error Corrupt drop table t1; diff --git a/mysql-test/r/rpl_grant.result b/mysql-test/r/rpl_grant.result new file mode 100644 index 00000000000..4d7ad298ce4 --- /dev/null +++ b/mysql-test/r/rpl_grant.result @@ -0,0 +1,77 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +**** On Master **** +CREATE USER dummy@localhost; +CREATE USER dummy1@localhost, dummy2@localhost; +SELECT user, host FROM mysql.user WHERE user != 'root'; +user host +dummy localhost +dummy1 localhost +dummy2 localhost +SELECT COUNT(*) FROM mysql.user; +COUNT(*) +6 +**** On Slave **** +SELECT user,host FROM mysql.user WHERE user != 'root'; +user host +dummy localhost +dummy1 localhost +dummy2 localhost +SELECT COUNT(*) FROM mysql.user; +COUNT(*) +6 +**** On Master **** +DROP USER nonexisting@localhost; +ERROR HY000: Operation DROP USER failed for 'nonexisting'@'localhost' +DROP USER nonexisting@localhost, dummy@localhost; +ERROR HY000: Operation DROP USER failed for 'nonexisting'@'localhost' +DROP USER dummy1@localhost, dummy2@localhost; +SELECT user, host FROM mysql.user WHERE user != 'root'; +user host +SELECT COUNT(*) FROM mysql.user; +COUNT(*) +3 +**** On Slave **** +SELECT user,host FROM mysql.user WHERE user != 'root'; +user host +SELECT COUNT(*) FROM mysql.user; +COUNT(*) +3 +SHOW SLAVE STATUS; +Slave_IO_State # +Master_Host 127.0.0.1 +Master_User root +Master_Port MASTER_PORT +Connect_Retry 1 +Master_Log_File master-bin.000001 +Read_Master_Log_Pos 609 +Relay_Log_File # +Relay_Log_Pos # +Relay_Master_Log_File master-bin.000001 +Slave_IO_Running Yes +Slave_SQL_Running Yes +Replicate_Do_DB +Replicate_Ignore_DB +Replicate_Do_Table +Replicate_Ignore_Table +Replicate_Wild_Do_Table +Replicate_Wild_Ignore_Table +Last_Errno 0 +Last_Error +Skip_Counter 0 +Exec_Master_Log_Pos 609 +Relay_Log_Space # +Until_Condition None +Until_Log_File +Until_Log_Pos 0 +Master_SSL_Allowed No +Master_SSL_CA_File +Master_SSL_CA_Path +Master_SSL_Cert +Master_SSL_Cipher +Master_SSL_Key +Seconds_Behind_Master # diff --git a/mysql-test/r/rpl_loaddata.result b/mysql-test/r/rpl_loaddata.result index d69786c00a1..be137079c7a 100644 --- a/mysql-test/r/rpl_loaddata.result +++ b/mysql-test/r/rpl_loaddata.result @@ -80,3 +80,7 @@ ERROR 23000: Duplicate entry '2003-03-22' for key 1 drop table t2; drop table t2; drop table t1; +CREATE TABLE t1 (word CHAR(20) NOT NULL PRIMARY KEY) ENGINE=INNODB; +LOAD DATA INFILE "../std_data_ln/words.dat" INTO TABLE t1; +ERROR 23000: Duplicate entry 'Aarhus' for key 1 +DROP TABLE t1; diff --git a/mysql-test/r/rpl_log_pos.result b/mysql-test/r/rpl_log_pos.result index cf13756966e..b55326415bf 100644 --- a/mysql-test/r/rpl_log_pos.result +++ b/mysql-test/r/rpl_log_pos.result @@ -7,27 +7,78 @@ start slave; show master status; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 98 -show slave status; -Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master -# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 98 # # master-bin.000001 Yes Yes 0 0 98 # None 0 No # -stop slave; -change master to master_log_pos=73; -start slave; stop slave; change master to master_log_pos=73; show slave status; -Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master -# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 73 # # master-bin.000001 No No 0 0 73 # None 0 No # +Slave_IO_State # +Master_Host 127.0.0.1 +Master_User root +Master_Port MASTER_PORT +Connect_Retry 1 +Master_Log_File master-bin.000001 +Read_Master_Log_Pos 73 +Relay_Log_File # +Relay_Log_Pos # +Relay_Master_Log_File master-bin.000001 +Slave_IO_Running No +Slave_SQL_Running No +Replicate_Do_DB +Replicate_Ignore_DB +Replicate_Do_Table +Replicate_Ignore_Table +Replicate_Wild_Do_Table +Replicate_Wild_Ignore_Table +Last_Errno 0 +Last_Error +Skip_Counter 0 +Exec_Master_Log_Pos 73 +Relay_Log_Space # +Until_Condition None +Until_Log_File +Until_Log_Pos 0 +Master_SSL_Allowed No +Master_SSL_CA_File +Master_SSL_CA_Path +Master_SSL_Cert +Master_SSL_Cipher +Master_SSL_Key +Seconds_Behind_Master # start slave; -show slave status; -Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master -# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 73 # # master-bin.000001 No Yes 0 0 73 # None 0 No # stop slave; -change master to master_log_pos=173; -start slave; show slave status; -Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master -# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 173 # # master-bin.000001 No Yes 0 0 173 # None 0 No # +Slave_IO_State # +Master_Host 127.0.0.1 +Master_User root +Master_Port MASTER_PORT +Connect_Retry 1 +Master_Log_File master-bin.000001 +Read_Master_Log_Pos 73 +Relay_Log_File # +Relay_Log_Pos # +Relay_Master_Log_File master-bin.000001 +Slave_IO_Running No +Slave_SQL_Running No +Replicate_Do_DB +Replicate_Ignore_DB +Replicate_Do_Table +Replicate_Ignore_Table +Replicate_Wild_Do_Table +Replicate_Wild_Ignore_Table +Last_Errno 0 +Last_Error +Skip_Counter 0 +Exec_Master_Log_Pos 73 +Relay_Log_Space # +Until_Condition None +Until_Log_File +Until_Log_Pos 0 +Master_SSL_Allowed No +Master_SSL_CA_File +Master_SSL_CA_Path +Master_SSL_Cert +Master_SSL_Cipher +Master_SSL_Key +Seconds_Behind_Master # show master status; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 98 @@ -35,7 +86,6 @@ create table if not exists t1 (n int); drop table if exists t1; create table t1 (n int); insert into t1 values (1),(2),(3); -stop slave; change master to master_log_pos=98; start slave; select * from t1; @@ -44,3 +94,4 @@ n 2 3 drop table t1; +End of 5.0 tests diff --git a/mysql-test/r/rpl_misc_functions.result b/mysql-test/r/rpl_misc_functions.result index 526414cec9c..a8e5520ca8f 100644 --- a/mysql-test/r/rpl_misc_functions.result +++ b/mysql-test/r/rpl_misc_functions.result @@ -20,11 +20,12 @@ select * from t1, t2 where (t1.id=t2.id) and not(t1.i=t2.i and t1.r1=t2.r1 and t id i r1 r2 p id i r1 r2 p drop table t1; DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (col_a double default NULL); +CREATE TABLE t1 (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +col_a DOUBLE DEFAULT NULL); CREATE PROCEDURE test_replication_sp1() BEGIN -INSERT INTO t1 VALUES (rand()), (rand()); -INSERT INTO t1 VALUES (rand()); +INSERT INTO t1 (col_a) VALUES (rand()), (rand()); +INSERT INTO t1 (col_a) VALUES (rand()); END| CREATE PROCEDURE test_replication_sp2() BEGIN @@ -37,10 +38,18 @@ RETURN (rand() + rand()); END| CALL test_replication_sp1(); CALL test_replication_sp2(); -INSERT INTO t1 VALUES (test_replication_sf()); -INSERT INTO t1 VALUES (test_replication_sf()); -INSERT INTO t1 VALUES (test_replication_sf()); -DROP PROCEDURE IF EXISTS test_replication_sp1; -DROP PROCEDURE IF EXISTS test_replication_sp2; -DROP FUNCTION IF EXISTS test_replication_sf; -DROP TABLE IF EXISTS t1; +INSERT INTO t1 (col_a) VALUES (test_replication_sf()); +INSERT INTO t1 (col_a) VALUES (test_replication_sf()); +INSERT INTO t1 (col_a) VALUES (test_replication_sf()); +select * from t1 into outfile "../tmp/t1_slave.txt"; +create temporary table t1_slave select * from t1 where 1=0; +load data infile '../tmp/t1_slave.txt' into table t1_slave; +select count(*) into @aux from t1 join t1_slave using (id) +where ABS(t1.col_a - t1_slave.col_a) < 0.0000001 ; +SELECT @aux; +@aux +12 +DROP TABLE t1, t1_slave; +DROP PROCEDURE test_replication_sp1; +DROP PROCEDURE test_replication_sp2; +DROP FUNCTION test_replication_sf; diff --git a/mysql-test/r/rpl_rotate_logs.result b/mysql-test/r/rpl_rotate_logs.result index bf2ef98c87f..8a5ae6c8983 100644 --- a/mysql-test/r/rpl_rotate_logs.result +++ b/mysql-test/r/rpl_rotate_logs.result @@ -50,7 +50,10 @@ show binary logs; Log_name File_size master-bin.000002 363 master-bin.000003 407 -purge master logs before now(); +select @time_for_purge:=DATE_ADD(UPDATE_TIME, INTERVAL 1 SECOND) +from information_schema.tables +where TABLE_SCHEMA="test" and TABLE_NAME="t2"; +purge master logs before (@time_for_purge); show binary logs; Log_name File_size master-bin.000003 407 @@ -92,3 +95,11 @@ count(*) 100 unlock tables; drop table if exists t1,t2,t3,t4; +End of 4.1 tests +show binlog events in 'non existing_binlog_file'; +ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log +purge master logs before now(); +show binlog events in ''; +ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log +purge master logs before now(); +End of 5.0 tests diff --git a/mysql-test/r/rpl_skip_error.result b/mysql-test/r/rpl_skip_error.result index adc61f8c2c8..22ba357ef49 100644 --- a/mysql-test/r/rpl_skip_error.result +++ b/mysql-test/r/rpl_skip_error.result @@ -14,3 +14,22 @@ n 2 3 drop table t1; +create table t1(a int primary key); +insert into t1 values (1),(2); +delete from t1 where @@server_id=1; +set sql_mode=strict_trans_tables; +select @@server_id; +@@server_id +1 +insert into t1 values (1),(2),(3); +select @@server_id; +@@server_id +2 +select * from t1; +a +1 +2 +show slave status; +Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master +# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 843 # # master-bin.000001 Yes Yes 0 0 843 # None 0 No # +drop table t1; diff --git a/mysql-test/r/rpl_ssl.result b/mysql-test/r/rpl_ssl.result index 6bc1e996965..1d3f4762693 100644 --- a/mysql-test/r/rpl_ssl.result +++ b/mysql-test/r/rpl_ssl.result @@ -92,3 +92,4 @@ Master_SSL_Cert MYSQL_TEST_DIR/std_data/client-cert.pem Master_SSL_Cipher Master_SSL_Key MYSQL_TEST_DIR/std_data/client-key.pem Seconds_Behind_Master # +End of 5.0 tests diff --git a/mysql-test/r/rpl_user_variables.result b/mysql-test/r/rpl_user_variables.result index 05f2b68042e..26ac2b26aaa 100644 --- a/mysql-test/r/rpl_user_variables.result +++ b/mysql-test/r/rpl_user_variables.result @@ -253,10 +253,44 @@ SELECT * from t2; k 100 42 +drop table t1, t2; +reset master; +create table t1 (a int); +prepare s from "insert into t1 values (@a),(?)"; +set @a=98; +execute s using @a; +prepare s from "insert into t1 values (?)"; +set @a=99; +execute s using @a; +prepare s from "insert into t1 select 100 limit ?"; +set @a=100; +execute s using @a; +show binlog events from 98; +Log_name Pos Event_type Server_id End_log_pos Info +slave-bin.000001 98 Query 1 184 use `test`; create table t1 (a int) +slave-bin.000001 184 User var 2 226 @`a`=98 +slave-bin.000001 226 Query 1 320 use `test`; insert into t1 values (@a),(98) +slave-bin.000001 320 Query 1 409 use `test`; insert into t1 values (99) +slave-bin.000001 409 Query 1 507 use `test`; insert into t1 select 100 limit 100 +select * from t1; +a +98 +98 +99 +100 +drop table t1; +create table t1(a int, b int); +prepare s1 from 'insert into t1 values (@x:=@x+1, ?)'; +set @x=1; +execute s1 using @x; +select * from t1; +a b +2 1 +select * from t1; +a b +2 1 +drop table t1; End of 5.0 tests. -DROP TABLE t1; -DROP TABLE t2; -DROP TABLE IF EXISTS t1; DROP FUNCTION IF EXISTS f1; DROP FUNCTION IF EXISTS f2; CREATE TABLE t1 (i INT); diff --git a/mysql-test/r/rpl_view.result b/mysql-test/r/rpl_view.result index be03f3f080a..be7ed6e8c2a 100644 --- a/mysql-test/r/rpl_view.result +++ b/mysql-test/r/rpl_view.result @@ -106,4 +106,10 @@ a b 1 6 drop table t1; drop view v1; +CREATE TABLE t1(a INT); +CREATE VIEW v1 AS SELECT * FROM t1; +CREATE VIEW v1 AS SELECT * FROM t1; +ERROR 42S01: Table 'v1' already exists +DROP VIEW v1; +DROP TABLE t1; End of 5.0 tests diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result index 0dfb7c95f9a..e4cdd4f183b 100644 --- a/mysql-test/r/show_check.result +++ b/mysql-test/r/show_check.result @@ -7,60 +7,157 @@ delete from mysql.db where user='mysqltest_1' || user='mysqltest_2' || user='mys flush privileges; create table t1 (a int not null primary key, b int not null,c int not null, key(b,c)); insert into t1 values (1,2,2),(2,2,3),(3,2,4),(4,2,4); +-- Here we enable metadata just to check that the collation of the +-- resultset is non-binary for string type. This should be changed +-- after Bug#29394 is implemented. check table t1 fast; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def Table 253 42 7 Y 0 31 8 +def Op 253 3 5 Y 0 31 8 +def Msg_type 253 3 6 Y 0 31 8 +def Msg_text 253 85 27 Y 0 31 8 Table Op Msg_type Msg_text test.t1 check status Table is already up to date check table t1 fast; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def Table 253 42 7 Y 0 31 8 +def Op 253 3 5 Y 0 31 8 +def Msg_type 253 3 6 Y 0 31 8 +def Msg_text 253 85 27 Y 0 31 8 Table Op Msg_type Msg_text test.t1 check status Table is already up to date check table t1 changed; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def Table 253 42 7 Y 0 31 8 +def Op 253 3 5 Y 0 31 8 +def Msg_type 253 3 6 Y 0 31 8 +def Msg_text 253 85 2 Y 0 31 8 Table Op Msg_type Msg_text test.t1 check status OK insert into t1 values (5,5,5); check table t1 changed; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def Table 253 42 7 Y 0 31 8 +def Op 253 3 5 Y 0 31 8 +def Msg_type 253 3 6 Y 0 31 8 +def Msg_text 253 85 2 Y 0 31 8 Table Op Msg_type Msg_text test.t1 check status OK check table t1 medium; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def Table 253 42 7 Y 0 31 8 +def Op 253 3 5 Y 0 31 8 +def Msg_type 253 3 6 Y 0 31 8 +def Msg_text 253 85 2 Y 0 31 8 Table Op Msg_type Msg_text test.t1 check status OK check table t1 extended; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def Table 253 42 7 Y 0 31 8 +def Op 253 3 5 Y 0 31 8 +def Msg_type 253 3 6 Y 0 31 8 +def Msg_text 253 85 2 Y 0 31 8 Table Op Msg_type Msg_text test.t1 check status OK show index from t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def STATISTICS TABLE_NAME Table 253 64 2 N 1 0 8 +def STATISTICS NON_UNIQUE Non_unique 8 1 1 N 32769 0 63 +def STATISTICS INDEX_NAME Key_name 253 64 7 N 1 0 8 +def STATISTICS SEQ_IN_INDEX Seq_in_index 8 2 1 N 32769 0 63 +def STATISTICS COLUMN_NAME Column_name 253 64 1 N 1 0 8 +def STATISTICS COLLATION Collation 253 1 1 Y 0 0 8 +def STATISTICS CARDINALITY Cardinality 8 21 1 Y 32768 0 63 +def STATISTICS SUB_PART Sub_part 8 3 0 Y 32768 0 63 +def STATISTICS PACKED Packed 253 10 0 Y 0 0 8 +def STATISTICS NULLABLE Null 253 3 0 N 1 0 8 +def STATISTICS INDEX_TYPE Index_type 253 16 5 N 1 0 8 +def STATISTICS COMMENT Comment 253 16 0 Y 0 0 8 Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment t1 0 PRIMARY 1 a A 5 NULL NULL BTREE t1 1 b 1 b A 1 NULL NULL BTREE t1 1 b 2 c A 5 NULL NULL BTREE insert into t1 values (5,5,5); ERROR 23000: Duplicate entry '5' for key 1 +-- Here we enable metadata just to check that the collation of the +-- resultset is non-binary for string type. This should be changed +-- after Bug#29394 is implemented. optimize table t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def Table 253 42 7 Y 0 31 8 +def Op 253 3 8 Y 0 31 8 +def Msg_type 253 3 6 Y 0 31 8 +def Msg_text 253 85 2 Y 0 31 8 Table Op Msg_type Msg_text test.t1 optimize status OK optimize table t1; Table Op Msg_type Msg_text test.t1 optimize status Table is already up to date drop table t1; +-- Here we enable metadata just to check that the collation of the +-- resultset is non-binary for string type. This should be changed +-- after Bug#29394 is implemented. show variables like "wait_timeout%"; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def VARIABLES Variable_name Variable_name 253 80 12 N 1 0 8 +def VARIABLES Value Value 253 512 5 N 1 0 8 Variable_name Value wait_timeout 28800 show variables like "WAIT_timeout%"; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def VARIABLES Variable_name Variable_name 253 80 12 N 1 0 8 +def VARIABLES Value Value 253 512 5 N 1 0 8 Variable_name Value wait_timeout 28800 show variables like "this_doesn't_exists%"; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def VARIABLES Variable_name Variable_name 253 80 0 N 1 0 8 +def VARIABLES Value Value 253 512 0 N 1 0 8 Variable_name Value show table status from test like "this_doesn't_exists%"; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def TABLES TABLE_NAME Name 253 64 0 N 1 0 8 +def TABLES ENGINE Engine 253 64 0 Y 0 0 8 +def TABLES VERSION Version 8 21 0 Y 32768 0 63 +def TABLES ROW_FORMAT Row_format 253 10 0 Y 0 0 8 +def TABLES TABLE_ROWS Rows 8 21 0 Y 32768 0 63 +def TABLES AVG_ROW_LENGTH Avg_row_length 8 21 0 Y 32768 0 63 +def TABLES DATA_LENGTH Data_length 8 21 0 Y 32768 0 63 +def TABLES MAX_DATA_LENGTH Max_data_length 8 21 0 Y 32768 0 63 +def TABLES INDEX_LENGTH Index_length 8 21 0 Y 32768 0 63 +def TABLES DATA_FREE Data_free 8 21 0 Y 32768 0 63 +def TABLES AUTO_INCREMENT Auto_increment 8 21 0 Y 32768 0 63 +def TABLES CREATE_TIME Create_time 12 19 0 Y 128 0 63 +def TABLES UPDATE_TIME Update_time 12 19 0 Y 128 0 63 +def TABLES CHECK_TIME Check_time 12 19 0 Y 128 0 63 +def TABLES TABLE_COLLATION Collation 253 64 0 Y 0 0 8 +def TABLES CHECKSUM Checksum 8 21 0 Y 32768 0 63 +def TABLES CREATE_OPTIONS Create_options 253 255 0 Y 0 0 8 +def TABLES TABLE_COMMENT Comment 253 80 0 N 1 0 8 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 show databases; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def SCHEMATA SCHEMA_NAME Database 253 64 18 N 1 0 8 Database information_schema mysql test show databases like "test%"; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def SCHEMATA SCHEMA_NAME Database (test%) 253 64 4 N 1 0 8 Database (test%) test create table t1 (f1 int not null, f2 int not null, f3 int not null, f4 int not null, primary key(f1,f2,f3,f4)); insert into t1 values (1,1,1,0),(1,1,2,0),(1,1,3,0),(1,2,1,0),(1,2,2,0),(1,2,3,0),(1,3,1,0),(1,3,2,0),(1,3,3,0),(1,1,1,1),(1,1,2,1),(1,1,3,1),(1,2,1,1),(1,2,2,1),(1,2,3,1),(1,3,1,1),(1,3,2,1),(1,3,3,1); +-- Here we enable metadata just to check that the collation of the +-- resultset is non-binary for string type. This should be changed +-- after Bug#29394 is implemented. analyze table t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def Table 253 42 7 Y 0 31 8 +def Op 253 3 7 Y 0 31 8 +def Msg_type 253 3 6 Y 0 31 8 +def Msg_text 253 85 2 Y 0 31 8 Table Op Msg_type Msg_text test.t1 analyze status OK show index from t1; @@ -69,7 +166,15 @@ t1 0 PRIMARY 1 f1 A 1 NULL NULL BTREE t1 0 PRIMARY 2 f2 A 3 NULL NULL BTREE t1 0 PRIMARY 3 f3 A 9 NULL NULL BTREE t1 0 PRIMARY 4 f4 A 18 NULL NULL BTREE +-- Here we enable metadata just to check that the collation of the +-- resultset is non-binary for string type. This should be changed +-- after Bug#29394 is implemented. repair table t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def Table 253 42 7 Y 0 31 8 +def Op 253 3 6 Y 0 31 8 +def Msg_type 253 3 6 Y 0 31 8 +def Msg_text 253 85 2 Y 0 31 8 Table Op Msg_type Msg_text test.t1 repair status OK show index from t1; @@ -645,4 +750,372 @@ select 1 from information_schema.tables limit 1; show status like 'slow_queries'; Variable_name Value Slow_queries 1 +DROP DATABASE IF EXISTS mysqltest1; +DROP TABLE IF EXISTS t1; +DROP VIEW IF EXISTS v1; +DROP PROCEDURE IF EXISTS p1; +DROP FUNCTION IF EXISTS f1; +CREATE DATABASE mysqltest1; +CREATE TABLE t1(c INT NOT NULL PRIMARY KEY); +CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1; +CREATE VIEW v1 AS SELECT 1; +CREATE PROCEDURE p1() SELECT 1; +CREATE FUNCTION f1() RETURNS INT RETURN 1; +set names utf8; +-- Here we enable metadata just to check that the collation of the +-- resultset is non-binary for string type. This should be changed +-- after Bug#29394 is implemented. +---------------------------------------------------------------- +SHOW CHARACTER SET LIKE 'utf8'; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def CHARACTER_SETS CHARACTER_SET_NAME Charset 253 192 4 N 1 0 33 +def CHARACTER_SETS DESCRIPTION Description 253 180 13 N 1 0 33 +def CHARACTER_SETS DEFAULT_COLLATE_NAME Default collation 253 192 15 N 1 0 33 +def CHARACTER_SETS MAXLEN Maxlen 8 3 1 N 32769 0 63 +Charset Description Default collation Maxlen +utf8 UTF-8 Unicode utf8_general_ci 3 +---------------------------------------------------------------- +SHOW COLLATION LIKE 'latin1_bin'; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COLLATIONS COLLATION_NAME Collation 253 192 10 N 1 0 33 +def COLLATIONS CHARACTER_SET_NAME Charset 253 192 6 N 1 0 33 +def COLLATIONS ID Id 8 11 2 N 32769 0 63 +def COLLATIONS IS_DEFAULT Default 253 9 0 N 1 0 33 +def COLLATIONS IS_COMPILED Compiled 253 9 3 N 1 0 33 +def COLLATIONS SORTLEN Sortlen 8 3 1 N 32769 0 63 +Collation Charset Id Default Compiled Sortlen +latin1_bin latin1 47 Yes 1 +---------------------------------------------------------------- +SHOW CREATE DATABASE mysqltest1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def Database 253 63 10 N 1 31 33 +def Create Database 253 1023 69 N 1 31 33 +Database Create Database +mysqltest1 CREATE DATABASE `mysqltest1` /*!40100 DEFAULT CHARACTER SET latin1 */ +---------------------------------------------------------------- +SHOW DATABASES LIKE 'mysqltest1'; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def SCHEMATA SCHEMA_NAME Database (mysqltest1) 253 192 10 N 1 0 33 +Database (mysqltest1) +mysqltest1 +---------------------------------------------------------------- +SHOW CREATE TABLE t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def Table 253 63 2 N 1 31 33 +def Create Table 253 1023 103 N 1 31 33 +Table Create Table +t1 CREATE TABLE `t1` ( + `c` int(11) NOT NULL, + PRIMARY KEY (`c`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +---------------------------------------------------------------- +SHOW INDEX FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def STATISTICS TABLE_NAME Table 253 192 2 N 1 0 33 +def STATISTICS NON_UNIQUE Non_unique 8 1 1 N 32769 0 63 +def STATISTICS INDEX_NAME Key_name 253 192 7 N 1 0 33 +def STATISTICS SEQ_IN_INDEX Seq_in_index 8 2 1 N 32769 0 63 +def STATISTICS COLUMN_NAME Column_name 253 192 1 N 1 0 33 +def STATISTICS COLLATION Collation 253 3 1 Y 0 0 33 +def STATISTICS CARDINALITY Cardinality 8 21 1 Y 32768 0 63 +def STATISTICS SUB_PART Sub_part 8 3 0 Y 32768 0 63 +def STATISTICS PACKED Packed 253 30 0 Y 0 0 33 +def STATISTICS NULLABLE Null 253 9 0 N 1 0 33 +def STATISTICS INDEX_TYPE Index_type 253 48 5 N 1 0 33 +def STATISTICS COMMENT Comment 253 48 0 Y 0 0 33 +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment +t1 0 PRIMARY 1 c A 0 NULL NULL BTREE +---------------------------------------------------------------- +SELECT +TABLE_CATALOG, +TABLE_SCHEMA, +TABLE_NAME, +TABLE_TYPE, +ENGINE, +ROW_FORMAT, +TABLE_COLLATION, +CREATE_OPTIONS, +TABLE_COMMENT +FROM INFORMATION_SCHEMA.TABLES +WHERE table_name = 't1'; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def TABLES TABLE_CATALOG TABLE_CATALOG 253 1536 0 Y 0 0 33 +def TABLES TABLE_SCHEMA TABLE_SCHEMA 253 192 4 N 1 0 33 +def TABLES TABLE_NAME TABLE_NAME 253 192 2 N 1 0 33 +def TABLES TABLE_TYPE TABLE_TYPE 253 192 10 N 1 0 33 +def TABLES ENGINE ENGINE 253 192 6 Y 0 0 33 +def TABLES ROW_FORMAT ROW_FORMAT 253 30 5 Y 0 0 33 +def TABLES TABLE_COLLATION TABLE_COLLATION 253 192 17 Y 0 0 33 +def TABLES CREATE_OPTIONS CREATE_OPTIONS 253 765 0 Y 0 0 33 +def TABLES TABLE_COMMENT TABLE_COMMENT 253 240 0 N 1 0 33 +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE ROW_FORMAT TABLE_COLLATION CREATE_OPTIONS TABLE_COMMENT +NULL test t1 BASE TABLE MyISAM Fixed latin1_swedish_ci +---------------------------------------------------------------- +SELECT +TABLE_CATALOG, +TABLE_SCHEMA, +TABLE_NAME, +COLUMN_NAME, +COLUMN_DEFAULT, +IS_NULLABLE, +DATA_TYPE, +CHARACTER_SET_NAME, +COLLATION_NAME, +COLUMN_TYPE, +COLUMN_KEY, +EXTRA, +PRIVILEGES, +COLUMN_COMMENT +FROM INFORMATION_SCHEMA.COLUMNS +WHERE table_name = 't1'; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COLUMNS TABLE_CATALOG TABLE_CATALOG 253 1536 0 Y 0 0 33 +def COLUMNS TABLE_SCHEMA TABLE_SCHEMA 253 192 4 N 1 0 33 +def COLUMNS TABLE_NAME TABLE_NAME 253 192 2 N 1 0 33 +def COLUMNS COLUMN_NAME COLUMN_NAME 253 192 1 N 1 0 33 +def COLUMNS COLUMN_DEFAULT COLUMN_DEFAULT 252 589815 0 Y 16 0 33 +def COLUMNS IS_NULLABLE IS_NULLABLE 253 9 2 N 1 0 33 +def COLUMNS DATA_TYPE DATA_TYPE 253 192 3 N 1 0 33 +def COLUMNS CHARACTER_SET_NAME CHARACTER_SET_NAME 253 192 0 Y 0 0 33 +def COLUMNS COLLATION_NAME COLLATION_NAME 253 192 0 Y 0 0 33 +def COLUMNS COLUMN_TYPE COLUMN_TYPE 252 589815 7 N 17 0 33 +def COLUMNS COLUMN_KEY COLUMN_KEY 253 9 3 N 1 0 33 +def COLUMNS EXTRA EXTRA 253 60 0 N 1 0 33 +def COLUMNS PRIVILEGES PRIVILEGES 253 240 31 N 1 0 33 +def COLUMNS COLUMN_COMMENT COLUMN_COMMENT 253 765 0 N 1 0 33 +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT +NULL test t1 c NULL NO int NULL NULL int(11) PRI select,insert,update,references +---------------------------------------------------------------- +SHOW TABLES LIKE 't1'; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def TABLE_NAMES TABLE_NAME Tables_in_test (t1) 253 192 2 N 1 0 33 +Tables_in_test (t1) +t1 +---------------------------------------------------------------- +SHOW COLUMNS FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COLUMNS COLUMN_NAME Field 253 192 1 N 1 0 33 +def COLUMNS COLUMN_TYPE Type 252 589815 7 N 17 0 33 +def COLUMNS IS_NULLABLE Null 253 9 2 N 1 0 33 +def COLUMNS COLUMN_KEY Key 253 9 3 N 1 0 33 +def COLUMNS COLUMN_DEFAULT Default 252 589815 0 Y 16 0 33 +def COLUMNS EXTRA Extra 253 60 0 N 1 0 33 +Field Type Null Key Default Extra +c int(11) NO PRI +---------------------------------------------------------------- +SHOW TRIGGERS LIKE 't1'; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def TRIGGERS TRIGGER_NAME Trigger 253 192 5 N 1 0 33 +def TRIGGERS EVENT_MANIPULATION Event 253 18 6 N 1 0 33 +def TRIGGERS EVENT_OBJECT_TABLE Table 253 192 2 N 1 0 33 +def TRIGGERS ACTION_STATEMENT Statement 252 589815 10 N 17 0 33 +def TRIGGERS ACTION_TIMING Timing 253 18 6 N 1 0 33 +def TRIGGERS CREATED Created 12 19 0 Y 128 0 63 +def TRIGGERS SQL_MODE sql_mode 252 589815 0 N 17 0 33 +def TRIGGERS DEFINER Definer 252 589815 14 N 17 0 33 +Trigger Event Table Statement Timing Created sql_mode Definer +t1_bi INSERT t1 SET @a = 1 BEFORE NULL root@localhost +---------------------------------------------------------------- +SELECT +TRIGGER_CATALOG, +TRIGGER_SCHEMA, +TRIGGER_NAME, +EVENT_MANIPULATION, +EVENT_OBJECT_CATALOG, +EVENT_OBJECT_SCHEMA, +EVENT_OBJECT_TABLE, +ACTION_CONDITION, +ACTION_STATEMENT, +ACTION_ORIENTATION, +ACTION_TIMING, +ACTION_REFERENCE_OLD_TABLE, +ACTION_REFERENCE_NEW_TABLE, +ACTION_REFERENCE_OLD_ROW, +ACTION_REFERENCE_NEW_ROW, +SQL_MODE, +DEFINER +FROM INFORMATION_SCHEMA.TRIGGERS +WHERE trigger_name = 't1_bi'; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def TRIGGERS TRIGGER_CATALOG TRIGGER_CATALOG 253 1536 0 Y 0 0 33 +def TRIGGERS TRIGGER_SCHEMA TRIGGER_SCHEMA 253 192 4 N 1 0 33 +def TRIGGERS TRIGGER_NAME TRIGGER_NAME 253 192 5 N 1 0 33 +def TRIGGERS EVENT_MANIPULATION EVENT_MANIPULATION 253 18 6 N 1 0 33 +def TRIGGERS EVENT_OBJECT_CATALOG EVENT_OBJECT_CATALOG 253 1536 0 Y 0 0 33 +def TRIGGERS EVENT_OBJECT_SCHEMA EVENT_OBJECT_SCHEMA 253 192 4 N 1 0 33 +def TRIGGERS EVENT_OBJECT_TABLE EVENT_OBJECT_TABLE 253 192 2 N 1 0 33 +def TRIGGERS ACTION_CONDITION ACTION_CONDITION 252 589815 0 Y 16 0 33 +def TRIGGERS ACTION_STATEMENT ACTION_STATEMENT 252 589815 10 N 17 0 33 +def TRIGGERS ACTION_ORIENTATION ACTION_ORIENTATION 253 27 3 N 1 0 33 +def TRIGGERS ACTION_TIMING ACTION_TIMING 253 18 6 N 1 0 33 +def TRIGGERS ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_OLD_TABLE 253 192 0 Y 0 0 33 +def TRIGGERS ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_NEW_TABLE 253 192 0 Y 0 0 33 +def TRIGGERS ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_OLD_ROW 253 9 3 N 1 0 33 +def TRIGGERS ACTION_REFERENCE_NEW_ROW ACTION_REFERENCE_NEW_ROW 253 9 3 N 1 0 33 +def TRIGGERS SQL_MODE SQL_MODE 252 589815 0 N 17 0 33 +def TRIGGERS DEFINER DEFINER 252 589815 14 N 17 0 33 +TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW SQL_MODE DEFINER +NULL test t1_bi INSERT NULL test t1 NULL SET @a = 1 ROW BEFORE NULL NULL OLD NEW root@localhost +---------------------------------------------------------------- +SHOW CREATE VIEW v1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def View 253 63 2 N 1 31 33 +def Create View 253 1023 103 N 1 31 33 +View Create View +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 1 AS `1` +---------------------------------------------------------------- +SELECT * +FROM INFORMATION_SCHEMA.VIEWS +WHERE table_name = 'v1'; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def VIEWS TABLE_CATALOG TABLE_CATALOG 253 1536 0 Y 0 0 33 +def VIEWS TABLE_SCHEMA TABLE_SCHEMA 253 192 4 N 1 0 33 +def VIEWS TABLE_NAME TABLE_NAME 253 192 2 N 1 0 33 +def VIEWS VIEW_DEFINITION VIEW_DEFINITION 252 589815 41 N 17 0 33 +def VIEWS CHECK_OPTION CHECK_OPTION 253 24 4 N 1 0 33 +def VIEWS IS_UPDATABLE IS_UPDATABLE 253 9 2 N 1 0 33 +def VIEWS DEFINER DEFINER 253 231 14 N 1 0 33 +def VIEWS SECURITY_TYPE SECURITY_TYPE 253 21 7 N 1 0 33 +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE +NULL test v1 /* ALGORITHM=UNDEFINED */ select 1 AS `1` NONE NO root@localhost DEFINER +---------------------------------------------------------------- +SHOW CREATE PROCEDURE p1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def Procedure 253 63 2 N 1 31 33 +def sql_mode 253 0 0 N 1 31 33 +def Create Procedure 253 2046 59 Y 0 31 33 +Procedure sql_mode Create Procedure +p1 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`() +SELECT 1 +---------------------------------------------------------------- +SELECT +SPECIFIC_NAME, +ROUTINE_CATALOG, +ROUTINE_SCHEMA, +ROUTINE_NAME, +ROUTINE_TYPE, +DTD_IDENTIFIER, +ROUTINE_BODY, +ROUTINE_DEFINITION, +EXTERNAL_NAME, +EXTERNAL_LANGUAGE, +PARAMETER_STYLE, +IS_DETERMINISTIC, +SQL_DATA_ACCESS, +SQL_PATH, +SECURITY_TYPE, +SQL_MODE, +ROUTINE_COMMENT, +DEFINER +FROM INFORMATION_SCHEMA.ROUTINES +WHERE routine_name = 'p1'; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def ROUTINES SPECIFIC_NAME SPECIFIC_NAME 253 192 2 N 1 0 33 +def ROUTINES ROUTINE_CATALOG ROUTINE_CATALOG 253 1536 0 Y 0 0 33 +def ROUTINES ROUTINE_SCHEMA ROUTINE_SCHEMA 253 192 4 N 1 0 33 +def ROUTINES ROUTINE_NAME ROUTINE_NAME 253 192 2 N 1 0 33 +def ROUTINES ROUTINE_TYPE ROUTINE_TYPE 253 27 9 N 1 0 33 +def ROUTINES DTD_IDENTIFIER DTD_IDENTIFIER 253 192 0 Y 0 0 33 +def ROUTINES ROUTINE_BODY ROUTINE_BODY 253 24 3 N 1 0 33 +def ROUTINES ROUTINE_DEFINITION ROUTINE_DEFINITION 252 589815 8 Y 16 0 33 +def ROUTINES EXTERNAL_NAME EXTERNAL_NAME 253 192 0 Y 0 0 33 +def ROUTINES EXTERNAL_LANGUAGE EXTERNAL_LANGUAGE 253 192 0 Y 0 0 33 +def ROUTINES PARAMETER_STYLE PARAMETER_STYLE 253 24 3 N 1 0 33 +def ROUTINES IS_DETERMINISTIC IS_DETERMINISTIC 253 9 2 N 1 0 33 +def ROUTINES SQL_DATA_ACCESS SQL_DATA_ACCESS 253 192 12 N 1 0 33 +def ROUTINES SQL_PATH SQL_PATH 253 192 0 Y 0 0 33 +def ROUTINES SECURITY_TYPE SECURITY_TYPE 253 21 7 N 1 0 33 +def ROUTINES SQL_MODE SQL_MODE 252 589815 0 N 17 0 33 +def ROUTINES ROUTINE_COMMENT ROUTINE_COMMENT 253 192 0 N 1 0 33 +def ROUTINES DEFINER DEFINER 253 231 14 N 1 0 33 +SPECIFIC_NAME ROUTINE_CATALOG ROUTINE_SCHEMA ROUTINE_NAME ROUTINE_TYPE DTD_IDENTIFIER ROUTINE_BODY ROUTINE_DEFINITION EXTERNAL_NAME EXTERNAL_LANGUAGE PARAMETER_STYLE IS_DETERMINISTIC SQL_DATA_ACCESS SQL_PATH SECURITY_TYPE SQL_MODE ROUTINE_COMMENT DEFINER +p1 NULL test p1 PROCEDURE NULL SQL SELECT 1 NULL NULL SQL NO CONTAINS SQL NULL DEFINER root@localhost +---------------------------------------------------------------- +SHOW CREATE FUNCTION f1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def Function 253 63 2 N 1 31 33 +def sql_mode 253 0 0 N 1 31 33 +def Create Function 253 2046 74 Y 0 31 33 +Function sql_mode Create Function +f1 CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11) +RETURN 1 +---------------------------------------------------------------- +SELECT +SPECIFIC_NAME, +ROUTINE_CATALOG, +ROUTINE_SCHEMA, +ROUTINE_NAME, +ROUTINE_TYPE, +DTD_IDENTIFIER, +ROUTINE_BODY, +ROUTINE_DEFINITION, +EXTERNAL_NAME, +EXTERNAL_LANGUAGE, +PARAMETER_STYLE, +IS_DETERMINISTIC, +SQL_DATA_ACCESS, +SQL_PATH, +SECURITY_TYPE, +SQL_MODE, +ROUTINE_COMMENT, +DEFINER +FROM INFORMATION_SCHEMA.ROUTINES +WHERE routine_name = 'f1'; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def ROUTINES SPECIFIC_NAME SPECIFIC_NAME 253 192 2 N 1 0 33 +def ROUTINES ROUTINE_CATALOG ROUTINE_CATALOG 253 1536 0 Y 0 0 33 +def ROUTINES ROUTINE_SCHEMA ROUTINE_SCHEMA 253 192 4 N 1 0 33 +def ROUTINES ROUTINE_NAME ROUTINE_NAME 253 192 2 N 1 0 33 +def ROUTINES ROUTINE_TYPE ROUTINE_TYPE 253 27 8 N 1 0 33 +def ROUTINES DTD_IDENTIFIER DTD_IDENTIFIER 253 192 7 Y 0 0 33 +def ROUTINES ROUTINE_BODY ROUTINE_BODY 253 24 3 N 1 0 33 +def ROUTINES ROUTINE_DEFINITION ROUTINE_DEFINITION 252 589815 8 Y 16 0 33 +def ROUTINES EXTERNAL_NAME EXTERNAL_NAME 253 192 0 Y 0 0 33 +def ROUTINES EXTERNAL_LANGUAGE EXTERNAL_LANGUAGE 253 192 0 Y 0 0 33 +def ROUTINES PARAMETER_STYLE PARAMETER_STYLE 253 24 3 N 1 0 33 +def ROUTINES IS_DETERMINISTIC IS_DETERMINISTIC 253 9 2 N 1 0 33 +def ROUTINES SQL_DATA_ACCESS SQL_DATA_ACCESS 253 192 12 N 1 0 33 +def ROUTINES SQL_PATH SQL_PATH 253 192 0 Y 0 0 33 +def ROUTINES SECURITY_TYPE SECURITY_TYPE 253 21 7 N 1 0 33 +def ROUTINES SQL_MODE SQL_MODE 252 589815 0 N 17 0 33 +def ROUTINES ROUTINE_COMMENT ROUTINE_COMMENT 253 192 0 N 1 0 33 +def ROUTINES DEFINER DEFINER 253 231 14 N 1 0 33 +SPECIFIC_NAME ROUTINE_CATALOG ROUTINE_SCHEMA ROUTINE_NAME ROUTINE_TYPE DTD_IDENTIFIER ROUTINE_BODY ROUTINE_DEFINITION EXTERNAL_NAME EXTERNAL_LANGUAGE PARAMETER_STYLE IS_DETERMINISTIC SQL_DATA_ACCESS SQL_PATH SECURITY_TYPE SQL_MODE ROUTINE_COMMENT DEFINER +f1 NULL test f1 FUNCTION int(11) SQL RETURN 1 NULL NULL SQL NO CONTAINS SQL NULL DEFINER root@localhost +---------------------------------------------------------------- +DROP DATABASE mysqltest1; +DROP TABLE t1; +DROP VIEW v1; +DROP PROCEDURE p1; +DROP FUNCTION f1; +flush status; +show variables like "log_queries_not_using_indexes"; +Variable_name Value +log_queries_not_using_indexes ON +select 1 from information_schema.tables limit 1; +1 +1 +show status like 'slow_queries'; +Variable_name Value +Slow_queries 1 +set global log_queries_not_using_indexes=OFF; +show variables like "log_queries_not_using_indexes"; +Variable_name Value +log_queries_not_using_indexes OFF +select 1 from information_schema.tables limit 1; +1 +1 +show status like 'slow_queries'; +Variable_name Value +Slow_queries 1 +set global log_queries_not_using_indexes=ON; +show variables like "log_queries_not_using_indexes"; +Variable_name Value +log_queries_not_using_indexes ON +select 1 from information_schema.tables limit 1; +1 +1 +show status like 'slow_queries'; +Variable_name Value +Slow_queries 2 End of 5.0 tests diff --git a/mysql-test/r/sp-dynamic.result b/mysql-test/r/sp-dynamic.result index d9d5706cded..0f50bcc97cd 100644 --- a/mysql-test/r/sp-dynamic.result +++ b/mysql-test/r/sp-dynamic.result @@ -87,6 +87,10 @@ prepare stmt from "create table t1 (a int)"; execute stmt; insert into t1 (a) values (1); select * from t1; +prepare stmt_alter from "alter table t1 add (b int)"; +execute stmt_alter; +insert into t1 (a,b) values (2,1); +deallocate prepare stmt_alter; deallocate prepare stmt; deallocate prepare stmt_drop; end| @@ -245,6 +249,9 @@ a 1 drop procedure p1| drop table if exists t1| +drop table if exists t2| +Warnings: +Note 1051 Unknown table 't2' create table t1 (id integer primary key auto_increment, stmt_text char(35), status varchar(20))| insert into t1 (stmt_text) values @@ -255,7 +262,10 @@ insert into t1 (stmt_text) values ("help help"), ("show databases"), ("show tables"), ("show table status"), ("show open tables"), ("show storage engines"), ("insert into t1 (id) values (1)"), ("update t1 set status=''"), -("delete from t1"), ("truncate t1"), ("call p1()"), ("foo bar")| +("delete from t1"), ("truncate t1"), ("call p1()"), ("foo bar"), +("create view v1 as select 1"), ("alter view v1 as select 2"), +("drop view v1"),("create table t2 (a int)"),("alter table t2 add (b int)"), +("drop table t2")| create procedure p1() begin declare v_stmt_text varchar(255); @@ -305,6 +315,12 @@ id stmt_text status 20 truncate t1 supported 21 call p1() supported 22 foo bar syntax error +23 create view v1 as select 1 supported +24 alter view v1 as select 2 not supported +25 drop view v1 supported +26 create table t2 (a int) supported +27 alter table t2 add (b int) supported +28 drop table t2 supported drop procedure p1| drop table t1| prepare stmt from 'select 1'| diff --git a/mysql-test/r/sp-error.result b/mysql-test/r/sp-error.result index bdcb51c4db8..bd0640b2b14 100644 --- a/mysql-test/r/sp-error.result +++ b/mysql-test/r/sp-error.result @@ -982,9 +982,9 @@ ERROR HY000: Explicit or implicit commit is not allowed in stored function or tr CREATE FUNCTION bug_13627_f() returns int BEGIN create view v1 as select 1; return 1; END | ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN alter view v1 as select 1; END | -ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. +ERROR 0A000: ALTER VIEW is not allowed in stored procedures CREATE FUNCTION bug_13627_f() returns int BEGIN alter view v1 as select 1; return 1; END | -ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. +ERROR 0A000: ALTER VIEW is not allowed in stored procedures CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN drop view v1; END | ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. CREATE FUNCTION bug_13627_f() returns int BEGIN drop view v1; return 1; END | @@ -1030,7 +1030,7 @@ select bug12329(); bug12329() 101 execute stmt1; -ERROR HY000: Table 't2' was not locked with LOCK TABLES +ERROR 42S02: Table 'test.t2' doesn't exist deallocate prepare stmt1; drop function bug12329; drop table t1, t2; @@ -1152,12 +1152,12 @@ create trigger t1_ai after insert on t1 for each row insert into t2 values (new. create view v1 as select * from t1; drop table t2; insert into v1 values (1); -ERROR HY000: Table 't2' was not locked with LOCK TABLES +ERROR 42S02: Table 'test.t2' doesn't exist drop trigger t1_ai; create function bug11555_1() returns int return (select max(i) from t2); create trigger t1_ai after insert on t1 for each row set @a:=bug11555_1(); insert into v1 values (2); -ERROR HY000: Table 't2' was not locked with LOCK TABLES +ERROR 42S02: Table 'test.t2' doesn't exist drop function bug11555_1; drop table t1; drop view v1; diff --git a/mysql-test/r/sp-prelocking.result b/mysql-test/r/sp-prelocking.result index 7d8dd862748..5eac54803f0 100644 --- a/mysql-test/r/sp-prelocking.result +++ b/mysql-test/r/sp-prelocking.result @@ -254,4 +254,17 @@ execute stmt; deallocate prepare stmt; drop function bug19634; drop table t1, t2, t3; +drop table if exists bug_27907_logs; +drop table if exists bug_27907_t1; +create table bug_27907_logs (a int); +create table bug_27907_t1 (a int); +create trigger bug_27907_t1_ai after insert on bug_27907_t1 +for each row +begin +insert into bug_27907_logs (a) values (1); +end| +drop table bug_27907_logs; +insert into bug_27907_t1(a) values (1); +ERROR 42S02: Table 'test.bug_27907_logs' doesn't exist +drop table bug_27907_t1; End of 5.0 tests diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index b5b79af031e..b411c65faee 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -4409,55 +4409,58 @@ Table Op Msg_type Msg_text test.t1 repair status OK test.t2 repair status OK test.t3 repair status OK -test.v1 repair error 'test.v1' is not BASE TABLE +test.v1 repair Error 'test.v1' is not BASE TABLE +test.v1 repair error Corrupt Table Op Msg_type Msg_text test.t1 optimize status OK test.t2 optimize status OK test.t3 optimize status OK -test.v1 optimize error 'test.v1' is not BASE TABLE +test.v1 optimize Error 'test.v1' is not BASE TABLE +test.v1 optimize error Corrupt Table Op Msg_type Msg_text test.t1 analyze status Table is already up to date test.t2 analyze status Table is already up to date test.t3 analyze status Table is already up to date -test.v1 analyze error 'test.v1' is not BASE TABLE -Warnings: -Error 1347 'test.v1' is not BASE TABLE +test.v1 analyze Error 'test.v1' is not BASE TABLE +test.v1 analyze error Corrupt call bug13012()| Table Op Msg_type Msg_text test.t1 repair status OK test.t2 repair status OK test.t3 repair status OK -test.v1 repair error 'test.v1' is not BASE TABLE +test.v1 repair Error 'test.v1' is not BASE TABLE +test.v1 repair error Corrupt Table Op Msg_type Msg_text test.t1 optimize status OK test.t2 optimize status OK test.t3 optimize status OK -test.v1 optimize error 'test.v1' is not BASE TABLE +test.v1 optimize Error 'test.v1' is not BASE TABLE +test.v1 optimize error Corrupt Table Op Msg_type Msg_text test.t1 analyze status Table is already up to date test.t2 analyze status Table is already up to date test.t3 analyze status Table is already up to date -test.v1 analyze error 'test.v1' is not BASE TABLE -Warnings: -Error 1347 'test.v1' is not BASE TABLE +test.v1 analyze Error 'test.v1' is not BASE TABLE +test.v1 analyze error Corrupt call bug13012()| Table Op Msg_type Msg_text test.t1 repair status OK test.t2 repair status OK test.t3 repair status OK -test.v1 repair error 'test.v1' is not BASE TABLE +test.v1 repair Error 'test.v1' is not BASE TABLE +test.v1 repair error Corrupt Table Op Msg_type Msg_text test.t1 optimize status OK test.t2 optimize status OK test.t3 optimize status OK -test.v1 optimize error 'test.v1' is not BASE TABLE +test.v1 optimize Error 'test.v1' is not BASE TABLE +test.v1 optimize error Corrupt Table Op Msg_type Msg_text test.t1 analyze status Table is already up to date test.t2 analyze status Table is already up to date test.t3 analyze status Table is already up to date -test.v1 analyze error 'test.v1' is not BASE TABLE -Warnings: -Error 1347 'test.v1' is not BASE TABLE +test.v1 analyze Error 'test.v1' is not BASE TABLE +test.v1 analyze error Corrupt drop procedure bug13012| drop view v1; select * from t1| @@ -4909,7 +4912,7 @@ create table t3 as select * from v1| show create table t3| Table Create Table t3 CREATE TABLE `t3` ( - `j` int(11) default NULL + `j` bigint(11) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 select * from t3| j @@ -6018,6 +6021,8 @@ select bug20777(9223372036854775810) as '9223372036854775810 2**63+2'; select bug20777(-9223372036854775808) as 'lower bounds signed bigint'; lower bounds signed bigint 0 +Warnings: +Warning 1264 Out of range value adjusted for column 'f1' at row 1 select bug20777(9223372036854775807) as 'upper bounds signed bigint'; upper bounds signed bigint 9223372036854775807 @@ -6030,9 +6035,13 @@ upper bounds unsigned bigint select bug20777(18446744073709551616) as 'upper bounds unsigned bigint + 1'; upper bounds unsigned bigint + 1 18446744073709551615 +Warnings: +Warning 1264 Out of range value adjusted for column 'f1' at row 1 select bug20777(-1) as 'lower bounds unsigned bigint - 1'; lower bounds unsigned bigint - 1 0 +Warnings: +Warning 1264 Out of range value adjusted for column 'f1' at row 1 create table examplebug20777 as select 0 as 'i', bug20777(9223372036854775806) as '2**63-2', @@ -6044,7 +6053,12 @@ bug20777(18446744073709551615) as '2**64-1', bug20777(18446744073709551616) as '2**64', bug20777(0) as '0', bug20777(-1) as '-1'; +Warnings: +Warning 1264 Out of range value adjusted for column 'f1' at row 1 +Warning 1264 Out of range value adjusted for column 'f1' at row 1 insert into examplebug20777 values (1, 9223372036854775806, 9223372036854775807, 223372036854775808, 9223372036854775809, 18446744073709551614, 18446744073709551615, 8446744073709551616, 0, -1); +Warnings: +Warning 1264 Out of range value adjusted for column '-1' at row 1 show create table examplebug20777; Table Create Table examplebug20777 CREATE TABLE `examplebug20777` ( @@ -6152,3 +6166,14 @@ count(*) 3 drop table t1,t2; drop function bug27354; +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2); +CREATE FUNCTION metered(a INT) RETURNS INT RETURN 12; +CREATE VIEW v1 AS SELECT test.metered(a) as metered FROM t1; +SHOW CREATE VIEW v1; +View Create View +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `test`.`metered`(`t1`.`a`) AS `metered` from `t1` +DROP VIEW v1; +DROP FUNCTION metered; +DROP TABLE t1; +End of 5.0 tests diff --git a/mysql-test/r/sp_trans.result b/mysql-test/r/sp_trans.result index c74909e7e8f..564e31c9e32 100644 --- a/mysql-test/r/sp_trans.result +++ b/mysql-test/r/sp_trans.result @@ -530,23 +530,3 @@ count(*) drop table t3, t4| drop procedure bug14210| set @@session.max_heap_table_size=default| -CREATE TABLE t1 (a int NOT NULL auto_increment primary key) ENGINE=MyISAM| -CREATE TABLE t2 (a int NOT NULL auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB| -insert into t2 values (1,1)| -create function bug23333() -RETURNS int(11) -DETERMINISTIC -begin -insert into t1 values (null); -select count(*) from t1 into @a; -return @a; -end| -reset master| -insert into t2 values (bug23333(),1)| -ERROR 23000: Duplicate entry '1' for key 1 -show binlog events from 98 /* with fixes for #23333 will show there is the query */| -Log_name Pos Event_type Server_id End_log_pos Info -select count(*),@a from t1 /* must be 1,1 */| -count(*) @a -1 1 -drop table t1, t2| diff --git a/mysql-test/r/sp_trans_log.result b/mysql-test/r/sp_trans_log.result new file mode 100644 index 00000000000..96e6f76b23c --- /dev/null +++ b/mysql-test/r/sp_trans_log.result @@ -0,0 +1,20 @@ +CREATE TABLE t1 (a int NOT NULL auto_increment primary key) ENGINE=MyISAM| +CREATE TABLE t2 (a int NOT NULL auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB| +insert into t2 values (1,1)| +create function bug23333() +RETURNS int(11) +DETERMINISTIC +begin +insert into t1 values (null); +select count(*) from t1 into @a; +return @a; +end| +reset master| +insert into t2 values (bug23333(),1)| +ERROR 23000: Duplicate entry '1' for key 1 +show binlog events from 98 /* with fixes for #23333 will show there is the query */| +Log_name Pos Event_type Server_id End_log_pos Info +select count(*),@a from t1 /* must be 1,1 */| +count(*) @a +1 1 +drop table t1, t2| diff --git a/mysql-test/r/ssl-big.result b/mysql-test/r/ssl-big.result new file mode 100644 index 00000000000..39c4f34e46c --- /dev/null +++ b/mysql-test/r/ssl-big.result @@ -0,0 +1,3 @@ +DROP TABLE IF EXISTS t1, t2; +create table t1 (a int); +drop table t1; diff --git a/mysql-test/r/strict.result b/mysql-test/r/strict.result index a3ebd5c86fd..34869862a63 100644 --- a/mysql-test/r/strict.result +++ b/mysql-test/r/strict.result @@ -993,16 +993,16 @@ ERROR 23000: Column 'col2' cannot be null INSERT INTO t1 VALUES (103,'',NULL); ERROR 23000: Column 'col3' cannot be null UPDATE t1 SET col1=NULL WHERE col1 =100; -ERROR 22004: Column was set to data type implicit default; NULL supplied for NOT NULL column 'col1' at row 1 +ERROR 23000: Column 'col1' cannot be null UPDATE t1 SET col2 =NULL WHERE col2 ='hello'; -ERROR 22004: Column was set to data type implicit default; NULL supplied for NOT NULL column 'col2' at row 1 +ERROR 23000: Column 'col2' cannot be null UPDATE t1 SET col2 =NULL where col3 IS NOT NULL; -ERROR 22004: Column was set to data type implicit default; NULL supplied for NOT NULL column 'col2' at row 1 +ERROR 23000: Column 'col2' cannot be null INSERT IGNORE INTO t1 values (NULL,NULL,NULL); Warnings: -Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'col1' at row 1 -Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'col2' at row 1 -Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'col3' at row 1 +Warning 1048 Column 'col1' cannot be null +Warning 1048 Column 'col2' cannot be null +Warning 1048 Column 'col3' cannot be null SELECT * FROM t1; col1 col2 col3 100 hello 2004-08-20 @@ -1027,11 +1027,11 @@ ERROR HY000: Field 'col2' doesn't have a default value INSERT INTO t1 (col1) SELECT 1; ERROR HY000: Field 'col2' doesn't have a default value INSERT INTO t1 SELECT 1,NULL; -ERROR 22004: Column was set to data type implicit default; NULL supplied for NOT NULL column 'col2' at row 1 +ERROR 23000: Column 'col2' cannot be null INSERT IGNORE INTO t1 values (NULL,NULL); Warnings: -Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'col1' at row 1 -Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'col2' at row 1 +Warning 1048 Column 'col1' cannot be null +Warning 1048 Column 'col2' cannot be null INSERT IGNORE INTO t1 (col1) values (3); Warnings: Warning 1364 Field 'col2' doesn't have a default value diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index 92a4a6f3f5a..be99bdb1afc 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -2853,7 +2853,6 @@ a 3 4 DROP TABLE t1,t2,t3; -purge master logs before (select adddate(current_timestamp(), interval -4 day)); CREATE TABLE t1 (f1 INT); CREATE TABLE t2 (f2 INT); INSERT INTO t1 VALUES (1); @@ -4071,4 +4070,73 @@ id st 2 GA 4 FL DROP TABLE t1,t2; +CREATE TABLE t1 (a int); +INSERT INTO t1 VALUES (1), (2); +EXPLAIN EXTENDED +SELECT * FROM (SELECT count(*) FROM t1 GROUP BY a) as res; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY ALL NULL NULL NULL NULL 2 +2 DERIVED t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort +Warnings: +Note 1003 select `res`.`count(*)` AS `count(*)` from (select count(0) AS `count(*)` from `test`.`t1` group by `test`.`t1`.`a`) `res` +DROP TABLE t1; +CREATE TABLE t1 ( +a varchar(255) default NULL, +b timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, +INDEX idx(a,b) +); +CREATE TABLE t2 ( +a varchar(255) default NULL +); +INSERT INTO t1 VALUES ('abcdefghijk','2007-05-07 06:00:24'); +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO `t1` VALUES ('asdf','2007-02-08 01:11:26'); +INSERT INTO `t2` VALUES ('abcdefghijk'); +INSERT INTO `t2` VALUES ('asdf'); +SET session sort_buffer_size=8192; +SELECT (SELECT 1 FROM t1 WHERE t1.a=t2.a ORDER BY t1.b LIMIT 1) AS d1 FROM t2; +d1 +1 +1 +DROP TABLE t1,t2; +CREATE TABLE t1 (a INTEGER, b INTEGER); +CREATE TABLE t2 (x INTEGER); +INSERT INTO t1 VALUES (1,11), (2,22), (2,22); +INSERT INTO t2 VALUES (1), (2); +SELECT a, COUNT(b), (SELECT COUNT(b) FROM t2) FROM t1 GROUP BY a; +ERROR 21000: Subquery returns more than 1 row +SELECT a, COUNT(b), (SELECT COUNT(b)+0 FROM t2) FROM t1 GROUP BY a; +ERROR 21000: Subquery returns more than 1 row +SELECT (SELECT SUM(t1.a)/AVG(t2.x) FROM t2) FROM t1; +(SELECT SUM(t1.a)/AVG(t2.x) FROM t2) +3.3333 +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); +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; +a COUNT(*) +1 3 +DROP TABLE t1; +CREATE TABLE t1 (a INT); +CREATE TABLE t2 (a INT); +INSERT INTO t1 VALUES (1),(2); +INSERT INTO t2 VALUES (1),(2); +SELECT (SELECT SUM(t1.a) FROM t2 WHERE a=0) FROM t1; +(SELECT SUM(t1.a) FROM t2 WHERE a=0) +NULL +SELECT (SELECT SUM(t1.a) FROM t2 WHERE a!=0) FROM t1; +ERROR 21000: Subquery returns more than 1 row +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; End of 5.0 tests. diff --git a/mysql-test/r/subselect3.result b/mysql-test/r/subselect3.result index 9bbfdc6c5f9..098dacc8189 100644 --- a/mysql-test/r/subselect3.result +++ b/mysql-test/r/subselect3.result @@ -742,3 +742,21 @@ x 0 0 DROP TABLE t1,t2,t3; +CREATE TABLE t1 (a INT NOT NULL); +INSERT INTO t1 VALUES (1),(-1), (65),(66); +CREATE TABLE t2 (a INT UNSIGNED NOT NULL PRIMARY KEY); +INSERT INTO t2 VALUES (65),(66); +SELECT a FROM t1 WHERE a NOT IN (65,66); +a +1 +-1 +SELECT a FROM t1 WHERE a NOT IN (SELECT a FROM t2); +a +1 +-1 +EXPLAIN SELECT a FROM t1 WHERE a NOT IN (SELECT a FROM t2); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where +2 DEPENDENT SUBQUERY t2 unique_subquery PRIMARY PRIMARY 4 func 1 Using index +DROP TABLE t1; +End of 5.0 tests diff --git a/mysql-test/r/subselect_notembedded.result b/mysql-test/r/subselect_notembedded.result index dd4b0701c32..44ae055425e 100644 --- a/mysql-test/r/subselect_notembedded.result +++ b/mysql-test/r/subselect_notembedded.result @@ -1 +1,3 @@ purge master logs before (select adddate(current_timestamp(), interval -4 day)); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'select adddate(current_timestamp(), interval -4 day))' at line 1 +purge master logs before adddate(current_timestamp(), interval -4 day); diff --git a/mysql-test/r/trigger.result b/mysql-test/r/trigger.result index 3e6a901dc00..5405a632aa4 100644 --- a/mysql-test/r/trigger.result +++ b/mysql-test/r/trigger.result @@ -820,9 +820,9 @@ call p1(); drop trigger t1_bi; create trigger t1_bi after insert on t1 for each row insert into t3 values (new.id); execute stmt1; -ERROR HY000: Table 't3' was not locked with LOCK TABLES +ERROR 42S02: Table 'test.t3' doesn't exist call p1(); -ERROR HY000: Table 't3' was not locked with LOCK TABLES +ERROR 42S02: Table 'test.t3' doesn't exist deallocate prepare stmt1; drop procedure p1; drop table t1, t2, t3; @@ -1449,4 +1449,31 @@ isave 1 2 drop table t1, t2, t3; +CREATE TABLE t1 (id INTEGER); +CREATE TABLE t2 (id INTEGER); +INSERT INTO t2 VALUES (1),(2); +CREATE TRIGGER t1_test AFTER INSERT ON t1 FOR EACH ROW +INSERT INTO t2 VALUES (new.id); +SELECT GET_LOCK('B26162',120); +GET_LOCK('B26162',120) +1 +SELECT 'rl_acquirer', GET_LOCK('B26162',120), id FROM t2 WHERE id = 1; +SET SESSION LOW_PRIORITY_UPDATES=1; +SET GLOBAL LOW_PRIORITY_UPDATES=1; +INSERT INTO t1 VALUES (5); +SELECT 'rl_contender', id FROM t2 WHERE id > 1; +SELECT RELEASE_LOCK('B26162'); +RELEASE_LOCK('B26162') +1 +rl_acquirer GET_LOCK('B26162',120) id +rl_acquirer 1 1 +SELECT RELEASE_LOCK('B26162'); +RELEASE_LOCK('B26162') +1 +rl_contender id +rl_contender 2 +DROP TRIGGER t1_test; +DROP TABLE t1,t2; +SET SESSION LOW_PRIORITY_UPDATES=DEFAULT; +SET GLOBAL LOW_PRIORITY_UPDATES=DEFAULT; End of 5.0 tests diff --git a/mysql-test/r/type_datetime.result b/mysql-test/r/type_datetime.result index ba02f19712a..9e47b5da2b6 100644 --- a/mysql-test/r/type_datetime.result +++ b/mysql-test/r/type_datetime.result @@ -411,3 +411,19 @@ if(@bug28261 = f1, '', @bug28261:= f1) 2001-01-01 2002-02-02 drop table t1; +create table t1(f1 datetime); +insert into t1 values('2001-01-01'),('2002-02-02'); +select * from t1 where f1 between 20020101 and 20070101000000; +f1 +2002-02-02 00:00:00 +select * from t1 where f1 between 2002010 and 20070101000000; +f1 +2001-01-01 00:00:00 +2002-02-02 00:00:00 +Warnings: +Warning 1292 Incorrect datetime value: '2002010' for column 'f1' at row 1 +select * from t1 where f1 between 20020101 and 2007010100000; +f1 +Warnings: +Warning 1292 Incorrect datetime value: '2007010100000' for column 'f1' at row 1 +drop table t1; diff --git a/mysql-test/r/type_decimal.result b/mysql-test/r/type_decimal.result index c9c42d18d68..3cf24529421 100644 --- a/mysql-test/r/type_decimal.result +++ b/mysql-test/r/type_decimal.result @@ -790,3 +790,12 @@ Warning 1292 Truncated incorrect datetime value: '0000-00-00' Warning 1292 Truncated incorrect datetime value: '0000-00-00' Warning 1292 Truncated incorrect datetime value: '0000-00-00' drop table t1; +CREATE TABLE t1 ( +qty decimal(16,6) default NULL, +dps tinyint(3) unsigned default NULL +); +INSERT INTO t1 VALUES (1.1325,3); +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; diff --git a/mysql-test/r/type_enum.result b/mysql-test/r/type_enum.result index 2683201e25e..f537b7140ba 100644 --- a/mysql-test/r/type_enum.result +++ b/mysql-test/r/type_enum.result @@ -1778,4 +1778,34 @@ drop table t1; create table t1(exhausting_charset enum('ABCDEFGHIJKLMNOPQRSTUVWXYZ','  !"','#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~','xx\','yy\€','zz‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ')); ERROR 42000: Field separator argument is not what is expected; check the manual +CREATE TABLE t1 ( +id INT AUTO_INCREMENT PRIMARY KEY, +c1 ENUM('a', '', 'b') +); +INSERT INTO t1 (c1) VALUES (0), ('a'), (''), ('b'); +Warnings: +Warning 1265 Data truncated for column 'c1' at row 1 +SELECT id, c1 + 0, c1 FROM t1; +id c1 + 0 c1 +1 0 +2 1 a +3 2 +4 3 b +ALTER TABLE t1 CHANGE c1 c1 ENUM('a', '') NOT NULL; +Warnings: +Warning 1265 Data truncated for column 'c1' at row 4 +SELECT id, c1 + 0, c1 FROM t1; +id c1 + 0 c1 +1 0 +2 1 a +3 2 +4 0 +DROP TABLE t1; End of 4.1 tests +create table t1(f1 set('a','b'), index(f1)); +insert into t1 values(''),(''),('a'),('b'); +select * from t1 where f1=''; +f1 + + +drop table t1; diff --git a/mysql-test/r/type_float.result b/mysql-test/r/type_float.result index 188963c5bdf..53844d2cfe2 100644 --- a/mysql-test/r/type_float.result +++ b/mysql-test/r/type_float.result @@ -344,3 +344,36 @@ create table t1 (s1 float(0,2)); ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column 's1'). create table t1 (s1 float(1,2)); ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column 's1'). +create table t1 (f1 double(200, 0)); +insert into t1 values (1e199), (-1e199); +insert into t1 values (1e200), (-1e200); +insert into t1 values (2e200), (-2e200); +Warnings: +Warning 1264 Out of range value adjusted for column 'f1' at row 1 +Warning 1264 Out of range value adjusted for column 'f1' at row 2 +select f1 + 0e0 from t1; +f1 + 0e0 +1e+199 +-1e+199 +1e+200 +-1e+200 +1e+200 +-1e+200 +drop table t1; +create table t1 (f1 float(30, 0)); +insert into t1 values (1e29), (-1e29); +insert into t1 values (1e30), (-1e30); +insert into t1 values (2e30), (-2e30); +Warnings: +Warning 1264 Out of range value adjusted for column 'f1' at row 1 +Warning 1264 Out of range value adjusted for column 'f1' at row 2 +select f1 + 0e0 from t1; +f1 + 0e0 +1.0000000150475e+29 +-1.0000000150475e+29 +1.0000000150475e+30 +-1.0000000150475e+30 +1.0000000150475e+30 +-1.0000000150475e+30 +drop table t1; +End of 5.0 tests diff --git a/mysql-test/r/type_newdecimal.result b/mysql-test/r/type_newdecimal.result index cbcab126439..75d9582a23c 100644 --- a/mysql-test/r/type_newdecimal.result +++ b/mysql-test/r/type_newdecimal.result @@ -1465,4 +1465,38 @@ Error 1264 Out of range value adjusted for column 'cast(a as DECIMAL(3,2))' at r Error 1264 Out of range value adjusted for column 'cast(a as DECIMAL(3,2))' at row 1 Error 1264 Out of range value adjusted for column 'cast(a as DECIMAL(3,2))' at row 1 Error 1264 Out of range value adjusted for column 'cast(a as DECIMAL(3,2))' at row 1 +create table t1 (s varchar(100)); +insert into t1 values (0.00000000010000000000000000364321973154977415791655470655996396089904010295867919921875); +drop table t1; +SELECT 1.000000000000 * 99.999999999998 / 100 a,1.000000000000 * (99.999999999998 / 100) b; +a b +0.9999999999999800000000000000 0.9999999999999800000000000000 +SELECT CAST(1 AS decimal(65,10)); +CAST(1 AS decimal(65,10)) +1.0000000000 +SELECT CAST(1 AS decimal(66,10)); +ERROR 42000: Too big precision 66 specified for column '1'. Maximum is 65. +SELECT CAST(1 AS decimal(65,30)); +CAST(1 AS decimal(65,30)) +1.000000000000000000000000000000 +SELECT CAST(1 AS decimal(65,31)); +ERROR 42000: Too big scale 31 specified for column '1'. Maximum is 30. +CREATE TABLE t1 (a int DEFAULT NULL, b int DEFAULT NULL); +INSERT INTO t1 VALUES (3,30), (1,10), (2,10); +SELECT a+CAST(1 AS decimal(65,30)) AS aa, SUM(b) FROM t1 GROUP BY aa; +aa SUM(b) +2.000000000000000000000000000000 10 +3.000000000000000000000000000000 10 +4.000000000000000000000000000000 30 +SELECT a+CAST(1 AS decimal(65,31)) AS aa, SUM(b) FROM t1 GROUP BY aa; +ERROR 42000: Too big scale 31 specified for column '1'. Maximum is 30. +DROP TABLE t1; +CREATE TABLE t1 (a int DEFAULT NULL, b int DEFAULT NULL); +INSERT INTO t1 VALUES (3,30), (1,10), (2,10); +SET @a= CAST(1 AS decimal); +SELECT 1 FROM t1 GROUP BY @b := @a, @b; +1 +1 +1 +DROP TABLE t1; End of 5.0 tests diff --git a/mysql-test/r/udf.result b/mysql-test/r/udf.result index 7c52e7da496..2e9cf217ed6 100644 --- a/mysql-test/r/udf.result +++ b/mysql-test/r/udf.result @@ -273,4 +273,27 @@ drop function f3; drop function metaphon; drop function myfunc_double; drop function myfunc_int; +CREATE FUNCTION metaphon RETURNS STRING SONAME "UDF_EXAMPLE_LIB"; +create table t1 (a char); +set GLOBAL query_cache_size=1355776; +reset query cache; +select metaphon('MySQL') from t1; +metaphon('MySQL') +show status like "Qcache_hits"; +Variable_name Value +Qcache_hits 0 +show status like "Qcache_queries_in_cache"; +Variable_name Value +Qcache_queries_in_cache 0 +select metaphon('MySQL') from t1; +metaphon('MySQL') +show status like "Qcache_hits"; +Variable_name Value +Qcache_hits 0 +show status like "Qcache_queries_in_cache"; +Variable_name Value +Qcache_queries_in_cache 0 +drop table t1; +drop function metaphon; +set GLOBAL query_cache_size=default; End of 5.0 tests. diff --git a/mysql-test/r/user_var.result b/mysql-test/r/user_var.result index 753c982155c..80b5dccc198 100644 --- a/mysql-test/r/user_var.result +++ b/mysql-test/r/user_var.result @@ -317,3 +317,39 @@ SHOW COUNT(*) WARNINGS; SHOW COUNT(*) ERRORS; @@session.error_count 1 +create table t1(f1 int, f2 varchar(2), f3 float, f4 decimal(2,1)); +insert into t1 values +(1, "a", 1.5, 1.6), (1, "a", 1.5, 1.6), (2, "b", 2.5, 2.6), +(3, "c", 3.5, 3.6), (4, "d", 4.5, 4.6), (1, "a", 1.5, 1.6), +(3, "c", 3.5, 3.6), (1, "a", 1.5, 1.6); +select @a:=f1, count(f1) from t1 group by 1 desc; +@a:=f1 count(f1) +4 1 +3 2 +2 1 +1 4 +select @a:=f1, count(f1) from t1 group by 1 asc; +@a:=f1 count(f1) +1 4 +2 1 +3 2 +4 1 +select @a:=f2, count(f2) from t1 group by 1 desc; +@a:=f2 count(f2) +d 1 +c 2 +b 1 +a 4 +select @a:=f3, count(f3) from t1 group by 1 desc; +@a:=f3 count(f3) +4.5 1 +3.5 2 +2.5 1 +1.5 4 +select @a:=f4, count(f4) from t1 group by 1 desc; +@a:=f4 count(f4) +4.6 1 +3.6 2 +2.6 1 +1.6 4 +drop table t1; diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index 8d9d802949d..c51a4c30960 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -23,6 +23,9 @@ c 5 6 11 +select is_updatable from information_schema.views where table_name='v1'; +is_updatable +NO create temporary table t1 (a int, b int); select * from t1; a b @@ -322,6 +325,12 @@ create table t1 (a int, b int, primary key(a)); insert into t1 values (10,2), (20,3), (30,4), (40,5), (50,10); create view v1 (a,c) as select a, b+1 from t1; create algorithm=temptable view v2 (a,c) as select a, b+1 from t1; +select is_updatable from information_schema.views where table_name='v2'; +is_updatable +NO +select is_updatable from information_schema.views where table_name='v1'; +is_updatable +YES update v1 set c=a+c; ERROR HY000: Column 'c' is not updatable update v2 set a=a+c; @@ -604,6 +613,10 @@ insert into t1 values(5,'Hello, world of views'); create view v1 as select * from t1; create view v2 as select * from v1; update v2 set col2='Hello, view world'; +select is_updatable from information_schema.views; +is_updatable +YES +YES select * from t1; col1 col2 5 Hello, view world @@ -1377,7 +1390,9 @@ test.t1 check status OK drop table t1; check table v1; Table Op Msg_type Msg_text -test.v1 check error View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +test.v1 check Error Table 'test.t1' doesn't exist +test.v1 check Error View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +test.v1 check error Corrupt drop view v1; create table t1 (a int); create table t2 (a int); @@ -1497,7 +1512,7 @@ insert into v3(b) values (10); insert into v3(a) select a from t2; insert into v3(b) select b from t2; Warnings: -Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'a' at row 2 +Warning 1048 Column 'a' cannot be null insert into v3(a) values (1) on duplicate key update a=a+10000+VALUES(a); select * from t1; a b @@ -1901,11 +1916,17 @@ CREATE VIEW v6 AS SELECT CONVERT_TZ(col1,'GMT','MET') FROM t2; DROP TABLE t1; CHECK TABLE v1, v2, v3, v4, v5, v6; Table Op Msg_type Msg_text -test.v1 check error View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +test.v1 check Error Table 'test.t1' doesn't exist +test.v1 check Error View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +test.v1 check error Corrupt test.v2 check status OK -test.v3 check error View 'test.v3' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +test.v3 check Error Table 'test.t1' doesn't exist +test.v3 check Error View 'test.v3' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +test.v3 check error Corrupt test.v4 check status OK -test.v5 check error View 'test.v5' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +test.v5 check Error Table 'test.t1' doesn't exist +test.v5 check Error View 'test.v5' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +test.v5 check error Corrupt test.v6 check status OK drop view v1, v2, v3, v4, v5, v6; drop table t2; @@ -1925,11 +1946,17 @@ CREATE VIEW v6 AS SELECT f2() FROM t3; drop function f1; CHECK TABLE v1, v2, v3, v4, v5, v6; Table Op Msg_type Msg_text -test.v1 check error View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +test.v1 check Error FUNCTION test.f1 does not exist +test.v1 check Error View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +test.v1 check error Corrupt test.v2 check status OK -test.v3 check error View 'test.v3' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +test.v3 check Error FUNCTION test.f1 does not exist +test.v3 check Error View 'test.v3' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +test.v3 check error Corrupt test.v4 check status OK -test.v5 check error View 'test.v5' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +test.v5 check Error FUNCTION test.f1 does not exist +test.v5 check Error View 'test.v5' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +test.v5 check error Corrupt test.v6 check status OK create function f1 () returns int return (select max(col1) from t1); DROP TABLE t1; @@ -2376,35 +2403,29 @@ CREATE TABLE t1(id INT); CREATE VIEW v1 AS SELECT id FROM t1; OPTIMIZE TABLE v1; Table Op Msg_type Msg_text -test.v1 optimize error 'test.v1' is not BASE TABLE -Warnings: -Error 1347 'test.v1' is not BASE TABLE +test.v1 optimize Error 'test.v1' is not BASE TABLE +test.v1 optimize error Corrupt ANALYZE TABLE v1; Table Op Msg_type Msg_text -test.v1 analyze error 'test.v1' is not BASE TABLE -Warnings: -Error 1347 'test.v1' is not BASE TABLE +test.v1 analyze Error 'test.v1' is not BASE TABLE +test.v1 analyze error Corrupt REPAIR TABLE v1; Table Op Msg_type Msg_text -test.v1 repair error 'test.v1' is not BASE TABLE -Warnings: -Error 1347 'test.v1' is not BASE TABLE +test.v1 repair Error 'test.v1' is not BASE TABLE +test.v1 repair error Corrupt DROP TABLE t1; OPTIMIZE TABLE v1; Table Op Msg_type Msg_text -test.v1 optimize error 'test.v1' is not BASE TABLE -Warnings: -Error 1347 'test.v1' is not BASE TABLE +test.v1 optimize Error 'test.v1' is not BASE TABLE +test.v1 optimize error Corrupt ANALYZE TABLE v1; Table Op Msg_type Msg_text -test.v1 analyze error 'test.v1' is not BASE TABLE -Warnings: -Error 1347 'test.v1' is not BASE TABLE +test.v1 analyze Error 'test.v1' is not BASE TABLE +test.v1 analyze error Corrupt REPAIR TABLE v1; Table Op Msg_type Msg_text -test.v1 repair error 'test.v1' is not BASE TABLE -Warnings: -Error 1347 'test.v1' is not BASE TABLE +test.v1 repair Error 'test.v1' is not BASE TABLE +test.v1 repair error Corrupt DROP VIEW v1; create definer = current_user() sql security invoker view v1 as select 1; show create view v1; @@ -2779,7 +2800,7 @@ CREATE TABLE t1 (i int, j int); CREATE VIEW v1 AS SELECT COALESCE(i,j) FROM t1; DESCRIBE v1; Field Type Null Key Default Extra -COALESCE(i,j) int(11) YES NULL +COALESCE(i,j) bigint(11) YES NULL CREATE TABLE t2 SELECT COALESCE(i,j) FROM t1; DESCRIBE t2; Field Type Null Key Default Extra @@ -3367,4 +3388,163 @@ SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(1.23456789 as decimal(8,0)) AS `col` DROP VIEW v1; +CREATE TABLE t1 (a INT); +CREATE TABLE t2 (b INT, c INT DEFAULT 0); +INSERT INTO t1 (a) VALUES (1), (2); +INSERT INTO t2 (b) VALUES (1), (2); +CREATE VIEW v1 AS SELECT t2.b,t2.c FROM t1, t2 +WHERE t1.a=t2.b AND t2.b < 3 WITH CHECK OPTION; +SELECT * FROM v1; +b c +1 0 +2 0 +UPDATE v1 SET c=1 WHERE b=1; +SELECT * FROM v1; +b c +1 1 +2 0 +DROP VIEW v1; +DROP TABLE t1,t2; +CREATE TABLE t1 (id int); +CREATE TABLE t2 (id int, c int DEFAULT 0); +INSERT INTO t1 (id) VALUES (1); +INSERT INTO t2 (id) VALUES (1); +CREATE VIEW v1 AS +SELECT t2.c FROM t1, t2 +WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION; +UPDATE v1 SET c=1; +DROP VIEW v1; +DROP TABLE t1,t2; +CREATE TABLE t1 (a1 INT, c INT DEFAULT 0); +CREATE TABLE t2 (a2 INT); +CREATE TABLE t3 (a3 INT); +CREATE TABLE t4 (a4 INT); +INSERT INTO t1 (a1) VALUES (1),(2); +INSERT INTO t2 (a2) VALUES (1),(2); +INSERT INTO t3 (a3) VALUES (1),(2); +INSERT INTO t4 (a4) VALUES (1),(2); +CREATE VIEW v1 AS +SELECT t1.a1, t1.c FROM t1 JOIN t2 ON t1.a1=t2.a2 AND t1.c < 3 +WITH CHECK OPTION; +SELECT * FROM v1; +a1 c +1 0 +2 0 +UPDATE v1 SET c=3; +ERROR HY000: CHECK OPTION failed 'test.v1' +PREPARE t FROM 'UPDATE v1 SET c=3'; +EXECUTE t; +ERROR HY000: CHECK OPTION failed 'test.v1' +EXECUTE t; +ERROR HY000: CHECK OPTION failed 'test.v1' +INSERT INTO v1(a1, c) VALUES (3, 3); +ERROR HY000: CHECK OPTION failed 'test.v1' +UPDATE v1 SET c=1 WHERE a1=1; +SELECT * FROM v1; +a1 c +1 1 +2 0 +SELECT * FROM t1; +a1 c +1 1 +2 0 +CREATE VIEW v2 AS SELECT t1.a1, t1.c +FROM (t1 JOIN t2 ON t1.a1=t2.a2 AND t1.c < 3) +JOIN (t3 JOIN t4 ON t3.a3=t4.a4) +ON t2.a2=t3.a3 WITH CHECK OPTION; +SELECT * FROM v2; +a1 c +1 1 +2 0 +UPDATE v2 SET c=3; +ERROR HY000: CHECK OPTION failed 'test.v2' +PREPARE t FROM 'UPDATE v2 SET c=3'; +EXECUTE t; +ERROR HY000: CHECK OPTION failed 'test.v2' +EXECUTE t; +ERROR HY000: CHECK OPTION failed 'test.v2' +INSERT INTO v2(a1, c) VALUES (3, 3); +ERROR HY000: CHECK OPTION failed 'test.v2' +UPDATE v2 SET c=2 WHERE a1=1; +SELECT * FROM v2; +a1 c +1 2 +2 0 +SELECT * FROM t1; +a1 c +1 2 +2 0 +DROP VIEW v1,v2; +DROP TABLE t1,t2,t3,t4; +CREATE TABLE t1 (a int, b int); +INSERT INTO t1 VALUES (1,2), (2,2), (1,3), (1,2); +CREATE VIEW v1 AS SELECT a, b+1 as b FROM t1; +SELECT b, SUM(a) FROM v1 WHERE b=3 GROUP BY b; +b SUM(a) +3 4 +EXPLAIN SELECT b, SUM(a) FROM v1 WHERE b=3 GROUP BY b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where +SELECT a, SUM(b) FROM v1 WHERE b=3 GROUP BY a; +a SUM(b) +1 6 +2 3 +EXPLAIN SELECT a, SUM(b) FROM v1 WHERE b=3 GROUP BY a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where; Using temporary; Using filesort +SELECT a, SUM(b) FROM v1 WHERE a=1 GROUP BY a; +a SUM(b) +1 10 +EXPLAIN SELECT a, SUM(b) FROM v1 WHERE a=1 GROUP BY a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where +DROP VIEW v1; +DROP TABLE t1; +CREATE TABLE t1 ( +person_id int NOT NULL PRIMARY KEY, +username varchar(40) default NULL, +status_flg char(1) NOT NULL default 'A' +); +CREATE TABLE t2 ( +person_role_id int NOT NULL auto_increment PRIMARY KEY, +role_id int NOT NULL, +person_id int NOT NULL, +INDEX idx_person_id (person_id), +INDEX idx_role_id (role_id) +); +CREATE TABLE t3 ( +role_id int NOT NULL auto_increment PRIMARY KEY, +role_name varchar(100) default NULL, +app_name varchar(40) NOT NULL, +INDEX idx_app_name(app_name) +); +CREATE VIEW v1 AS +SELECT profile.person_id AS person_id +FROM t1 profile, t2 userrole, t3 role +WHERE userrole.person_id = profile.person_id AND +role.role_id = userrole.role_id AND +profile.status_flg = 'A' + ORDER BY profile.person_id,role.app_name,role.role_name; +INSERT INTO t1 VALUES +(6,'Sw','A'), (-1136332546,'ols','e'), (0,' *\n','0'), +(-717462680,'ENTS Ta','0'), (-904346964,'ndard SQL\n','0'); +INSERT INTO t2 VALUES +(1,3,6),(2,4,7),(3,5,8),(4,6,9),(5,1,6),(6,1,7),(7,1,8),(8,1,9),(9,1,10); +INSERT INTO t3 VALUES +(1,'NUCANS_APP_USER','NUCANSAPP'),(2,'NUCANS_TRGAPP_USER','NUCANSAPP'), +(3,'IA_INTAKE_COORDINATOR','IACANS'),(4,'IA_SCREENER','IACANS'), +(5,'IA_SUPERVISOR','IACANS'),(6,'IA_READONLY','IACANS'), +(7,'SOC_USER','SOCCANS'),(8,'CAYIT_USER','CAYITCANS'), +(9,'RTOS_DCFSPOS_SUPERVISOR','RTOS'); +EXPLAIN SELECT t.person_id AS a, t.person_id AS b FROM v1 t WHERE t.person_id=6; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE profile const PRIMARY PRIMARY 4 const 1 Using temporary; Using filesort +1 SIMPLE userrole ref idx_person_id,idx_role_id idx_person_id 4 const 2 +1 SIMPLE role eq_ref PRIMARY PRIMARY 4 test.userrole.role_id 1 +SELECT t.person_id AS a, t.person_id AS b FROM v1 t WHERE t.person_id=6; +a b +6 6 +6 6 +DROP VIEW v1; +DROP TABLE t1,t2,t3; End of 5.0 tests. diff --git a/mysql-test/r/view_grant.result b/mysql-test/r/view_grant.result index 32dffa305e5..0f9ce47dec6 100644 --- a/mysql-test/r/view_grant.result +++ b/mysql-test/r/view_grant.result @@ -601,9 +601,9 @@ Warnings: Note 1449 There is no 'no-such-user'@'localhost' registered SHOW CREATE VIEW v; View Create View -v CREATE ALGORITHM=UNDEFINED DEFINER=`no-such-user`@`localhost` SQL SECURITY DEFINER VIEW `v` AS select `t1`.`a` AS `a` from `t1` +v CREATE ALGORITHM=UNDEFINED DEFINER=`no-such-user`@`localhost` SQL SECURITY DEFINER VIEW `v` AS select `test`.`t1`.`a` AS `a` from `t1` Warnings: -Note 1449 There is no 'no-such-user'@'localhost' registered +Warning 1356 View 'test.v' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them SELECT * FROM v; ERROR HY000: There is no 'no-such-user'@'localhost' registered DROP VIEW v; diff --git a/mysql-test/r/warnings.result b/mysql-test/r/warnings.result index d0ad4ca6648..9ce1f9c825d 100644 --- a/mysql-test/r/warnings.result +++ b/mysql-test/r/warnings.result @@ -86,7 +86,7 @@ drop table t1; create table t1(a tinyint NOT NULL, b tinyint unsigned, c char(5)); insert into t1 values(NULL,100,'mysql'),(10,-1,'mysql ab'),(500,256,'open source'),(20,NULL,'test'); Warnings: -Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'a' at row 1 +Warning 1048 Column 'a' cannot be null Warning 1264 Out of range value adjusted for column 'b' at row 2 Warning 1265 Data truncated for column 'c' at row 2 Warning 1264 Out of range value adjusted for column 'a' at row 3 @@ -99,7 +99,7 @@ Warning 1265 Data truncated for column 'c' at row 2 alter table t1 add d char(2); update t1 set a=NULL where a=10; Warnings: -Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'a' at row 2 +Warning 1048 Column 'a' cannot be null update t1 set c='mysql ab' where c='test'; Warnings: Warning 1265 Data truncated for column 'c' at row 4 @@ -115,7 +115,7 @@ Warnings: Warning 1265 Data truncated for column 'b' at row 1 Warning 1265 Data truncated for column 'b' at row 2 Warning 1265 Data truncated for column 'b' at row 3 -Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'a' at row 4 +Warning 1048 Column 'a' cannot be null Warning 1265 Data truncated for column 'b' at row 4 insert into t2(b) values('mysqlab'); Warnings: diff --git a/mysql-test/r/windows_shm.result b/mysql-test/r/windows_shm.result new file mode 100644 index 00000000000..c60049bece8 --- /dev/null +++ b/mysql-test/r/windows_shm.result @@ -0,0 +1,2 @@ +mysqld is alive +End of 5.0 tests. diff --git a/mysql-test/std_data/Index.xml b/mysql-test/std_data/Index.xml new file mode 100644 index 00000000000..988dddcc68a --- /dev/null +++ b/mysql-test/std_data/Index.xml @@ -0,0 +1,71 @@ + + + + + + a + b + + + + + + + + + a + b + + + + + + A +

\u0103

\u0102 + \u1EB1\u1EB0 + \u1EB3\u1EB2 + \u1EB5\u1EB4 + \u1EAF\u1EAE + \u1EB7\u1EB6 +

\u00E2

\u00C2 + \u1EA7\u1EA6 + \u1EA9\u1EA8 + \u1EAB\u1EAA + \u1EA5\u1EA4 + \u1EAD\u1EAC + D +

\u0111

\u0110 + E +

\u00EA

\u00CA + \u1EC1\u1EC0 + \u1EC3\u1EC2 + \u1EC5\u1EC4 + \u1EBF\u1EBE + \u1EC7\u1EC6 + O +

\u00F4

\u00D4 + \u1ED3\u1ED2 + \u1ED5\u1ED4 + \u1ED7\u1ED6 + \u1ED1\u1ED0 + \u1ED9\u1ED8 +

\u01A1

\u01A0 + \u1EDD\u1EDC + \u1EDF\u1EDE + \u1EE1\u1EE0 + \u1EDB\u1EDA + \u1EE3\u1EE2 + U +

\u01B0

\u01AF + \u1EEB\u1EEA + \u1EED\u1EEC + \u1EEF\u1EEE + \u1EE9\u1EE8 + \u1EF1\u1EF0 +
+ +
+ +
+ +
diff --git a/mysql-test/suite/large_tests/README.TXT b/mysql-test/suite/large_tests/README.TXT new file mode 100644 index 00000000000..51cd4e41a40 --- /dev/null +++ b/mysql-test/suite/large_tests/README.TXT @@ -0,0 +1,13 @@ +large_test suite +================ + +Iggy Galarza 07/20/07 +--------------------- + +This test suite should include any test that requires: +1. Longer than the default timeout to complete. +2. A considerable amount of disk space. + +These tests can be completed with the following command: + +mysql-test-run.pl --suite=large_tests --big-test --suite-timeout=6360 --testcase-timeout=795 diff --git a/mysql-test/suite/large_tests/r/alter_table.result b/mysql-test/suite/large_tests/r/alter_table.result new file mode 100644 index 00000000000..921711e9812 --- /dev/null +++ b/mysql-test/suite/large_tests/r/alter_table.result @@ -0,0 +1,37 @@ +drop table if exists t1; +create table `t1` (`c1` tinyint unsigned not null, key `c1` (`c1`)) +engine=myisam default charset=utf8; +alter table `t1` disable keys; +insert into t1 values (1),(2),(3),(4); +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1 limit 2147483647; +alter table t1 enable keys; +drop table t1; diff --git a/mysql-test/suite/large_tests/t/alter_table.test b/mysql-test/suite/large_tests/t/alter_table.test new file mode 100644 index 00000000000..61f0b34d904 --- /dev/null +++ b/mysql-test/suite/large_tests/t/alter_table.test @@ -0,0 +1,47 @@ +# The test for bug#27029 requires about 8 hours and 20 minutes on my +# fastest machine. This test requires at least 60 GB of disk space. +--source include/big_test.inc + +# +# Bug#27029 alter table ... enable keys crashes mysqld on large table +# +--disable_warnings +drop table if exists t1; +--enable_warnings + +create table `t1` (`c1` tinyint unsigned not null, key `c1` (`c1`)) +engine=myisam default charset=utf8; +alter table `t1` disable keys; +insert into t1 values (1),(2),(3),(4); +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1 limit 2147483647; #Insert 4294967295 rows. +alter table t1 enable keys; +drop table t1; diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test index 83686f31e9e..3ced1087757 100644 --- a/mysql-test/t/alter_table.test +++ b/mysql-test/t/alter_table.test @@ -662,3 +662,25 @@ insert into t1 values (null); select * from t1; drop table t1; + +# +# Bug#27507: Wrong DATETIME value was allowed by ALTER TABLE in the +# NO_ZERO_DATE mode. +# +set @orig_sql_mode = @@sql_mode; +set sql_mode="no_zero_date"; +create table t1(f1 int); +alter table t1 add column f2 datetime not null, add column f21 date not null; +insert into t1 values(1,'2000-01-01','2000-01-01'); +--error 1292 +alter table t1 add column f3 datetime not null; +--error 1292 +alter table t1 add column f3 date not null; +--error 1292 +alter table t1 add column f4 datetime not null default '2002-02-02', + add column f41 date not null; +alter table t1 add column f4 datetime not null default '2002-02-02', + add column f41 date not null default '2002-02-02'; +select * from t1; +drop table t1; +set sql_mode= @orig_sql_mode; diff --git a/mysql-test/t/archive-big.test b/mysql-test/t/archive-big.test new file mode 100644 index 00000000000..414b689b180 --- /dev/null +++ b/mysql-test/t/archive-big.test @@ -0,0 +1,25 @@ +--source include/big_test.inc +--source include/have_archive.inc +CREATE TABLE t1(a BLOB) ENGINE=ARCHIVE; +--disable_query_log +INSERT INTO t1 VALUES('gt:Y;V(Wh/DM;z\'@Scyb^2u*b:8GBTan./A;D(7x(PB98IL%ipw0x=^H,>8=i%m\'heEdN:pR*o%Ywtf&x]H2[]Ex\\Bn1>\'EhfGmw56OpkO(n$VpXE2d.M#Z*XevKM$`Er;euB&2e3d-HdFlw;RobzhxMQ3EFn&aCf`5y79V/\"UmMt-t36S(aAY&Ekt.w@m4Q!G,@@]?\\:D.R;j1Kj[j*&\"n8cq6Me>@fgW_Wx$821=#0fAM@75D7\'Wi2T8W32B96C2kQ5MiO2C>NP-(!fms!;I?Biu7F?G*6o[Z54D?LCJ/H\\#+M,-;$?Rd\'-Ii`+GfW_\\5-zRc\'.M%dV`dYpOv2,\"`L;\"3u(Xk9pU8Ry79Z?fo\"K=-b7#FxX0!OS6Oma\"uZ@m1C?Q]c\\*P=z\")Hq/(xSsrd\"j&n(m{J9x#4y:KM%cSV7LZft=gzUtse$tM`#zsV35Oqsrf,=0u-q#H-@=Qc(1\\ddM6`gke>>^F{fmt(Zuey[9G=;O_tRx1zH2[Z9E5rjDL8j<)RIVX<\\Bq@\'<cbFq2;qS+q*lprp_gnv/t0$`Ep4HP>$4w-iWW35Lc7{8zxpK`+KyLKs.{Si>3#PR.,.@>Uqd%zj(wRpe,@Cm)q4D<>caAZ+[qQy9HCT_e_3sy0qw,b6#Fz`QT7Qv+a4v\'N;xxudtC+FcJ%p9``Cjt0)vJKt7JO5T10<\"-\\qK_#&2iIke<7?tY@m4Os$H((0TC/[did@K<)TU0)vJJq(eO;uj6aq>u_Z*Yi+1S6Pqo`qA*Fg\\u`_ChmkXU&SU8Pod.M{Q[[:LR=rR&\\)L.;\"1l\\i\"Z0u1)s;a_>Q^k&js+lkYY7B*FbEkr&U`hljR9cp01GUYAtRw/qz8>m:k=)M3Oy>`OMr\"Bju6A\'<:LUKWV.yJ>9Axft@va`Be\\#,RC5#EwV)]&<@gr-zQavV-ox56L_!wh&uM\\k,0Ia7\'YrYI?>W&N<{)L*).JmlZ]H0S9[I9!5)i`,N.7d\"m/:r\\UutlDH#hp!F#rIO4Q&\\*TNiO-0GWeyY/v59``ChiYbf]#,O6W8Ayk1EN;xwpQ$Vi9unNu-q#I1Q/1HZoHRGL+,<-gL\'p1;pQ\"MERQ#OO{J<-fFh^%2kP08h2T:\\LDQNpty*V\\NO(lu1(o+xMS=qMhL\"Y\'K-9tlDJ,8q`it4:g%q=sW8KWU,mng:)Yl=#3sz3\"MFWexSpauQod-G_4z;KL{Sg4c$xb`B`Dp6OpnZU$Er;er8T(^.`(:/u33ECbL5`hq%S[TsmLmkUGARYNXV*b>I:#G.Ii\\rPs\"0omXQkN&gb8+i[n@.`\'5qjERPy>Y.oty.iSD;:M[ccM6`kyI8z.gIq,vAv[Cx`Y!-\\oEDeV`dXk:uj8lFTX@qGJzW#;D(7x)UX?m2FM6][4.*%tJR@+O5T0.5_e`81./?4%Ywtcp6NjUIK\"\\512I[qOrw\'N9oOyAk%gb;:PiF]*M-3XJJp&Yxvl=&B\\0qtx(K)&#tU*hX`]4(eRHTQv,fK%l$]6/*!bYwqU5A.[j++4d*:\'OA7.yMMyI8x%>LG]\'ASczfo!G*8x&CcRPw44D>J=0s\'Wh0H`2n`uSz8@v^Sd%{n\'AWupW@v`\\/jWRv)WexSrjCK1LosuwvpS-zRf3^hu:X309h1O#WrcxX0yG0S:bf\\zyucn(jmiKs1/4YLP/4W@wcheFid=Ak&hiZft?qIRD=Cxa[*SJ[k3S.&n+zVz1t)]\'ATe(.Kq$QQ)n#PS5GJzW$Be[vi2R-$ggUS$NFPGO(Eg]#)BVmKfK#cUajs+kfBRZO[aZ$95?yqPu)\\#/`%)@G*7rh6h7oU;`]611A71-/CGwQjIj`)=>\\=X-j^tW4:euD-O1A6*h[mUsmKjZdmw9KQ9aggO7_`G!fjfFcGtAzoD>I9z0ne5mR3A2og<0v6=pIVX=_QU\'D`A^=P`rGEdO>(HvE1_sL]pD?OR3?)IvC&.R>xm?.c4n]c_5\'[%81)t@ym9C(9)[woJ_%1e5mT=m;rZJCPMornXKP3IXdp.(wTv#:?l.4\\Z2&cL0I_+N.8k@738`cRP{G+<0t+i\\oB7,r+mt&M=)N4V^H+:&J)\'\'-N&inm\\dfV]Re+>7;`Y#7-xH:(RPu.q\"DsC1f;-j[j-5`m-+/JlfAJ6h6kESR(fUU23FJ%m)tA#%.VMa*@F&#w_Xxz$5z9C+E\\*REB\\.fGjhM(vMWQpjCL9r`ggVW7GCXsctG@I2ZW)[uez]Cn1?*M1EL1I`.Zdls%PJb7&QOx:Oa$%*D\\)L.;{,YfvG<3*s8S\"Co4HTNjReh_)CWqZP_rGFjiVPna{l2HXdr8U-w@m5S,vAtS#I-BG$o8_\\63;mA6)dK+,>4)lptvwxwoLgIq-zP^hvAw^Q[Y0zH4c&&,Jt6GCZ#3w1#Ui;&Em{J;&I&vSv&GyY0xAm.5]\\-]wh)%xb_;D&*?CrB,N-1Kka*@F#o;j6am)uB&0[fo&^5&XpU7Nd6w\'I%r?zu^Y\'M6`jwAp?&8*b@R`l+\"da;=_NG[vh+3\\_I3YRmVE7#Ciq&Xr]Z0u1(lx=^I1S9^TkGXi0I`2lYW,i[j-7h7oV>n=yyueyW(Xi2R-#dYqW?n8cr>pHSK[l7cuLUHK\"\\9B#{u]Q^gnv1$[*SNkY[BsIO2EJ*)1XRpd+;.nlYU$FzbYvoNqw,a5w*]{{{\"$-WT%RS/-0JhTMb/XT#Fy[;QiEVez`OKiVRx1{I8vulDFs>qK^{vbgb<qJX^Sg3_j!Vsh3[Y0w;Sv&GxQiBJ3WF7z63;nFN7csC-SC5x1x)L-7kA@Z-gM++3]edK,4^edJ$jyH7rh8raq:clw9M\\i&o.-5c!izRe0SQavV*eK%n+{]@aQR*q,xH<2#Te)2\\aUd#o:h,4`p(J%m)q4D=E&*<3-#d[z\")Hp+r13LhN+($uT%OH\\vf\"bXoP#QXICUf((2`vW0#Z+[rT*mqssj>/l`{qISJWY@l-2Q+u>l4S.%hi\\pHQA2pkMx@m3J`,O2DCeYoIZk6_cYqU7M_{rQu)[uduHBQT4C:47W7HFeUV6F@LCJ.?60/7g.BH&x]F*7rj=/mc/TC2kQ4K_#(==Y1\"R_k\"X$?Q_n2B::Su#>P\\_NGXg\'!i\"[0t,nsw\'J*,=4*q,wF1^o:j3R01EI%o4IXbgc@NKj^yk3Ow7B*GgYg#hp#L?5+q,vC\"wdks([z#/_yl6][64@*L*\'$yen\"MFTXC%\'6uz,^\"{yoHRHQC95;h\'zaWq[TqbwX1&eXg%sHGkjY^QYNZ_QWF8$FuKO/6_d_1kVL[guAxeo)knkS=qNl^rIRB5#G&#v\\J=0qx0s&T\\TnVC.UJQ;pPv2)r6KZg{Z1\"OQ,#aPMnjLv<]I7mO\"QYN[dg]ysYC\"tS%S[Qd-HfO:oMnkQ1=TrkFWcq8V2/7ctG@J7oWF8\">Vx\'Fp/.9oS/-2Q,ySlO&fZnDB_?X(O@3u*`1jO,)(*:*]$1gBL:y(Gp,wIAI0KorsnP)lu/xArFBVmKgM,/GYm@3w0yF*8y-d>DwW-r(^/gDZy\"*L+*0P+yUw%AY%Cf]%6\"Bjt38\\NR6R!Co3FJ%o2@.^zqMfBRZO[aYz%:7D4qlMt/\"Wwy\".`&3jIke=(Go(g]\"$-TJRD;<[:E2b(4kN{OS6Pt#AaOCDks(^/e<7>n@-Ydkr\"Bir+ox6:]PYQh?=TpasE;8D0`yh{[50/;z\'DaGwQg<0v3/2KhP6ZKF]+P.fBR[Trh8rcwU%L7j>0olVGAONw;V(YnEK+.DPI]{yt\\P[Z7>oC:8IL\'o,$gja*FbCbL3XG:+eGp(ha0a(7x,a0c-Jt39cp16]X%GwQiDT]X&H!aTal%`AaM<&@UmMr$J3YO_sMa(9+dFhc<;SrlLoqpbzdh`-R@)Ho$VlCFtD0_sOjQ5Nnf8z2zCsGD^3x56OkXV+fO7aip\"Ex\\Bm-.>1t(Wg(%zl1FN9oNrz:E0[aWr`hkhIoz?`NFSPw56PplQ05WB!sU-u8Og?@d^0iM\'n&cL2P$Wsf\'&\'1^n6XByk/>/iP3IZk3T4C91*zW&M9oQ)jhQ;l?-^zsU.#]8;]KAAcWh.@;G6ri;%@UpZRjHa80&f\\z{\"(BTd\"j&m$[,_(<8F:-ortrd\"l+(\'\'0Z[=Z67R!Bit6C2iJnsy0t)_/b-N+%rB-R@*K#aK6d#qC7&SXB\"wclv6?vbhfM/;z)K&p4HSIVW48[I=4+u?m6[Qax^ONw;V(Zvj6`l\'ku0%dU^Z.jY`Z&B^;F2c\'0ZZ;Ttwy#0f@EzaZ{*N6ZJCRT5EAR\\]@bUcuIGh]xj2Nu/{OS9[H4e.Lv<]I6jBFvMWQqlN#UnP\'eTT/\'o,#cXmEL1Jb9.s/%bN@4\"G)0T>u_\\3&\\*RFJ#bUbn-)&\"p?\'@OP)q/,/FV`dZt`f_1jR:fyUy0omZY406ZNWOb*?@d_3v+b;:PiEXmEJ(\"k(uJIq(dL.=-b5v&GuG=;MXU\'Xk=\'Ejmg@F$rFATe(,DVdz^H-BH\'&&+CUf)/N%cOC?R`q?yu__?Z/prqbwW.t22A3u\'RQ$R[W\'PDEm#R_k$^=Rd,@Biq%UcuJL\"[0t+gSIRFFkoqnVB(;42?\'@PWF8&OB;C\"v\\LFWg+5d)1\\bZ#5&Vg.CI+5e.HdEf\\xqPu-nof6nU>qJX`[,`,O2EGuE1^qD9/\"Vq_gljR;l=$7,nt%I)*8z2v.t1+$m*wNXRstnO!LETW?n8bl$[-c9,liM&kt0&hgN3LgKzRe.Kpy;LS>ucn(knlWN^tU+i^\"\"!!!\"$/^rMd8%L5]_F$rGFjgM)z^I.H`3u$BbRP\"J8sh6g4`q?!#)EbGwO`w\\G0R8W9PlTA&5u#=NQ2?,X_Wsh2T9]NN{NMu5=qMgJt8Ne7x*Xcm\"OS4DcaA\\3#NH\\yvexTtvtg+5g6lKmiM$_Cinqqg3_m0;xwnIYh))/Q4HP>$5z:F4lR4GN3Q\'cK.<\'J%p7U0+&uM^qFDaCdYmDFo*u?nDzhzRh;)TV5A+O3LhM*%rC3mZZ8E3lS8ZCygt>k.8nP\"PVA\"zqNma#zn>&>I9z.gGh_\':1%bK/CI*,ACl#Xz+UU0(r7Rz=Tri=-eD].d:.r(]+TNjQ8[MN$\\1t\'U_`H&{k,/CJ,7oWE4kO)q3@*K#`I,:#:?j\'tD2hDT^^Bgjc6w(PEGt=j*\'&\'1^p?$2lVJO2GRKa,KzSh;)SNng?>X+`0c1^l0?1ohADsD5u\"6-yNS9_[0omYU#Bgi]u]OUA\'6x.k`{rMe;2*vE1_sL^wes8T\'Zyxtaipx2&aCe[xrWW%I&vV(Zvj5^bWk<%>MKnrrmLpy529h/EQMk\\i$hmne4i@>Usj@9>j(xTy0ptw$;BvY9LWU)b>K@>W%Fs?u]OTW#8=h$hkf@I3]da@Ti<*XclzG.JnqrmNw;Sw\'N:r^_DsC/\\hxLLwAuT#G\'%$#!xj/BCdYpOt)\\\"+O4S+q,wC\'/XSy3&`?TkGZrV6HJyOXOe5nVE5soZRjF\\&:8GAOLorrh8tmJc>Dx`Tf,;*Zm=%<@n5QzAjzOVF:.q\"Ey`QUn9i1Lnof4d,CMA9<`VmH\\zyubhi[i&sC0]n:j4[V#=P\\bYws]Y*ZoIYg{]@cZxvi/CI(%yfq-#aNA98L\\k0A:=b_;C#yl4R)ls#FxY1$\\0qtx%?PWG?DxZ9KM)vIGeQD>LG^)JyQazi$feK&r=pHRGJ$ip#K7nP$Xx{)Ht=h\"`L9pYLP/7bsB*GjhN/8lDH\"da=H4g5kESV:V.u5?zvf\"d_4{?aPKgL(xUz613J_(=@eeO9l?1rv%En*s9U+h[k4WAwbbL6`l%dV_^>TqatKR?$0e9)Yl?.c3mWKQ7[NR4IVX9PjKr,p%Vi7kCH#j!Up\\Z54D;=]E\"on=!(EeUZF.N%dU]W!3{DwW/xAqB0c/TD7&PKeAR[V#?X&J(&$\"wep/+,:\"4\"I3ZV%K3XG=9E1c*;0v46S&WlDGuE5pd)4g7rf,?=Qe0S.b4pd,AEtHFfUW;W/{NO(kqy3*s6JTJVW34Lc5sq`m,\'y`Tap9]Q_j\"Y)SNl^sOiM$`G\"glnhCPLjX\\H2\\_K;%BaI*/Mw?i\"[2#R]aPNu1(n%]1s\"=Qb%\"wchc=An5Pw2*vD.S=sYC\"sOl\\fmw43D=G.Jnsy/l_yi&o2?+RFFjmg@Cn1j*\'$yh$ebhyOYU%L8mH\\wi.@89S{>V{4)g\\t\\OXMZ_Tf,=4*p\'cJ*+7tmLnm[aZ!+UPqrjA@]:D*AK:xz&=F,BK4_iv?l1B>LJkd7#AaM>.e@K;%AZ-c8+hVX9Of:*^*K\"\\8;`Xy\'DdTT/)wO`xceUX?k,.?76E?J:$=KEXoNqtx&CaFvMWQph=2#S^edJ#d\\&;=\\Ahr,u:W1*xO[_ONx@j!Vvxz&:8JM)wN]k,+5e-DQOw9IGh\\rR#NEPGRGP=z\")EbFs>qK[m8h.AChlhKxF/Q4Ka/XY9JL$e[yxrV8Nb,Js0*{`NDH$n0;vl?1okN#Z*UY@n7[LMzLHcAWrcvRn\\aWmGWcm$Y$=H8x(K-7kAA^>W#=LKs0(r:_Xx$833HQD@R`n0;uk;x{\'ATe)2[^K:!1ppc%{pB7(_2pmT;g\"bUais-v=caA]:D*=;NZ^K>3#PT7NiLzOU@!xm?,Ydo(jiSE?LCI+5h9y)O:oLiVQrtp[Sqd%!qGJ\"`H*0R6R$NFSQz@fi`*EbDe[xqT-yNT>rS%Vg.CI((-HgW\\NN\"R`m.2Nu/zMIiZg\"`J3ZSqh9wz&?OP+zW$A_BggSHP`QS28bl\"RasHEcHyW(TZH<2$Y\"3x7\",UOl[`Td{ejiQ8afa6&RV=fs7L\\pEATi:z,Ydq15W>l1EL/DH#l&jqz;NWNb*>:F4lR3EBZ&En$Y!/e>@c\\)IzVy,_)BVi:wwtctD2f:)Yk6an/3Q(fZnA7/%bOCCbM9oT2:i/CH$o5Q!F\'(3e/R7U.\"Y(QFL,3ZRnZX.s)cDeV_]89W34GL.;#6)fUS&WoNs(Zvh/DK1Mt.t4j)z_K9uqZP^m/:r\\W%H\"glmb(7x,a2kQ3D@R_k$`Er;fxNZ]G-BJ/Ib931:nJb8+gTMc6uw\"1ne4h<.lc1_rHJyP_p_K;$>MLt0)tB%-R>xnB:=_PQ+wKHgW]Q[X.s)aK@?\\:D,KxF1YX2+xNWOc.R8]Sf2ZV$FwQkP+!^Co4IUU,r-xF1[aVlBBdXl=\'Eg`2kS>sW;Y6D{k*&ycbFr7Pruy(J#d^0iM$`Do1;pR(fXdr9[G1ZW-ot{5.#_Dn-)%vX6=m:qU5FBWr^bVdwQjLu7E9/w?j$dXlA7/&jr(^0jP1=%+TQu\'SR)kk[emx:N^o?&8,mpmT?wetB%,N--<*V[I;+b6#EvQmXPe7tsf*3_m/8kA;D*;1zH2ZW)^+N3Mlc-Jr-xF/TA*GjfHlrz8;a\\.d;417bn*wLQ5NkYZ>aTcvOb)9\'ST.$e](ATf+;*Xg&vT\"?X)Xi-:z*SK]sU.\"Y%Elw;Su{2u+dC[-_\':0zK@=Rg7re)0WKQ;mA5%T`jt4_MA=MQ07`hov+cAS`l(o,#dZxrZJDUakyE)5o]aTam*xPb%$$)?Ezfp(dO?*P=!&:6?vbild6trd$vX44JYgzX(SR%YvqW?pD;=\\@dbC`BcU__Dn.-9r`ju7GCZ#4z;O`w\\F*:\'O?0jTE=An3FL/A>P\\`PNx>aXr]Z.nlWN_wbaFtE3hCNCCfa90%bN<\"-]tV34K`+Jv?o>z{#+K$cWf\'\"o:i1KhSHO4S.%fb?LCL5`n/3P#Saq[:JJp&[\'CaGwRlP,$ir(bC`Be])Hr4B2m[`Uf,<,b6z8>k0B@X%B`Ckw<[?bZy{&8.xD%\'0\\hvC&-M%dVco17cq:_[.iUKVRx1zG-EVdyZ9D2d.N\'m$Y\"3x7>oD=D#tS!AgliQ8]TjEQKb3n_m2CAZ,_)D\\*SLc4nZW*_.\\n=\")FjiSFD^85@%1gBNCCgc@Q[W*]&8+gRFGr3?&;7D3lVF<7@xi*)0Q3D@Sd$vZ?gp&Z\"-]sT*je>?bYtg)-DSYI?Ae`81*z\\>Y.pty,^#)AQVA$&4n]flojKt23HUU.yLHdHuC*?Cp:fyW&L6e$uT%OGV_\\4)ieAOP%[*UV4:euE3jIi[j0A;IDVg,9{0nhBL:y%95;h\'yaWpV>j+*2YSqh:$>P\\aVh4^efQB7,nt%H\'!k){aRXIAI/Ha945Le==X,gO7^\\513LjVPm^j\'p3A3v*\\yt]Up]`PLk^sRz>[67OjQ7X@qFDbHz^Cr?yrR#MEM:th0Ib<@j!Wy+Xclx@k(r8V33HSK^xl6^aNDH!bVg+7re\'\'-Jp%Vi7j=-b3n^i!Vx#70(s;dm{I7rd\"k(tC-R>xnBj(xW(YnEK**3_l.1Nu0&eWcp03P!J9wxz&<=^J5e*8w\"3v-j_yn>\'@R_it5>wh*-AEr=m>&>H3_l*$m--;\"3x8B%.UL[gvG:*^)D_9;X44GM0A=LIhYdo*q-zSjDQNpro[W(TYG5o[Y0w=^I3[Z53?(BXx\"-\\pFFkqw,d?J;\'L0EN;wtajv8HHnzBp8^Y\'I&vStw!/gGeQFGq/.5`m*{]>Z1zI5g4d*:\'M6cvQjMyG3ayfp(g\\vfz[8@wep/-2Q,zX&H$n/5][53=yvi0FTW>gu=gu>m6YF3f4f2[^G+8x(M2Mprqf,@?Z3&aCdVbn+!]?[7\\\\=Uy.jXZ<[;Ob%&0Z_PR18csA$*CYy$5#H)0T@zu]UmP\'g\\zvg&uOf=65HN4Q#RYO]i#^@`H*3]egXabM:tg+4d(0VIIs5C5{=RiBFxV%J,:#97JP7]UtoS14S-zTnWG<8@zpJXa`AaK4ZSnZW*a90%aGyZ7:JJq*mrx/oph;)V_\\4)ha2hDWk<&CbL6cwT{:F5o_k&jr\'XpR)jhO2HVZE,CPNs(Ztcq7R{@ecDf[t`bN@6.{SjAAcVbo/1FRKb3lR7U/#_?Z0u/xBtPoe/P-+-BFwTy/ophu`aK1NzG/O(m#Tg0O&dTV8OiJr+p\']/gFbEilf@F$sL]pEB[-`,M*$m.1JeFifFh_\'<:O`xbbH#jzLKow/s(^0iN+\'y^J8rbuOd3f7usd#m.4WA!u[I<0v32={\'?MGZucp18g)+:(RNqroZUz2\"J:z+VZE)6rh:z.c6z63DzhwG7x(N7e\"ixG7trbsE7#EsD2f9#>Sh=1u-pzJ=0s&RS.\'sA#&6y2\"K>4)h_)D\\-_%-TGGls#Fz_MCI&ya[&AWwwuh.BDl\"Sc\"n5S*mt\'U`ghURx52=wl?0jRzvg%sF>DwZ;SrlLot#@[4)lr\"Bgi[k0CCe[yxoIYh&vPiHeL+/GZs^Y)SR$RXG9)[xrX>gu?pC946T*jd;7>oB7-s.{TkG[wnDB_AaM=)PA1m`vY:Rn^k)xRmUA#(<:MWQqkIfO6YG9&K0Ic?K>4)kk]m6\\SkJhUQw.orrh9vuj:xyz\"*JwI>=V\":@qGJyRiABe^.\\oB6%SYKKv<^NKj]qJYer4B3qnYRnYSsp[V%FxTttnQ\'bFs?tW8LY\\F)5kIdDcK0EPGSLb1e3f4d)7uwwr[Qc&*?@d^1m^m2FM6][79X8IIq*lrx-iTIRA0f@DvSuy,^#)ANH^+M,-?612EGt@yk3Q\'bGuD/Y[Al*zZ53>$2n^n7\\Rd)6p_j!UpZRjG`3sw%CcODGuF8%J/GXg(\'*:+c?H2YTw\'J*.EVdxV#AcTZKGa:9MZbaEm%`@Y(QHRIW]OR4GJ\"_FxZ8D2e6p_iwBw`Y$98M^sOlZ^J:$>MN$\\0qw*Yl:q[P^j&js-u8M\\i&o2@-[m9i1P)o\'aDgb<=]G)1[^K<*Xet@xg\"`MALIgTLb.SA+N.6dzefW`]:AuY;V&PKd?G*8z/jXX6%7)a;QawZ>_L@;D\'1_rIO5U6GGkniGcDdSPy=Y1#Sd&#v^Tf/IhX^Ti=.gIs6IM-2T8V/#\\2yAixE-HgXadRQ{F%{n:j7g.DPJb5v(PC@UnR.)#k%gc@PVB(:-pw.mjN\'kv6>uadVcp4GK(xZ7(Gq0/<$834JZl7dxY54GJ\"`K4_iu8Nc/VKTGGlqv\'OA6,p$RYMR9af`3rtpZO]hu>j(xW*^,SEAUkDL5^aRT27__BghZh%m*yW$BdZt`dYqT26U25R\'^2v,gO8aipw2%^6,u=dhc90!PXLTE;9HD\\+SMc5uw#4z>Y.ot{4)h^$-VOjP2A6(`82/3T4@,UMd8%K4ZSmU?t[KCL9q]Z1!K?:D)9*a5x1\"PT9\\I:&Hz\\=Uy0omYU$FwQkO\'iiWV/#[,b3oc&);2%^5,s39blyCxb_;C$\"xj-7i;#86B.[guAw`\\.iR=t]Wx$:=^NH_/^u[H6p^efQA3w.opkLr&Vi5_gmrw\'K-;%>NO\'ij]pC8/!Sg4bycaA[.gL\'q6Pt\"1t)_0e9(V`e^*K#`K4\\\\J>63:k:ulB=I>8=i%l&dU[OYStuulBB`FyZ7?sS\'[#1lYY8F<9F7\"@[5/.5an/3P\"LBFvKQ9adYpNon_o:g%sF>DwX46OoiF]*L)$sGBWr^^Bhow1$Y\"3w2)myBo9cp16[Qaxa\\.d=>^H-CL:umFQFJ\'y^I3^gnv1$Y%?PXN^qFBY{,Zh#fdJ$jv:RrmS8U.zP[\\?bUe#l-/DI))0S=oDB[-b6!=P^n4Ou-nnb\'1[b_98M\\l3LiVPog8w#5%RV=gvG:+`2lXSuz.d;56Prv#9:W-r)eM4S00>*SMgFa@UpYLP3GOeh\\wg\"d]+SJVU.!Sg3]dbDeXg)(-Jp!DvStw\"3v,fK$hnruy(K(y^K9x#5&Ubo3EDcM9mI^&7%NCBaJ/GYnFN7csB)?F&%\'4n[]Ezfmu-py:G<67PplQ04U6GHq/)!d_5$OI_+L)y\\@bXoOx=Y2)p+u?o=wmA70+&tJN/9mH\\yqS(aAZ(N9lApHQA2qo^iu<^OP%_=KF\\\'@R_jyH9!5)jfD\\,Yckqy4-$ggRC947U1/6bsD5v$?Ww\"3u\'SV9U(\\$4w.oqlNzLFWg((.Kt22C?PYQh@Cm)r7Qv+c?K@?X\'L3S01FM7dy^H,>63>!&90$[-b3lVJM\'p4EC]3!G,?I7rf-BFwU!:E.Q8\\OXPe4iDOEJ*,>5/+*.HcDbI\'\"k)xUx,_+L%iow.noe0S:dq3?\'@QZUy.gK#^@_EwSu\"5+o#PP%\\/hM\'q6Oog;+^&8+gUS%RWAzqJYfuE0[b]/iO.4[SlO&bK1Nw8G@H/MxBw\\E$ygyRg7sj@;D+BMBA`EuJL#^>Vy*VX>fp(ePC;>c_:;[@jzNT>qMfCUg/H_.]rNgGfSLa+JwD\'1`yi$e`7*fRHQ@-[j-7i8q\\Z3*s5GFhb7(Ys^Z0u/xBvW/\"WvulCEn(jk_yi*),@Bhmm^pA,TISHM-5_hp\"H,<.iVRw/qy67OiM%eZs]UtmLle9&K0JeFh`0b+BOJeEdQGP>&qNjTD91&f\\zxqR$QUY-jZchdAQVB(8(YqT0-.>4\'_71-/B@[0r$H)/N#Wwy$7*dJ$is,t4!&;8G?E\"o*SLc4n]c^1ne5jG^-WX7F>Am,+0P+ySnVE7!;I>=TsoVA{tY>dh_)BUe).Lt5`PR-\"^BffP=!\'?K>2\"NJfM/:wtcs@ypJZk5YIBOH[t]TlLr&Ubq:aaGy[8B&3iEYqV:Z=[>]Cq>wi,5c{izTnWF8$EuHCUf)0S;fwMVM[gvE0YZwh*.Hb?KACiq#H+9y(K*)0T>t\\MN\"Tj@`PMpw,eEaDjoqo[X.r$M>0ojJlkWSy2%Z%@Th8qap8YC#xgyRjG^+RD=D#uY\"*Is5E@NMv7C.WT&RVzxrV5C3roZV$Eq6Om_rGGn#S^aRU8Sz=Vy.fGic:0!OT:^Vq^cYs`gfN3P#OO\"NMw<\\@gozBn09j<#7.xF/S>sYBzk.:wsakyF+@BkzMMzJ>9@rMe=:KM\'o-%kyH8vy&?MHa:6?zubij^u\\J?bZ!+RFDbGxTv$>P[Z69ZD\"qHM/=\'Df^(?J:$>P\\`S[SlO&dSPw6:`^:@pB2n`tRtz2w42=z$2nb\"rMc2d-Ks1,,4^fi^\"\"%2hCPKfKzUslGXj4WD/WQoaxa]3{Cq?{xoGP@-\\qIVU.xG4iCK4\\[:G<3-&p6Rz=X,iVU,nv.ou&L6bsD4pg6mR05U6GIu?qHP;nI\\vco+vC)=pFIxP_o:h+4_m-.=-c8\'Vbm\'jmf?Bl\'ks*gVV0)t?tV37YC$!uZD%%\'6x.jWV/!RarE<G0S;fxP`vZ?egZm;ug((.M$]8;\\G,@AcZxrZKF_1m_tPod/O)t@v_Y&Df`2lVLVRw,dATf-@@_FxZ9F7#BfdDcPCAY\'K+.DQNr{:G7w\'L1Lk]pEAUj>1t)[{$/`%,L#^=Qaxb_m8bq6Rz@c[$4y9D-N)vKL#^=NVIK{VuumFRKa0a$#\"ztZH5mQ/2KgN/:sdxY2)q14Nr\">X&I\'\"oRg5jESS-yMQ08g+5i<*Yi+2WHBQS3@*M.9oS3;pOv1$[-a1c.O.1H\\wk8h4]aSZPb#uZ@m2DDf^)EeTT/&kv9MZccM8h0Lq\"Cn1;r[Rh;+\\vewN]hxKJnrttoS/-4[W\'OB>MMxCzh![4,yRf1YV\'U]W\"6/\'p18dwSpf1T?xmc`=G1\\b\\*P>\'?NMu6?xnB821?-\\qK_#\'7%NA86C1g@DtJM*%rB,O4Ml^sOjO/7ctGAPQ,zTp]bYtdwTy/prqc!k(uF;2(lt-p{Aiv;Y6;fvH>>Y1#R^fgW\\KEU^[4,wI>=TrjBDn,\"_G$sKVQt#=NT>rR%S[RkJkc2c.LzMN%aEr:^RbwZl2Jb7$J/FV`cU_`H\'$xdlu/zLHa:6A)BR[Uv#84=t\\NS9[J?elr!=Qe/N&e[t`dXj7i6i<(L1GXi.?4&[(K\'vN`zo@,TMd6tusbsA\'8(Zt`bPIZnC@RbyaXtg+4d\'+AK6i;$>LHdGq.(vMXX5:``Cjt1,\'y^I4bzgs4?$0b*AL?5,u=dg^$-THM,0JfM-5`m,(\"l+(%yenzDydg[sYBw^R_k#\\5+s6E=BrD5y64D931:oOt,i]u\\LFXnHUX<\\F(-Jq%T_ggWZCxcdO@3v/r\'[z%5y8dh^$,O2FL1KiUOkUGD\\+VX:Sv\'M7cxX/x@n3LeBTd#qC3od-Ij`(==Z3-\'tF:/w>c_71-0EM9nMopf6nV@yl6_e^-Zg{Z2&_MMyG1ZY6;er4D:7C/[gt:Y;Ty1x=[;Qg;+a3ob\"rMb-O1?-\\rOoh??[7:ZBrHIt:Y9MY[@k&ku48[I<1zE&(6uvwtcr=nA4y69X7D6{;H??^EwSuz1pqh=/niIi^ypHRFI{[50/<#2sz2!H.JljS>vf#hq&Z\".a)=;N\\gv@tS%PLld6uuq\\Y+_-VQt{4(dN9j;\"2sy/lb*?Cq=rU0+$l&geFieBVkA>SjDNA:?izUuse\'&)9\'RPx7B\'7#CkzMKov)[wmA5$POyCx_QYMWQpe1ZW)])Fhb5w-iUPm_p>yvg\'zfms#EvPe6qbyb^6+p$S\\X+`/_wchdC\\-a.WSz8=i)\"k&inplQ05XC&-O-0I_-UPn_sMa);402I^&5x1w8G?F$w\\F*:(UYB{pD;>aVkA:@o>\"\'=An5Pw3..7kBA_Er:G:,fJ!Z.k_zoC948ZF-Ks.\"X\"722B;@n7[LLw@n7[NS;h(#qB/^tU,p%T_ffN7_bQPzF&$###%/]m5W?m5T0-1NyBrE=@j!Vvxy!(C]4&[\'C`A_Dq8ZBvX7E8&RR)kl^sPqpbw[>^J5f-CL7i:z,Zg#ea=F.Ks0(r7Qt!76IP;oKd;6>pGK*\'#w^PWIE_4\"Ezb\\+TPqsp]aRVE$yh{X)V__@^Ae^._zrNl]k)\"fib1c,E\\&$5{=V#?X\'M9mFO@1ma!rL`\'7#BgfO7^^AcXmFN;tez`RV?tU,q\'_4#I2VE4n\\_LA=MP-*,;*Yi0EPEJ(\"m/9mH[t_]:B#!vadWco//@5*kjUJQ?&<3%Yws^^BghW[F-Jns\">Rh;*[rU0*!bWlDHz\\=V!87KYa`BaL7g0O%_?UqasF@J7mP(knkS:dr6Me=NO*uB##%/Y]LCK4YNZ]F\')8{5.#`I-=/ngAI.CL7g.FWe!c^1nc,GcC_>TmQ,$iox54B5#H*3`rD9-s,ox7>qL`(9+eJ\"^Cm*yUx+\\sZE)8#?X%ChgPoD=D\"tQu&M;xvmB?Se+<0u1)tA{sU/#[0ry4-\"];JGbAX\"2sz5,xLKr)dJ%l(n&aCfb:6?wj/@:@pA0e;1#Scyb[\'Gp/-2P)mw9HCXr^aM?4\'].d:-lhHjfDYxwnI[pLd:.s,p{Bl&josw$>OVD1d/TB.XZ>c_97F?I5e-DT\\Uvy$81*yV\";H9#@Y*Yl9oOy@gp&\\)L,1R05U6GHs7KX\\G1XOd2b#xcga4stram,\'vQlUD2g>I5f3`p?_L?3\"L@;F1[`R\\X+b;;Sv#99T#Dp7U0)xRlP+zW%Fs?sV21?+VW8IJvD\'3f9\"9=elt+hYdo(jk^sOnb&*@H-AEtHCVj;!/d:-osv\"5(dJ%n09mGV\\OUC.UM_xh\"bRV=i%m)s:]LFWg*1S:beWeyW(Wf#k%cPI]yrS*ic7\"AbU^^AfdGq/-1NyD#w`Xy%:9Pg@Cn-)(*:*]$.X\\H4d+=Vz2x;QkN%bM7e\'&*>;NXSw+]$0c0\\ddPB;>dgZl:nMniJq%Vh0Ls)bBZ(L.=,]xn@/f@H-DQLiVPlYX1$]4(fUU23IYer7Rw0x>bXuj7g2YPd.N(n(lt+iZi)&!m4R)id=@eeM5WB#$)ANFU\\Rg6kFXj6cxZ:LQ8^Y(QHVW9Nb,HkiO1A70\'n(koob%%(8$G{c],ZfxNZ\\Dx^OLqz:IDWnKeCXvr\\W{2x8E6y1w7@!xl;tdxUz75C5y52:k:r_d]\'BXwxxug(\'+@Cn-,4^gmpn]c`97GCZ%>LEWf&zdg[rU36S*lme5lP,\"bVcuKR>yt^Wx&AXy\'Gq16W@rJTNf?ExY7@xl8h/ETYE-Kt38_]8:X7D2iIkhKv?m5T0.6ao3C;@l,,8tmJdAPR.*&{k*$o5Qz>^F#n6U4>wj4WC(:0x@k\'p19i1O\"OS6L`&0`yj-3ZSo]dbCcQKb6y4*o$Ui9uoR,yQd+<2$Yy$5$NEO@2sy/la\'1_rIP8dwQkM{PVE7!:E-N\'n\'hc;9JKzRc&);-lgBOIa5z7;`[+[oDCaEr;fuE0Z_QU>oD?LDNA;AsNgDYte!eeP?*O9j6d{fo{E#rFD`?Re.HdEf\\xoHVYBvX47V6B0b+F_4y;MXSu$A_Ciou&K3U*Q@/d5soYO`xdhd>E%\"tS#J3[W)Xl;y{&:45OohAH\'\'+CPMr{=SlP*vH>9AzoA0hGcGt@va_?UtnP&bGvKN*yY0wys[MO)q3@,UNf>=W(SV7JTL^wbf^\'<;Rpb\"o>ywj5^aPMprrf/Ls.yKCOFPEGq15XAv_UlH[uexSpc&%(6w%DhiZgzX*[wj2P%[+Xdp//;z&@PUA\"zrQx6;bdU\\Q^l)yW)Xj3U,XaaEr&=CxaZ$95=sX=aYxyz$0e:-j^uZAo=s\\Si=0ry5/,.BDkxBw[Ap;m@0jSA,R>\"(APT:]NP)p-#cWh,9wz)M0B=LIhYesVw#95A)BUh2XJL!UoXJHia.WU&T[RiBG\"iyMMyF,BNDK-;%CbK2Q+wG8z2!H.G`5{?\\vevLP4J[oEEjnlYY42>$4w-j\\m7_cXj8nNt-p!Cp8[J@Ae`6\'Ys__G\"ixH;-hQ=xpLfDZ\".`\'4oavX59^VunOw9JL\"Z-gL\'q7U/%eZqR%VmHYj5[UuupV60.6ap7U1-/CFuHCT`ir)dM1GWblxBrF?I7qbsF?I2WJIr.$bQKc;45K]tY?izUre+8utlB>P\\bZ#1na{n;pQ$S_hov.r(],X_Y%@WvvpT4B0d6v\"4\"I0O&eU[NR4HREC^;D&.P3IW\\OS7S&Vi6f.G\\{%7&T]X(ROt\'SU5C3ro[Z69[G0VGANI`1hGeM2KgKzUrf/Mv;U$H((/S(Eg^\'=An3GQEEf^%6\"@`J0Nx@l.5]\\9E1a#xgxMS=qPv.q!Ahpz@ea>I:%FtB(:/v7D3n_qA+N.4\\[9D.Q9``H$q@%2hEZyyuez_I0Mv8HFdL2MoqnXMWQpg9y(K+/JgRB5\"Bl&f]#.Y_WrcuKP7[MQ1:qV9S\"Co09lCDgeHq12FN9k?2t\'V`e`4u&N;y#/d7x,b7\'T[NVKQ:h*-BJ2R04S.%ggSHO7__EvOb\'2d-IlkZ_R^bT^`L;z)L*)/O)r8S$NFSS(aA[0psslH[uduG<55IQC7,ov.r$M@85B0a\'4nZX0\"QZRn\\`OLlb,KxI=5/.7i7mKkb,Jq+nv/u48\\MN$]738af`4w-ka\'2g>:E3f6p^gox56La+GfTQv/u1+{^Dq=oEGq01DGtB(;2)p+vE-LxH9\"8:V*fO9i3U;dkr$J3[W(TV;Z?dbB_AaL8oS2;pOrz500@4\"H/IdGn{G.G`7,nv,iZgwKJr+q(dK-7mKk_yl8ez`QS02Ja3mXQn]gp$S\\W\'PEHzY.oqo\\`OIa6#G\"j#^?Z1w:Pf8y,`,Q;k7h1O\'eWdq5K]u[G1[\\Bn0:pU9T&T]X)U[LKr+mrx.iSB2oc\'-Kv?l/;xxs^\\9@uX:T{9A{rPt#@[2\"LABdXmEJ($sM_{sS\'Zz$5y8?qL^{t[H6rf-BH\'$v[E%$$&1a%(7\"?Z-gO3Mk[ft9W31\\?_G\'&\'0Z_PT9X9MZb_;C%&-P4Kc7$FvPd1]hu>h![50/9pWAxh&q:adTX?n9f&wX305XC(7y/mg?@aPKgM-1KmiJp#L=-c7%K4[V$Cjt/%cROs&PKeE`2y=Z7=m:nHZk7cvQkQ2?*P;qT0/7g/JiZgzY,gM-1Mt,p\"G\'*9%Erl2I\\ubkt.v=aXsctHCXuj:uk?2v/u5;g\"cYs^]:F3h>77OkUGCYz)J{Z1x>aVj<&A[.hM)yY3+yP_rHK#aK6f-CN@4%TcuM[djk[gvE1\\fp)kmc0XU$I.ABe])Fkoph=1x=\\=Y.pv(ST/\'q6Mc4mVD5ssj?4(eRIW^Wvuj9q]\\8?tU,ox8C*CUf,;)TT,t6GFg[tZH:&I%sE:2-)#o8``Gy\\AgkjTE;7B)?F%zl4Px;Pe4g7tmKka&1`xdmw7@#\'8*dFigO2HV\\NP,&tHDZ#3w/s([#0f@F\"k(vMYZ?`MCFr:a_=OYV(YnGRJYesQ^hr-zP^hs1/7g/IeGo%[(J#fgSK\\oC948]Q`o7X>gvC%*BS[Vz0qv%Em%_pGO7cr=l7dy\\@ecEheGmw7@ynA4zY-iYbbI%rC1c/VM[emv2*vH=8B%-Q7ZH8x*UW8Nb+E^1plR4ISL`&4n^izP\\aTbtHFfUV4=sW;Z>^H/Lt1+\"d^/d9*^)EdO=$4y9B&2f8{5*kjVOiLwC#wa^9=dieCWq\\Y+b92*ySpasGCZ%=F.Ks.\"Z*ZmA3w2)mv46Prv$>OUD1b(6v!1rx-eEbDgeGls&RQ\'cJ(%yceTR\'].b3iFZyvk7f+7q`m,(\"l/8j=)P?,VU.wAsL]rPpmWKR>wl9nKeEa@Wy)M1HZpNomVG@K:\"6,s23GQDB[+Yh\'xZ8C,L$dXi2S18e{aSZPaxaZ\'Fp-%m\'jopjFZug\'#rGGknkR9acSR)ia1f;.oro]da=F,DSYH;1zH2]efVYBuV/!Sd(0UC2gAF!hv?n:i1Lpu%G{`NEO?0l\\fp\'`=I:(QKb2iHeN6ZNXPf<4,xMP07ctGBRXIDXr\\TnWG?DuM^rNf>>\\=W$Dku5>sW;[?c^0iN*z\\%:5:et?qK^wfvIDVi7i;#6+ox9F9(YpMme5p`p:g$n1xoIW_Y$n=\")EfYi.=-c9+fO9i0Kle;2\'dQIYg#feN7am\'jmf?Bjw@p?#+M*$n4K`)?G,ADp4IVY?hxJBL:y$820:r\\Uvwxvl>-_%/\\h\"\\:D.R=rU38^Y&I&wX/yH3aycdQFI\"`K7j>2x8D1a\"uX:QmYW+eK$iq$QQ(g\\xl:r]X&L3T7OlXRrqbwV*b;=`RYNYW-ow0yApoC95>sYAuX5:es;bfZqPw303P#PQ)o(ha1c0XSy2!K>600=%;=_QXG;2)o&]2t&M<$:9Of;.mjM%dVahke<7?rPqrmO{KADo..;z)N5ZKImpo^hr0,,4bwW-q&XoNr\"@aPKhR>\"\'<X+`2m]hvAuX8GAOOzG,BI-AAbTYJCRS16XBzn={&:59_X!2w1$[*TQw418csB\'7$I-=/la&/XT!>X)YnEHyW$Er;bg`1f<52;qS,u>hyQax`Wr_gi\\pGM/?1s#Ckw?i!X$>OVF:0\"Q[[9E4o`q?#+KzSjCJ.BEs@\"zt[I:)Wcn(lw7B*CWnLla&/VNa&1`xbbK-8sf+6lLpx2$Z$;@n7ZI?@cXpQ%WqZP_rGHo$Te(+>SjERR\'cH{^Co3DBZ)TPv-oqqd\'(5pby`WpVQauSy4,xJF_2pkMxBsMa(9(Xi1Mu0%dU[LIja-P3Ka0^tS\"Bl(o)o(fYg%sD3oc%$%,Js1/6bq=oGP=#1hHjc6z4,vB\"u\\I;,b7([{%7)^0e>>Y2$Z(L0DK.=-eBRZPazj+*2[[;NZ^NIb9/\"Vsg/G^+P*N2KgN/;y#0gBNDK0FUZH9&L3S3>{#.Zeo%Z%>KDRQ$Td{flon^j#_Dm\'igO7[Q`uRt{4(dL.=*VX>gq.%fcAWr`hnrv!2v1#Wsg.FYnGQEDdSQ\"I1UC+Jt8PlWOf:,c?I4b{k*#l,\'{gp\'a@VtnMqx1zH0P-)%yen\"LBEr;chfIwH<3+uB{sS#K9tj<%AZ)QDB[.hN.4[SnWIE`:<^L@=OYTz64@*IwH;-j^tV34IW^TkGXk9nKeFha1gAH,=0t)`7*hYfuE2e5kHc?MIfM/<&C`Cjq%PMqx2#QYO`xa[)RGM1HYj1KhQ;pQzDvSv%Dku49_\\2zBn2D@WuqZLP1?-]sT,q\'^2t%K1NzF*7w%@Wur`is0\'lx>dcHzY.oqnWJJu;\\DzgtejgJv@rL]qJYdn$Z$96D7\'Ve#k&iorqe+9$CgeGp*ny>^F$w\\F)3f4c(/S>vds?rOojKox3*s6HM+,;&I\"d`7/#[.gL\'r;fxNZ\\CvSy2$XuoNt+fN2Lk\\k/<$7.xG5kIdC_=KF\\&<=_L?75D:6LFXmC@Wy&B_>P^k\'q7R{@aQP{I4c#rIP8dtD0_tRx4.(y\\@ecFlw;Tz4)mt)](Fhc;5;clx?eh]zwg\"d]*Q?&=BtOg?BjwAtRu%Eq5HQC:6A&5x/nkQ3GL.;$96A+M*\"goy=Z4.+-=.k\\k-3WC,LzRc&&+CVi4^fgX_Z(L1KhRA-XZ@l.3WB$&1d0VLXZ>_NJc?J<+]zveuD/Z]I6lMr&Wi5bwU$I+7nU>pEEg^%5z78Rw0x@iyLLw@n6V7JRC7*gVW6C3n]gq+r/)yZ52;pPw7B\'7$GzbWpS/+),=63sT-u9PjO,)).Ks-u:U(Zuh/CFvNZ`Uh4^fgXclw9KP6T0,-9wxz#-X[F+?@cXmDHyV!9?l1FN:r\\SmR19h0Lnm^l,,8tlGWae](D`@Z,a0c1]i\"[2{G-F\\$2lWPkO)s:]NMv;U\"?Y-gM++3_n3FK($rD8*dHt;`Y{-_$,M)yX-j\\n={&8-s.zOT>sU.\"Y%ElzG1VIGjeAQWC)@G\'(4iDRS.&n*t=h!\\;JE]+SISKZi)#m0:scr>t\\LF\\$5z:F6tvtg,:#;D\'/WRro\\_I1Q.**1UB)@J7mMt.w>dg]{yrU37YD&+DWoOv59[F0T>uadWg))1YV(ZueyX+dEdPC@Vsi8q\\Y-hSEBVpYLN(q6KZh&rA%/Z`XvpT3=wnFL1I^(@K>5+t:Y:QlR6Pt&PFM3S16XB{pEBY%?Rby`Ui8q\\Z4-%ju7GD\\*RFGr7M`&1b(3g:(SQ\"J7oWD/VM_v_X!1ng=529exV$G\"hq)h^!ztZG3b!n8`fa:5;h)(,AI.DOEL1Llc1_qB2kSG+>8?sQw/t0$]9*P=z#,UM`%.ULZb`@W!4$RXG:,gPP]dbDe[tae[vi2O\"PS4FFkqw-iWW1,\'xZ;Ob\'/TA*FgZm@0hIp%XsdwRmWJN,+3[[9D0^p?&:6@!ypHTQw0w;Tx/njO*zZ4-#cWj7h3ZSrjCI)-EU`fdEeV]Vur_cWk:wui3XHBNGXg&wX3/0ADydg]ypKa.XY8E6y2\"MFXh-:\"4\"F$uV-r)cGr4C90\'ij^u\\LDRR\'cL0FQJ\\rS&Z!+RC;:Pf:)ZoI[pK^\"zvdq5GHs:[D{k.6cy`TcwW,kb.RH1VF>?cZy\"*JyO\\b\\*REB[*W^UmNzI7sj?5-xH9$Ciml[aYxz&;9KSB1f?AffQC;<[>\\@cZz$2lYU&QNqx/nmZZ:LUHIt;\\H4d*:)V]TnT7Ry7;dkorri=-eD\\+XbeYk8h4\\^H+7rf,=3(h_\':1&f[vg&vRqlKnog8z.eBQXF7y2x;Sqg4e+;*]\")CY!.`(;69ZBw]MG]%4suwy{\'@PS5KZgzX)Xf#j{Q`o9co-%kzLEVbl$]727YD&.S@\':3..8pZNVLXX6@#(>CuPkR6T*jfE_70(s:JHh]wi+/IdFiiTHM/:ti7j>1t)\\%5z:H@EzdeRK`+Jv?m3Noo`sHK#bRT01@4{Cq;i,3[Z53>$3rrjBEo..:unLjWX5:cjq\"Co2>\'C_;E.O-.=-a.VPn`uU*dFjnm\\cbElzF+>9C*@F$vZ=]CsHIq+s4?#,P7\\Si>4,vC%*CVh2TV!74>xoHUU.{Sg6lIb:48ZE+AI/H`3rqd)1XRpg6kGZucq5HO9j7i8p[TtrbtIHmu-ml\\dg[rR%WoOzCsJQ;l>+US%S\\Y/pt{4(fVZF/P1J<,c9/xC!o?%5zLH`6(\\&)L.;!.c4pe/N&eZoIZk6^bQQ&]0kWT#H\'&(3g=4,yRg6lMu33DAY%@WvvqW>k/>-^\"!ysV7IO2EJ&rB.WV+ja.UL[fs9W2/5XF6tuoR+u?n:l>*SLa*Ea?Q\\^H+:\'N;vlA86B1e8#>TmQ.-5_hp\"H,>8.gK!W{2v-nrsnP\'eV\\P[]E!k(vLUHGjhQ;oJ^#\':3-*\'&(3g9#?TmNzH4g5f3`p;j1Kj\\k/;!.a*E].c4pd*8y+Zj2Nt,mm^pA/`$\'7!;JDUdxX/t/$]77M_zrMgHkiR>yt^Z,b5v&H#hp$PQ*s7OhHh[pGL-7j>1v1%`BdZrZJBNB?TmNyE(/R;h*-ACm&dRPv1\'jk]rK]rOnc)9$Es>rPu\'SR*knhBK7i9wxwoLhN,,8re%w[Cx]J:\"5\'^1nc,GdIzV{5*nzCrE:2*uD/WOf;0x>`PP$VoS3@)It9V.u8JO2FK-9sh2U@zrOqqg4d(1ZY6=n?+SHO8bp3A4w-le;0xAn4Ld==Y2&bHz^Ezca@UnS5HO7__Fzb[&>I:&GwQg=63=xoK`-Q:h),<0s(\\$4x0w8E9*cATf,<.mhEYuf&y`Ui:x\"-[m:oNs%N@4$QR/-5_it24LfE_6,r/(s@yl8e!fkhL&kw;X/w>b]0l[ccK,3\\^F#n8^X$>QawY6>pK^yoC(Ht?oA/b/Y[@j{TmP&`BbNA:>hxIAH+9z.d<8E6u{0nhCPJa4suupS0/l2KgM*&yaYy\",UOjQ4LeAPP&`A\\63:k8i6e\'+>:H>?`L<%@Vrcy`QV=l3Ox9KR=rU4;i0I`2m]fmu+fN4T0/8kA:BxbbJ+2XMVOiHi^zrR!E{hwC\'0\\emt)`4x3(koqjEU^^AaQNqy4*p(eTQ{Cp7X?k)\"iu:T$I+8tnO{I4d*6rf.HcC`?Uqczb[\'EijZdkqv(TW;\\Cw[Aj$`FvLS@%4stq_fgUS#J6j?5+s6FC]0l]n7^\\514Nqty+Zi,5czejfGid>Ak$_A_F{ddJ(zc^2rw&Eo-%k{NQ/2Moph=0r\"AcVe$o7X>fq,vB#zpFFks\'Vf$rD8)`7)dI{[528ahiZep/,->5-yOYTy2zCvU\'Wg(*6nUA\"#\':1\'jmf>;N[`S]_I0N\"Sc!j$dYqS,wD)9\'SS+o$Uf)/Q1t[I:%GwNYZVy-a.Y]LCH\'#sKX^PVD/WSx2#SbtLVQrpatJO4Orz63>zyucn(iiVS{=Uv!1nf;+`/]n=xs[OVIIq-zQbzhxLLyJ@?Z0s*cDdRMl`zn;s\\Rd*8\"86HK$fcC_;C#!u[F,EZuj6br@%2hF[#2m^m3IYfzY.mjO.0FRNmc,HfTOpmWKO.4WB$(;3-(zaXpV=fr5FEeSPx9H@I1S6Psx+]\"$+N-2P$Y\"1oiDRT13I[pIX`_A^AaOFQIYevG;3,\"_DsC1b*>zveuF8%I*/MxCzi$fc@Sc!k)xTx*Xcm%^:>fr27[MN\'ij]sS$NDK0H]#,R@,RA/a\'6x-gK!Y*Yj2Q*s7OhFaj*\'%#zoCE\'*>=Uux#6\'Z{(BY$::Sv\'L2R-%js+lmb(6soWF7x,b8(YpQ%Z\"-^xh(zdcGuE3iF]\'?LBH$q>vewN[b^7.#_@_Fy^I4_l+%p8[KCOFPDB^:C#yn?(D`@W!3y^Ex[?aRU;a]6-yMN&dUZJCOFPEI\"bT][4+t<`Z%@UoXICS][4-$geL-4[W%J,9y(IyTrh7pZSo\\^H+:\'O?-^xk1KfJxKIll^pB3str`l(q3>$2m]hwH8#=MQ1=#1jQ6V4:h+0MxC!n8dtF9,kb0[cdO!&;7D3jKp#L<)O=#2oh?;JDUcvN`xcfZpMkY]LCJ/ERNqw*\\vg%o6R%UcvRrlNyE\'-LxE+??_H,;*[rS(a@Vsf,<-eEcI%q\'C`A\\76GGlrz9C(:-nm^o=ubjr%SZLM$_Be]\'@OO%\\0qssj?3$Tao5MfDXui3ZPd-Kr*jgGic:2,$is-v>fnxi\'r=n>(Hs:[F)6smKkb-M%dXi1NxAl.1Ms&Ucs@#%0^tT)b@R^fh^ztYAuU*dHt:F6v#725Q\"J5d(/Q5MiO2C?OUA$)AOLqy529g)+:&J)(,BNCFq6NiN,(\"n5S*ny,[oFHvF8!9?pC934J\\pGO8f((1YU&OGRMgJs4@%5y64D:48X=ca@VrczdfTT*lmd3d+=7n>%8,ll]l0A7/%geIt>j+*3]b[&?MIcC]2x:LR=sZH;*]$0`%*AK;&Fq3?(AUlEM9pS26ZH:)YnDB`CgdGmzF)2]iyMR4IUS%RU9Y:Su\"88Ne7v#723HRISMd8\'SW<`Yz*P>#0d6w%B_AbSU6JSHK%l$]611C>OU?u^VtlFQHSMiN-0EQLeCVj>-d:2,$jv=`WnOzG,AH\'$zm6YH<4//<$95>u``G{aVj8pWC(7#BgfM.8mLmiKt24Lc7$I,;\'K/ASjDM;z(Flr%M?2w419i5^bVf\'$yfs6IQ>!\'=CtM_ym8dyZ9E6v$?Si>3&[(J#d^/e>>\\CrB+L&o.-4[Y2%^9:X45JZi(y_NGZrWrR\"F$tNc1_rHK#cU`e]\'@Q[W\'SS,wE-Jp%WlEM7cwStvxz%6\'[\"*M.8lFQIZm;tf%sIN-1Nv6@\"!zveuE3jHfO9g+6jBEs?vclv6=oEGq2;pNpssi<)RHSJZi*()3e0UE7#EsC.XX32>\'AUlGWds>pISITNjR9co,#d[\"+N3Ml_xdkr$K5asGBUg/Hc@R]aS[SmT=m=!(C\\,^zvdo-(xW,hWY=`R\\Y/q{=SlP+zVy-eAPQ*q00?/gIq)g\\sW:T\"Ad]*L(z_NEPCB]9=eo$Tf+7rh4^fkjTF@ONyD{l0A99Rsurcy\\Aj\"Vsg1T;dlx@iyKEYqV9T$I.ESU3:i0FU^X&Fr9[H6nU=j-4_jxD(4lO(n&aBbNA71-,7nS3?(EeTU25Py;Pf8y-c8)^*J\"^@aPKd@NJgRA0d4lQ1:nI^%3m[^I3\\_MBA_Cl#Wvuk?2v0\"Q]`NGV_];G7w&Dga6#EvPhBM>0ng=4-&o/0CFsgq-\"Z,b6\"Ae^/e;1#Te*7uth2T:_Xx\"1l\\dg\\veuC-O.3U;baFuF;2\'eXh))2]gp%Vi8oV>m7bo/1FO?+UT)bB\\1r{;H>;KM$`FwRmVD4ob#tT%OGUYC%(9\'TZLJnqsq_jwByfq.&o19i2R2:l=\'Eij]qJWY>b^4$OJc3&\\,]u^Vsh4aq=sX=a\\.b4n]ca?Q^fkjWT$I,<,b7\'XlA71.2Q*s6HM.7g2VB\'5v&FtD/XX45JZi+/H`3qnVF:0yF-HdFmx?ddL-7kEN<\"/c4n\\_NFTW;\\F(.P0;tdxTy0ptvz(Ht%:8KP7[OXQjJpy;Pb#zm;qW?m5U6F@OO%\\/k\\j(wPg0mc/R:cm#WrcvPe7uumKfJzTqasHIp*lomXPiF[z%5y4-&o1:nHV^X\"6.zP]efTR{Cp8[I>9@v^Q]d_7,q&\\\'DeXh*.Hb>I7rf-ADq9]Q\\_MBA^@`G&zfp*p)kl^qGIvC);3,{Z1{J9z,\\rPu+fK&n..:wvoKfGlrx0u/zMKot{5.$dZtafb>F+=3+t=ep)ifHo%Ywtey\\Aiu:W.v:RsskEPEI$l(o,ySlMxAoxnB:;V+gTLb/XU\'VctD2hCNA=NS8X<_ONx@k)wPb\'/TC1f:,fK$ggTOnd-ImokO(n&bGwQg:\'M8lCDlyF-F](Go(fYh*,<,d?I5g4e*9!5)jgIp(bGr9[F,EWj:umHXf#gkfD[%;?izSjDN@7/\'p18bn,&sB,N,+4`p=pNl]k-3XJInw43C8.v>gs6HJzUrg0Q19k:uk>0md2azj*\'\"qD<=]G(/O)s=j*(*:&K1JfL&o1$2pkJiZh#eafq/(uG=:KO0:sbq:acQKa2hCQS.&m\'ijZfr6HL+*2[]Cp;h)\'&(5pbx]F*7skCFwPd.M$`DkxBvY;Tw\'N:pS12GRIX_[0ppe0Q3C:9M^qIQ>\"+O6ZKIhYfuD.R=qPt(Wi0Kk`&/Z]J:$>PZV%I,7oYLR;i/DJ*.HdEf[uae\\{#*JyP\\b].a+Io\"J9uq\\Y+_,THL+*1VF;42Y-iVRx3*s5FBXxxyvj5]`J3\\[8?rMe;42;r[OYW+dEg^\'=@gmt&ODDks)a97D5w*ZoGO;saiq&UcuLVNd4mU?wh(#n4LhN,+2XMXW.w>caAZ,b5w,eC[&CaH\"glmb):+b90&e[tagdBZ(L.:y$6\'\\(DdTU4>xqOqtuulCEp02Kd>E#tPlXRpg6nU>qMf@J5e,ACk!R_k$`Dm&cN<#3t{60/;ws^]=Pb\"rMa,Jt5A*Ho$S]^Bl(n(h`0a%(:/t/\"X\"4$PP%]2u+fK&p3EEf]\"(@LAA`H%w\\E$w_VoT7Pnc\'1\\ca?Si<*V\\Q^jzQ^j\"Y\'M7ctIJt7KXZ>aXsdwRpb!l1DGuF8&L8kA1u-ov,eEdQHTQz=W&N=\'C`BdWg+2ZW*b:59^X\"5)eQDAXy\'Fm\"NLpx4-$hjb1b)9\'PEJ&vRpg5h;)TU37YD&+F_6,p&Yws^[2!J:%@Y\'L/CEo/2I^$-THJzVy.d=?aUd!fid;419i2U*P>$3rpbx]G.G])Gn\"ONw=^I1TP\\_L?88PkT@%/^uW35MiR>vg&uOe9%H\"fi_%/\\k,->2\"L@=P_m2FN8e#o7X@n;mA6,r/\'n*r4B3sw$9C&1c);.px3(ha1e9&M:r_bQPzF(.M#\\5+q-yOZW*`3pkKpzY+_,QoA0e=9G<69Y<[0omWM[dkmd4kKq#H,=2\"LA@];IBL:x\"/b.TFAS`l(o*s8Qsw#838^Z,b6!>UsnP&bJ*+9#:>hyO[\\CuOe9%FwQiEUaip\"DtJM(wO_rHM/=(HvH@G&$\"wabJ+1U@{u``EtB*FcHxP`w\\H3bx`Wsbq:bf_-UPog:\'M8kA:AtS#I.FXk8j=,`*D]1ppb!m5S*nw6=oC<@l-1Lnm[^J:{0kYY9LVNb,Jq(a>KCL9se&zhwH;0x>c_6*jfBS_hov,hUQt\"deSOpn[[CsHGkk\\l3Mmg>;MS?!\"&7\'Xk<\"1kXV)]*M/;y&.e@I1UA$)APP&'); +--enable_query_log +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +--error 0,1114 +INSERT INTO t1 SELECT * FROM t1; +DROP TABLE t1; diff --git a/mysql-test/t/archive.test b/mysql-test/t/archive.test index 0ffbfab3d4f..61033fca3f7 100644 --- a/mysql-test/t/archive.test +++ b/mysql-test/t/archive.test @@ -1374,3 +1374,12 @@ insert into t1 values (1); repair table t1 use_frm; select * from t1; drop table t1; + +# +# BUG#29207 - archive table reported as corrupt by check table +# +create table t1(a longblob) engine=archive; +insert into t1 set a=''; +insert into t1 set a='a'; +check table t1 extended; +drop table t1; diff --git a/mysql-test/t/backup.test b/mysql-test/t/backup.test index a3339ecce69..6ff4144aaf2 100644 --- a/mysql-test/t/backup.test +++ b/mysql-test/t/backup.test @@ -1,3 +1,8 @@ + +# The server need to be started in $MYSQLTEST_VARDIR since it +# uses ../std_data_ln/ +-- source include/uses_vardir.inc + # # This test is a bit tricky as we can't use backup table to overwrite an old # table diff --git a/mysql-test/t/bigint.test b/mysql-test/t/bigint.test index 9a5fb11229d..4aef7395184 100644 --- a/mysql-test/t/bigint.test +++ b/mysql-test/t/bigint.test @@ -294,3 +294,19 @@ drop table t1; select cast(19999999999999999999 as signed); select cast(-19999999999999999999 as signed); + +# +# Bug #28625: -9223372036854775808 doesn't fit in BIGINT. +# + +# PS protocol gives different metadata for `Max length' column +--disable_ps_protocol +--enable_metadata +select -9223372036854775808; +select -(9223372036854775808); +select -((9223372036854775808)); +select -(-(9223372036854775808)); +--disable_metadata +--endble_ps_protocol +select --9223372036854775808, ---9223372036854775808, ----9223372036854775808; +select -(-9223372036854775808), -(-(-9223372036854775808)); diff --git a/mysql-test/t/binary.test b/mysql-test/t/binary.test index 4ab6ee9eaf1..1cc6ae07675 100644 --- a/mysql-test/t/binary.test +++ b/mysql-test/t/binary.test @@ -101,3 +101,41 @@ select hex(col1) from t1; insert into t1 values ('b'),('b '); select hex(col1) from t1; drop table t1; + +# +# Bug #29087: assertion abort for a search in a BINARY non-nullable index +# by a key with trailing spaces +# + +CREATE TABLE t1 ( + a binary(20) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0', + index idx(a) +); +INSERT INTO t1 SET a=unhex('1F9480179366F2BF567E1C4B964C1EF029087575'); +INSERT INTO t1 SET a=unhex('1F9480179366F2BF567E1C4B964C1EF029082020'); +INSERT INTO t1 SET a=unhex('1F9480179366F2BF567E1C4B964C1EF029080707'); + +SELECT hex(a) FROM t1 order by a; +EXPLAIN SELECT hex(a) FROM t1 order by a; + +SELECT hex(a) from t1 WHERE a=unhex('1F9480179366F2BF567E1C4B964C1EF029082020'); +EXPLAIN +SELECT hex(a) from t1 WHERE a=unhex('1F9480179366F2BF567E1C4B964C1EF029082020'); + +SELECT hex(a) from t1 WHERE a=unhex('1F9480179366F2BF567E1C4B964C1EF02908'); + +DROP TABLE t1; + +CREATE TABLE t1 ( + id numeric(20) NOT NULL, + lang varchar(8) NOT NULL, + msg varchar(32) NOT NULL, + PRIMARY KEY (id,lang) +); +INSERT INTO t1 VALUES (33, 'en', 'zzzzzzz'); +INSERT INTO t1 VALUES (31, 'en', 'xxxxxxx'); +INSERT INTO t1 VALUES (32, 'en', 'yyyyyyy'); +SELECT * FROM t1 WHERE id=32; + +DROP TABLE t1; + diff --git a/mysql-test/t/binlog.test b/mysql-test/t/binlog.test index 1063940d378..5d1399925c3 100644 --- a/mysql-test/t/binlog.test +++ b/mysql-test/t/binlog.test @@ -1,8 +1,8 @@ # # misc binlogging tests that do not require a slave running # +-- source include/have_log_bin.inc -- source include/not_embedded.inc --- source include/have_bdb.inc -- source include/have_innodb.inc --disable_warnings @@ -10,7 +10,7 @@ drop table if exists t1, t2; --enable_warnings reset master; -create table t1 (a int) engine=bdb; +create table t1 (a int) engine=innodb; create table t2 (a int) engine=innodb; begin; insert t1 values (5); @@ -19,8 +19,8 @@ begin; insert t2 values (5); commit; # first COMMIT must be Query_log_event, second - Xid_log_event ---replace_result "xid=21" "xid=12" --replace_column 2 # 5 # +--replace_regex /\/\* xid=.* \*\//\/* XID *\// show binlog events from 98; drop table t1,t2; @@ -41,9 +41,69 @@ while ($1) --enable_query_log commit; drop table t1; ---replace_result "xid=32" "xid=19" --replace_column 2 # 5 # +--replace_regex /\/\* xid=.* \*\//\/* XID *\// show binlog events in 'master-bin.000001' from 98; --replace_column 2 # 5 # show binlog events in 'master-bin.000002' from 98; +# +# Bug#22540 - Incorrect value in column End_log_pos of +# SHOW BINLOG EVENTS using InnoDB +# + +# the following tests will show that certain queries now return +# absolute offsets (from binlog start, rather than relative to +# the beginning of the current transaction). under what +# conditions it should be allowed / is sensible to put the +# slider into the middle of a transaction is not our concern +# here; we just guarantee that if and when it's done, the +# user has valid offsets to use. if the setter function still +# wants to throw a "positioning into middle of transaction" +# warning, that's its prerogative and handled elsewhere. + +set @ac = @@autocommit; + +# first show this to work for SHOW BINLOG EVENTS + +set autocommit= 0; +reset master; +create table t1(n int) engine=innodb; +begin; +insert into t1 values (1); +insert into t1 values (2); +insert into t1 values (3); +commit; +drop table t1; +--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /Server ver: [^,]*,/Server version,/ +show binlog events from 0; + +# now show that nothing breaks if we need to read from the cache more +# than once, resulting in split event-headers + +set @bcs = @@binlog_cache_size; +set global binlog_cache_size=4096; +reset master; + +create table t1 (a int) engine=innodb; + +let $1=400; +disable_query_log; +begin; +while ($1) +{ + eval insert into t1 values( $1 ); + dec $1; +} +commit; +enable_query_log; + +--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /Server ver: [^,]*,/Server version,/ +show binlog events from 0; + +drop table t1; + +set global binlog_cache_size=@bcs; +set session autocommit = @ac; + +--echo End of 5.0 tests diff --git a/mysql-test/t/binlog_innodb.test b/mysql-test/t/binlog_innodb.test new file mode 100644 index 00000000000..2da7b2b0895 --- /dev/null +++ b/mysql-test/t/binlog_innodb.test @@ -0,0 +1,39 @@ +-- source include/have_innodb.inc +-- source include/have_log_bin.inc + + +# +# Let us test binlog_cache_use and binlog_cache_disk_use status vars. +# Actually this test has nothing to do with innodb per se, it just requires +# transactional table. +# +show status like "binlog_cache_use"; +show status like "binlog_cache_disk_use"; + +create table t1 (a int) engine=innodb; + +# Now we are going to create transaction which is long enough so its +# transaction binlog will be flushed to disk... +let $1=2000; +disable_query_log; +begin; +while ($1) +{ + eval insert into t1 values( $1 ); + dec $1; +} +commit; +enable_query_log; +show status like "binlog_cache_use"; +show status like "binlog_cache_disk_use"; + +# Transaction which should not be flushed to disk and so should not +# increase binlog_cache_disk_use. +begin; +delete from t1; +commit; +show status like "binlog_cache_use"; +show status like "binlog_cache_disk_use"; +drop table t1; + + diff --git a/mysql-test/t/binlog_killed.test b/mysql-test/t/binlog_killed.test new file mode 100644 index 00000000000..034895f17cb --- /dev/null +++ b/mysql-test/t/binlog_killed.test @@ -0,0 +1,248 @@ +-- source include/have_innodb.inc +--source include/not_embedded.inc +--source include/have_log_bin.inc + +### +### bug#22725 : incorrect killed error in binlogged query +### + +connect (con1, localhost, root,,); +connect (con2, localhost, root,,); + +create table t1 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB; +create table t2 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=MyISAM; +create table t3 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB; + +# +# effective test for bug#22725 +# + +connection con1; +select get_lock("a", 20); + +connection con2; +let $ID= `select connection_id()`; +reset master; +send insert into t2 values (null, null), (null, get_lock("a", 10)); + + +connection con1; + +disable_abort_on_error; +disable_query_log; +disable_result_log; + +eval kill query $ID; + +connection con2; +--error 0,ER_QUERY_INTERRUPTED +reap; +let $rows= `select count(*) from t2 /* must be 2 or 0 */`; + +--exec $MYSQL_BINLOG --start-position=126 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +eval select +(@a:=load_file("$MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog")) +is not null; +--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR +let $error_code= `select @a like "%#%error_code=0%" /* must return 1 or 0*/`; +let $insert_binlogged= `select @a like "%insert into%" /* must return 1 or 0 */`; +eval set @result= $rows- $error_code - $insert_binlogged; + +enable_abort_on_error; +enable_query_log; +enable_result_log; + +select @result /* must be zero either way */; + +# the functions are either *insensitive* to killing or killing can cause +# strange problmes with the error propagation out of SF's stack +# Bug#27563, Bug#27565, BUG#24971 +# +# TODO: use if's block as regression test for the bugs or remove +# +if (0) +{ +delimiter |; +create function bug27563() +RETURNS int(11) +DETERMINISTIC +begin + select get_lock("a", 10) into @a; + return 1; +end| +delimiter ;| + +# the function is sensitive to killing requiring innodb though with wrong client error +# TO FIX in BUG#27565; TODO: remove --error 1105 afterwards +delimiter |; +create function bug27565() +RETURNS int(11) +DETERMINISTIC +begin + select a from t1 where a=1 into @a for update; + return 1; +end| +delimiter ;| + +reset master; + + +### ta table case: killing causes rollback + +# A. autocommit ON +connection con1; +select get_lock("a", 20); + +connection con2; +let $ID= `select connection_id()`; +send insert into t1 values (bug27563(),1); + +connection con1; +eval kill query $ID; + +connection con2; +# todo (re-record test): after bugs 27563,27565 got fixed affected rows will report zero +--enable_info +# todo: remove 0 return after fixing Bug#27563 +--error 0,ER_QUERY_INTERRUPTED +reap; ### pb: wrong error +--disable_info +###--replace_column 2 # 5 # +### show binlog events from 98 /* nothing in binlog unless Bug#27563 */; +show master status /* must be only FD event unless Bug#27563 */; +select count(*) from t1 /* must be zero unless Bug#27563 */; + +# M. multi-statement-ta +connection con2; +let $ID= `select connection_id()`; +begin; +send insert into t1 values (bug27563(),1); + +connection con1; +eval kill query $ID; +connection con2; +# todo (re-record test): after bugs 27563,27565 got fixed affected rows will report zero +--enable_info +# todo: remove 0 return after fixing Bug#27563 +--error 0,ER_QUERY_INTERRUPTED +reap; +--disable_info +select count(*) from t1 /* must be zero unless Bug#27563 */; +commit; + + +### non-ta table case: killing must be recorded in binlog + +reset master; + +connection con2; +let $ID= `select connection_id()`; +send insert into t2 values (bug27563(),1); + +connection con1; +eval kill query $ID; + +connection con2; +# todo: remove 0 return after fixing Bug#27563 +--error 0,ER_QUERY_INTERRUPTED +reap; +select count(*) from t2 /* must be one */; +#show binlog events from 98 /* must have the insert on non-ta table */; +show master status /* must have the insert event more to FD */; +# the value of the error flag of KILLED_QUERY is tested further + +connection con1; +select RELEASE_LOCK("a"); + +### test with effective killing of SF() + +delete from t1; +delete from t2; +insert into t1 values (1,1); +insert into t2 values (1,1); + +# +# Bug#27565 +# test where KILL is propagated as error to the top level +# still another bug with the error message to the user +# todo: fix reexecute the result file after fixing +# +begin; update t1 set b=0 where a=1; + +connection con2; +let $ID= `select connection_id()`; +send update t2 set b=bug27565()-1 where a=1; + +connection con1; +eval kill query $ID; +commit; + +connection con2; +# todo: fix Bug #27565 killed query of SF() is not reported correctly and +# remove 1105 (wrong) +#--error ER_QUERY_INTERRUPTED +--error 1105,ER_QUERY_INTERRUPTED +reap; ### pb: wrong error +select * from t1 /* must be: (1,0) */; +select * from t2 /* must be as before: (1,1) */; + +## bug#22725 with effective and propagating killing +# +# top-level ta-table +connection con1; +delete from t3; +reset master; +begin; update t1 set b=0 where a=1; + +connection con2; +let $ID= `select connection_id()`; +# the query won't perform completely since the function gets interrupted +send insert into t3 values (0,0),(1,bug27565()); + +connection con1; +eval kill query $ID; +rollback; + +connection con2; +# todo: fix Bug #27565 killed query of SF() is not reported correctly and +# remove 1105 (wrong) +#--error ER_QUERY_INTERRUPTED +--error 1105,ER_QUERY_INTERRUPTED +reap; ### pb: wrong error +select count(*) from t3 /* must be zero */; +show master status /* nothing in binlog */; + +# top-level non-ta-table +connection con1; +delete from t2; +reset master; +begin; update t1 set b=0 where a=1; + +connection con2; +let $ID= `select connection_id()`; +# the query won't perform completely since the function gets intrurrupted +send insert into t2 values (0,0),(1,bug27565()) /* non-ta t2 */; + +connection con1; +eval kill query $ID; +rollback; + +connection con2; +# todo: fix Bug #27565 killed query of SF() is not reported correctly and +# remove 1105 (wrong) +#--error ER_QUERY_INTERRUPTED +--error 1105,ER_QUERY_INTERRUPTED +reap; ### pb: wrong error + +select count(*) from t2 /* count must be one */; +show master status /* insert into non-ta must be in binlog */; + +drop function bug27563; +drop function bug27565; +} + +system rm $MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog ; + +drop table t1,t2,t3; + diff --git a/mysql-test/t/blackhole.test b/mysql-test/t/blackhole.test index 51cc663d6bc..d8ffdeb8312 100644 --- a/mysql-test/t/blackhole.test +++ b/mysql-test/t/blackhole.test @@ -4,6 +4,11 @@ # -- source include/not_embedded.inc -- source include/have_blackhole.inc +-- source include/have_log_bin.inc + +# The server need to be started in $MYSQLTEST_VARDIR since it +# uses ../std_data_ln/ +-- source include/uses_vardir.inc --disable_warnings drop table if exists t1,t2; @@ -109,7 +114,7 @@ insert into t1 values(1); insert ignore into t1 values(1); replace into t1 values(100); create table t2 (a varchar(200)) engine=blackhole; -load data infile '../std_data_ln/words.dat' into table t2; +eval load data infile '../std_data_ln/words.dat' into table t2; alter table t1 add b int; alter table t1 drop b; create table t3 like t1; diff --git a/mysql-test/t/cast.test b/mysql-test/t/cast.test index 004ef69182d..b665eb86656 100644 --- a/mysql-test/t/cast.test +++ b/mysql-test/t/cast.test @@ -10,7 +10,13 @@ select cast(-5 as unsigned) -1, cast(-5 as unsigned) + 1; select ~5, cast(~5 as signed); explain extended select ~5, cast(~5 as signed); select cast(5 as unsigned) -6.0; -select cast(NULL as signed), cast(1/0 as signed); +select cast(NULL as signed), cast(1/0 as signed); +# +# Bug #28250: Run-Time Check Failure #3 - The variable 'value' is being used +# without being def +# +# The following line causes Run-Time Check Failure on +# binaries built with Visual C++ 2005 select cast(NULL as unsigned), cast(1/0 as unsigned); select cast("A" as binary) = "a", cast(BINARY "a" as CHAR) = "A"; select cast("2001-1-1" as DATE), cast("2001-1-1" as DATETIME); diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test index 35198c793b8..99f3fea416a 100644 --- a/mysql-test/t/create.test +++ b/mysql-test/t/create.test @@ -786,4 +786,337 @@ drop table t1, t2; create table t1 (upgrade int); drop table t1; + +# +# Bug #26642: create index corrupts table definition in .frm +# +# Problem with creating keys with maximum key-parts and maximum name length +# This test is made for a mysql server supporting names up to 64 bytes +# and a maximum of 16 key segements per Key +# + +create table t1 ( + c1 int, c2 int, c3 int, c4 int, c5 int, c6 int, c7 int, c8 int, + c9 int, c10 int, c11 int, c12 int, c13 int, c14 int, c15 int, c16 int, + + key a001_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a002_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a003_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a004_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a005_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a006_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a007_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a008_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a009_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + + key a010_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a011_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a012_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a013_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a014_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a015_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a016_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a017_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a018_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a019_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + + key a020_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a021_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a022_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a023_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a024_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a025_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a026_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a027_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a028_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a029_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + + key a030_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a031_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a032_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a033_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a034_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a035_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a036_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a037_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a038_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a039_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + + key a040_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a041_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a042_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a043_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a044_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a045_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a046_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a047_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a048_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a049_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + + key a050_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a051_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a052_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a053_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a054_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a055_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a056_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a057_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a058_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a059_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + + key a060_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a061_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a062_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a063_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a064_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16) +); + +# Check that the table is not corrupted +show create table t1; +flush tables; +show create table t1; + +# Repeat test using ALTER to add indexes + +drop table t1; +create table t1 (c1 int, c2 int, c3 int, c4 int, c5 int, c6 int, c7 int, +c8 int, c9 int, c10 int, c11 int, c12 int, c13 int, c14 int, c15 int, c16 int); + +alter table t1 + + add key a001_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a002_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a003_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a004_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a005_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a006_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a007_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a008_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a009_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + + add key a010_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a011_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a012_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a013_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a014_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a015_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a016_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a017_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a018_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a019_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + + add key a020_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a021_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a022_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a023_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a024_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a025_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a026_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a027_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a028_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a029_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + + add key a030_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a031_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a032_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a033_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a034_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a035_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a036_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a037_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a038_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a039_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + + add key a040_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a041_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a042_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a043_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a044_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a045_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a046_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a047_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a048_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a049_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + + add key a050_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a051_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a052_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a053_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a054_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a055_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a056_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a057_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a058_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a059_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + + add key a060_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a061_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a062_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a063_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a064_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16); + +show create table t1; +flush tables; +show create table t1; + +# Test the server limits; if any of these pass, all above tests need +# to be rewritten to hit the limit +# +# Ensure limit is really 64 keys +--error 1069 +alter table t1 add key + a065_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16); + +drop table t1; + +# Ensure limit is really 16 key parts per key + +create table t1 (c1 int, c2 int, c3 int, c4 int, c5 int, c6 int, c7 int, +c8 int, c9 int, c10 int, c11 int, c12 int, c13 int, c14 int, c15 int, +c16 int, c17 int); + +# Get error for max key parts +--error 1070 +alter table t1 add key i1 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16, c17); + +# Get error for max key-name length +--error 1059 +alter table t1 add key + a001_long_123456789_123456789_123456789_123456789_123456789_12345 (c1); + +show create table t1; + +drop table t1; + + --echo End of 5.0 tests diff --git a/mysql-test/t/csv.test b/mysql-test/t/csv.test index 687f3ea3918..b724b4ce47c 100644 --- a/mysql-test/t/csv.test +++ b/mysql-test/t/csv.test @@ -1410,3 +1410,21 @@ select * from bug15205; drop table bug15205; drop table bug15205_2; +# +# Bug#28862 "Extended Latin1 characters get lost in CVS engine" +# +set names latin1; +create table t1 ( + c varchar(1), + name varchar(64) +) character set latin1 engine=csv; +insert into t1 values (0xC0,'LATIN CAPITAL LETTER A WITH GRAVE'); +insert into t1 values (0xE0,'LATIN SMALL LETTER A WITH GRAVE'); +insert into t1 values (0xEE,'LATIN SMALL LETTER I WITH CIRCUMFLEX'); +insert into t1 values (0xFE,'LATIN SMALL LETTER THORN'); +insert into t1 values (0xF7,'DIVISION SIGN'); +insert into t1 values (0xFF,'LATIN SMALL LETTER Y WITH DIAERESIS'); +select hex(c), c, name from t1 order by 1; +drop table t1; + +--echo End of 5.0 tests diff --git a/mysql-test/t/ctype_big5.test b/mysql-test/t/ctype_big5.test index 200002cd235..8e17a27c550 100644 --- a/mysql-test/t/ctype_big5.test +++ b/mysql-test/t/ctype_big5.test @@ -63,4 +63,20 @@ drop table t1; # select hex(convert(_big5 0xC84041 using ucs2)); -# End of 4.1 tests +--echo End of 4.1 tests + +# +# Bug#26711 "binary content 0x00 sometimes becomes 0x5C 0x00 after dump/load" +# +create table t1 (a blob); +insert into t1 values (0xEE00); +--exec $MYSQL_DUMP --default-character-set=big5 -T $MYSQLTEST_VARDIR/master-data/test test t1 +delete from t1; +select hex(load_file('test/t1.txt')); +load data infile 't1.txt' into table t1; +select hex(a) from t1; +--exec rm $MYSQLTEST_VARDIR/master-data/test/t1.txt +--exec rm $MYSQLTEST_VARDIR/master-data/test/t1.sql +drop table t1; + +--echo End of 5.0 tests diff --git a/mysql-test/t/ctype_collate.test b/mysql-test/t/ctype_collate.test index aca240b46bc..4bbae42559a 100644 --- a/mysql-test/t/ctype_collate.test +++ b/mysql-test/t/ctype_collate.test @@ -207,3 +207,14 @@ EXPLAIN SELECT * FROM t1 WHERE s2 LIKE 'a' COLLATE latin1_german1_ci; DROP TABLE t1; # End of 4.1 tests + +# +# Bug#29261: Sort order of the collation wasn't used when comparing trailing +# spaces. +# +create table t1(f1 varchar(10) character set latin2 collate latin2_hungarian_ci, key(f1)); +insert into t1 set f1=0x3F3F9DC73F; +insert into t1 set f1=0x3F3F1E563F; +insert into t1 set f1=0x3F3F; +check table t1 extended; +drop table t1; diff --git a/mysql-test/t/ctype_cp932_binlog.test b/mysql-test/t/ctype_cp932_binlog.test index ee0e588fdae..7db8f311800 100644 --- a/mysql-test/t/ctype_cp932_binlog.test +++ b/mysql-test/t/ctype_cp932_binlog.test @@ -1,5 +1,6 @@ -- source include/not_embedded.inc -- source include/have_cp932.inc +-- source include/have_log_bin.inc --character_set cp932 --disable_warnings @@ -51,7 +52,7 @@ CALL bug18293("Foo's a Bar", _cp932 0xED40ED41ED42, 47.93)| SELECT HEX(s1),HEX(s2),d FROM t4| DROP PROCEDURE bug18293| DROP TABLE t4| -SHOW BINLOG EVENTS FROM 402| +SHOW BINLOG EVENTS FROM 362| delimiter ;| # End of 5.0 tests diff --git a/mysql-test/t/ctype_cp932_notembedded.test b/mysql-test/t/ctype_cp932_notembedded.test deleted file mode 100644 index 52e7acc3f01..00000000000 --- a/mysql-test/t/ctype_cp932_notembedded.test +++ /dev/null @@ -1,32 +0,0 @@ --- source include/not_embedded.inc --- source include/have_cp932.inc - ---character_set cp932 ---disable_warnings -drop table if exists t1; ---enable_warnings - -set names cp932; -set character_set_database = cp932; - -# Test prepared statement with 0x8300 sequence in parameter while -# running with cp932 client character set. -RESET MASTER; -CREATE TABLE t1(f1 blob); -PREPARE stmt1 FROM 'INSERT INTO t1 VALUES(?)'; -SET @var1= x'8300'; -# TODO: Note that this doesn't actually test the code which was added for -# bug#11338 because this syntax for prepared statements causes the PS to -# be replicated differently than if we executed the PS from C or Java. -# Using this syntax, variable names are inserted into the binlog instead -# of values. The real goal of this test is to check the code that was -# added to Item_param::query_val_str() in order to do hex encoding of -# PS parameters when the client character set is cp932; -# Bug#11338 has an example java program which can be used to verify this -# code (and I have used it to test the fix) until there is some way to -# exercise this code from mysql-test-run. -EXECUTE stmt1 USING @var1; -SHOW BINLOG EVENTS FROM 98; -SELECT HEX(f1) FROM t1; -DROP table t1; -# end test for bug#11338 diff --git a/mysql-test/t/ctype_ldml-master.opt b/mysql-test/t/ctype_ldml-master.opt new file mode 100644 index 00000000000..a2532d4cfd9 --- /dev/null +++ b/mysql-test/t/ctype_ldml-master.opt @@ -0,0 +1,2 @@ +--character-sets-dir=$MYSQL_TEST_DIR/std_data/ + diff --git a/mysql-test/t/ctype_ldml.test b/mysql-test/t/ctype_ldml.test new file mode 100644 index 00000000000..fc6ed0f2579 --- /dev/null +++ b/mysql-test/t/ctype_ldml.test @@ -0,0 +1,63 @@ +--source include/have_ucs2.inc + +--disable_warnings +drop table if exists t1; +--enable_warnings + +set names utf8; + +--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR +show variables like 'character_sets_dir%'; + +show collation like 'utf8_test_ci'; +create table t1 (c1 char(1) character set utf8 collate utf8_test_ci); +insert into t1 values ('a'); +select * from t1 where c1='b'; +drop table t1; + +show collation like 'ucs2_test_ci'; +create table t1 (c1 char(1) character set ucs2 collate ucs2_test_ci); +insert into t1 values ('a'); +select * from t1 where c1='b'; +drop table t1; + +# +# Vietnamese experimental collation +# + +show collation like 'ucs2_vn_ci'; +create table t1 (c1 char(1) character set ucs2 collate ucs2_vn_ci); +insert into t1 values (0x0061),(0x0041),(0x00E0),(0x00C0),(0x1EA3),(0x1EA2), + (0x00E3),(0x00C3),(0x00E1),(0x00C1),(0x1EA1),(0x1EA0); +insert into t1 values (0x0103),(0x0102),(0x1EB1),(0x1EB0),(0x1EB3),(0x1EB2), + (0x1EB5),(0x1EB4),(0x1EAF),(0x1EAE),(0x1EB7),(0x1EB6); +insert into t1 values (0x00E2),(0x00C2),(0x1EA7),(0x1EA6),(0x1EA9),(0x1EA8), + (0x1EAB),(0x1EAA),(0x1EA5),(0x1EA4),(0x1EAD),(0x1EAC); +insert into t1 values ('b'),('B'),('c'),('C'); +insert into t1 values ('d'),('D'),(0x0111),(0x0110); +insert into t1 values (0x0065),(0x0045),(0x00E8),(0x00C8),(0x1EBB),(0x1EBA), + (0x1EBD),(0x1EBC),(0x00E9),(0x00C9),(0x1EB9),(0x1EB8); +insert into t1 values (0x00EA),(0x00CA),(0x1EC1),(0x1EC0),(0x1EC3),(0x1EC2), + (0x1EC5),(0x1EC4),(0x1EBF),(0x1EBE),(0x1EC7),(0x1EC6); +insert into t1 values ('g'),('G'),('h'),('H'); +insert into t1 values (0x0069),(0x0049),(0x00EC),(0x00CC),(0x1EC9),(0x1EC8), + (0x0129),(0x0128),(0x00ED),(0x00CD),(0x1ECB),(0x1ECA); +insert into t1 values ('k'),('K'),('l'),('L'),('m'),('M'); +insert into t1 values (0x006F),(0x004F),(0x00F2),(0x00D2),(0x1ECF),(0x1ECE), + (0x00F5),(0x00D5),(0x00F3),(0x00D3),(0x1ECD),(0x1ECC); +insert into t1 values (0x00F4),(0x00D4),(0x1ED3),(0x1ED2),(0x1ED5),(0x1ED4), + (0x1ED7),(0x1ED6),(0x1ED1),(0x1ED0),(0x1ED9),(0x1ED8); +insert into t1 values (0x01A1),(0x01A0),(0x1EDD),(0x1EDC),(0x1EDF),(0x1EDE), + (0x1EE1),(0x1EE0),(0x1EDB),(0x1EDA),(0x1EE3),(0x1EE2); +insert into t1 values ('p'),('P'),('q'),('Q'),('r'),('R'),('s'),('S'),('t'),('T'); +insert into t1 values (0x0075),(0x0055),(0x00F9),(0x00D9),(0x1EE7),(0x1EE6), + (0x0169),(0x0168),(0x00FA),(0x00DA),(0x1EE5),(0x1EE4); +insert into t1 values (0x01B0),(0x01AF),(0x1EEB),(0x1EEA),(0x1EED),(0x1EEC), + (0x1EEF),(0x1EEE),(0x1EE9),(0x1EE8),(0x1EF1),(0x1EF0); +insert into t1 values ('v'),('V'),('x'),('X'); +insert into t1 values (0x0079),(0x0059),(0x1EF3),(0x1EF2),(0x1EF7),(0x1EF6), + (0x1EF9),(0x1EF8),(0x00FD),(0x00DD),(0x1EF5),(0x1EF4); +select hex(c1) as h, c1 from t1 order by c1, h; +select group_concat(hex(c1) order by hex(c1)) from t1 group by c1; +select group_concat(c1 order by hex(c1) SEPARATOR '') from t1 group by c1; +drop table t1; diff --git a/mysql-test/t/ctype_uca.test b/mysql-test/t/ctype_uca.test index 64349bc40a6..17632e7c8fc 100644 --- a/mysql-test/t/ctype_uca.test +++ b/mysql-test/t/ctype_uca.test @@ -485,3 +485,57 @@ CREATE TABLE t1 ( insert into t1 values (''),('a'); SELECT COUNT(*), c1 FROM t1 GROUP BY c1; DROP TABLE IF EXISTS t1; + +# +# Bug#27345 Incorrect data returned when range-read from utf8_danish_ci indexes +# +set names utf8; +create table t1 ( + a varchar(255), + key a(a) +) character set utf8 collate utf8_danish_ci; +insert into t1 values ('Ã¥aaaa'),('ååaaa'),('aaaaa'); +select a as like_a from t1 where a like 'a%'; +select a as like_aa from t1 where a like 'aa%'; +select a as like_aaa from t1 where a like 'aaa%'; +select a as like_aaaa from t1 where a like 'aaaa%'; +select a as like_aaaaa from t1 where a like 'aaaaa%'; +alter table t1 convert to character set ucs2 collate ucs2_danish_ci; +select a as like_a from t1 where a like 'a%'; +select a as like_aa from t1 where a like 'aa%'; +select a as like_aaa from t1 where a like 'aaa%'; +select a as like_aaaa from t1 where a like 'aaaa%'; +select a as like_aaaaa from t1 where a like 'aaaaa%'; +drop table t1; + +create table t1 ( + a varchar(255), + key(a) +) character set utf8 collate utf8_spanish2_ci; +insert into t1 values ('aaaaa'),('lllll'),('zzzzz'); +select a as like_l from t1 where a like 'l%'; +select a as like_ll from t1 where a like 'll%'; +select a as like_lll from t1 where a like 'lll%'; +select a as like_llll from t1 where a like 'llll%'; +select a as like_lllll from t1 where a like 'lllll%'; +alter table t1 convert to character set ucs2 collate ucs2_spanish2_ci; +select a as like_l from t1 where a like 'l%'; +select a as like_ll from t1 where a like 'll%'; +select a as like_lll from t1 where a like 'lll%'; +select a as like_llll from t1 where a like 'llll%'; +select a as like_lllll from t1 where a like 'lllll%'; +drop table t1; + +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' +insert into t1 values +('b'),('c'),('d'),('e'),('f'),('g'),('h'),('ch'),('i'),('j'); +select * from t1 where a like 'c%'; +alter table t1 convert to character set ucs2 collate ucs2_czech_ci; +select * from t1 where a like 'c%'; +drop table t1; + +-- echo End for 5.0 tests diff --git a/mysql-test/t/ctype_ucs.test b/mysql-test/t/ctype_ucs.test index c3320159c41..8828cd10eec 100644 --- a/mysql-test/t/ctype_ucs.test +++ b/mysql-test/t/ctype_ucs.test @@ -594,4 +594,22 @@ select data_type, character_octet_length, character_maximum_length from information_schema.columns where table_name='t1'; drop table t1; +# +# Bug#28925 GROUP_CONCAT inserts wrong separators for a ucs2 column +# +create table t1 (a char(1) character set ucs2); +insert into t1 values ('a'),('b'),('c'); +select hex(group_concat(a)) from t1; +select collation(group_concat(a)) from t1; +drop table t1; + +set names latin1; +create table t1 (a char(1) character set latin1); +insert into t1 values ('a'),('b'),('c'); +set character_set_connection=ucs2; +select hex(group_concat(a separator ',')) from t1; +select collation(group_concat(a separator ',')) from t1; +drop table t1; +set names latin1; + --echo End of 5.0 tests diff --git a/mysql-test/t/ctype_ucs2_def.test b/mysql-test/t/ctype_ucs2_def.test index e435d1fb07d..c80444daddd 100644 --- a/mysql-test/t/ctype_ucs2_def.test +++ b/mysql-test/t/ctype_ucs2_def.test @@ -14,3 +14,29 @@ DROP TABLE IF EXISTS t1; --enable_warnings create table t1 (a int); drop table t1; + +--echo End of 4.1 tests + +# +# Bug #28925 GROUP_CONCAT inserts wrong separators for a ucs2 column +# Check that GROUP_CONCAT works fine with --default-character-set=ucs2 +# +create table t1 (a char(1) character set latin1); +insert into t1 values ('a'),('b'),('c'); +select hex(group_concat(a)) from t1; +drop table t1; +# +# Bug #27643: query failed : 1114 (The table '' is full) +# +# Check that HASH indexes ignore trailing spaces when comparing +# strings with the ucs2_bin collation + +CREATE TABLE t1(col1 VARCHAR(32) CHARACTER SET ucs2 COLLATE ucs2_bin NOT NULL, + col2 VARCHAR(32) CHARACTER SET ucs2 COLLATE ucs2_bin NOT NULL, + UNIQUE KEY key1 USING HASH (col1, col2)) ENGINE=MEMORY; +INSERT INTO t1 VALUES('A', 'A'), ('B', 'B'), ('C', 'C'); +--error ER_DUP_ENTRY +INSERT INTO t1 VALUES('A ', 'A '); +DROP TABLE t1; + +--echo End of 5.0 tests diff --git a/mysql-test/t/ctype_ucs_binlog.test b/mysql-test/t/ctype_ucs_binlog.test index 2467d34386c..92d4458a9c2 100644 --- a/mysql-test/t/ctype_ucs_binlog.test +++ b/mysql-test/t/ctype_ucs_binlog.test @@ -1,5 +1,6 @@ --source include/not_embedded.inc --source include/have_ucs2.inc +--source include/have_log_bin.inc # # Check correct binlogging of UCS2 user variables (BUG#3875) diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test index c4637d14edc..0f1a7cf8c84 100644 --- a/mysql-test/t/ctype_utf8.test +++ b/mysql-test/t/ctype_utf8.test @@ -1338,3 +1338,28 @@ INSERT INTO t2 (colA, colB) VALUES (1, 'foo'),(2, 'foo bar'); SELECT * FROM t1 JOIN t2 ON t1.colA=t2.colA AND t1.colB=t2.colB WHERE t1.colA < 3; DROP TABLE t1, t2; + +# +# Bug#29205: truncation of UTF8 values when the UNION statement +# forces collation to the binary charset +# + +SELECT 'н1234567890' UNION SELECT _binary '1'; +SELECT 'н1234567890' UNION SELECT 1; + +SELECT '1' UNION SELECT 'н1234567890'; +SELECT 1 UNION SELECT 'н1234567890'; + +CREATE TABLE t1 (c VARCHAR(11)) CHARACTER SET utf8; +CREATE TABLE t2 (b CHAR(1) CHARACTER SET binary, i INT); + +INSERT INTO t1 (c) VALUES ('н1234567890'); +INSERT INTO t2 (b, i) VALUES ('1', 1); + +SELECT c FROM t1 UNION SELECT b FROM t2; +SELECT c FROM t1 UNION SELECT i FROM t2; + +SELECT b FROM t2 UNION SELECT c FROM t1; +SELECT i FROM t2 UNION SELECT c FROM t1; + +DROP TABLE t1, t2; diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index 85685234de9..9d6a9b57e9a 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -10,7 +10,9 @@ # ############################################################################## -ndb_load : Bug#17233 user_limits : Bug#23921 random failure of user_limits.test im_life_cycle : Bug#27851: Instance manager test im_life_cycle fails randomly im_daemon_life_cycle : Bug#20294: Instance manager tests fail randomly +im_options_set : Bug#20294: Instance manager tests fail randomly +im_options_unset : Bug#20294: Instance manager tests fail randomly +im_utils : Bug#20294: Instance manager tests fail randomly diff --git a/mysql-test/t/drop_temp_table.test b/mysql-test/t/drop_temp_table.test index bc06de4096c..b456e75576b 100644 --- a/mysql-test/t/drop_temp_table.test +++ b/mysql-test/t/drop_temp_table.test @@ -1,5 +1,4 @@ -# Embedded server doesn't support binlog --- source include/not_embedded.inc +-- source include/have_log_bin.inc --disable_warnings drop database if exists `drop-temp+table-test`; diff --git a/mysql-test/t/error_simulation-master.opt b/mysql-test/t/error_simulation-master.opt new file mode 100644 index 00000000000..edb77cfa85e --- /dev/null +++ b/mysql-test/t/error_simulation-master.opt @@ -0,0 +1 @@ +--loose-debug=d,raise_error diff --git a/mysql-test/t/error_simulation.test b/mysql-test/t/error_simulation.test new file mode 100644 index 00000000000..8c044224b8a --- /dev/null +++ b/mysql-test/t/error_simulation.test @@ -0,0 +1,29 @@ +-- source include/have_debug.inc + +# +# Bug #28499: crash for grouping query when tmp_table_size is too small +# + +DROP TABLE IF EXISTS t1; + +CREATE TABLE t1 ( + a varchar(32) character set utf8 collate utf8_bin NOT NULL, + b varchar(32) character set utf8 collate utf8_bin NOT NULL ) +ENGINE=MyISAM DEFAULT CHARSET=utf8; + +INSERT INTO t1 VALUES + ('AAAAAAAAAA','AAAAAAAAAA'), ('AAAAAAAAAB','AAAAAAAAAB '), + ('AAAAAAAAAB','AAAAAAAAAB'), ('AAAAAAAAAC','AAAAAAAAAC'), + ('AAAAAAAAAD','AAAAAAAAAD'), ('AAAAAAAAAE','AAAAAAAAAE'), + ('AAAAAAAAAF','AAAAAAAAAF'), ('AAAAAAAAAG','AAAAAAAAAG'), + ('AAAAAAAAAH','AAAAAAAAAH'), ('AAAAAAAAAI','AAAAAAAAAI'), + ('AAAAAAAAAJ','AAAAAAAAAJ'), ('AAAAAAAAAK','AAAAAAAAAK'); + +set tmp_table_size=1024; + +--error ER_DUP_KEY +SELECT MAX(a) FROM t1 GROUP BY a,b; + +set tmp_table_size=default; + +DROP TABLE t1; diff --git a/mysql-test/t/errors.test b/mysql-test/t/errors.test index 4fbdcba635f..89579ec1739 100644 --- a/mysql-test/t/errors.test +++ b/mysql-test/t/errors.test @@ -53,4 +53,17 @@ INSERT INTO t1 VALUES(2),(3); SELECT a FROM t1 WHERE a IN(1, (SELECT IF(1=0,1,2/0))); DROP TABLE t1; +# +# Bug #28677: SELECT on missing column gives extra error +# +CREATE TABLE t1( a INT ); +--error ER_BAD_FIELD_ERROR +SELECT b FROM t1; +SHOW ERRORS; +--error ER_BAD_FIELD_ERROR +CREATE TABLE t2 SELECT b FROM t1; +SHOW ERRORS; +--error ER_BAD_FIELD_ERROR +INSERT INTO t1 SELECT b FROM t1; +DROP TABLE t1; # End of 5.0 tests diff --git a/mysql-test/t/federated.test b/mysql-test/t/federated.test index 894cd513914..bedb6b36d61 100644 --- a/mysql-test/t/federated.test +++ b/mysql-test/t/federated.test @@ -1576,4 +1576,57 @@ connection slave; drop table federated.t1; +# +# BUG#21019 Federated Engine does not support REPLACE/INSERT IGNORE/UPDATE IGNORE +# +connection slave; +create table federated.t1 (a int primary key, b varchar(64)) + DEFAULT CHARSET=utf8; +connection master; +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval create table federated.t1 (a int primary key, b varchar(64)) + ENGINE=FEDERATED + connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1' + DEFAULT CHARSET=utf8; + +insert ignore into federated.t1 values (1,"Larry"), (2,"Curly"), (1,"Moe"); +select * from federated.t1; + +truncate federated.t1; +replace into federated.t1 values (1,"Larry"), (2,"Curly"), (1,"Moe"); +select * from federated.t1; + +update ignore federated.t1 set a=a+1; +select * from federated.t1; + +drop table federated.t1; +connection slave; +drop table federated.t1; + +# +# BUG#25511 Federated Insert failures. +# +# When the user performs a INSERT...ON DUPLICATE KEY UPDATE, we want +# it to fail if a duplicate key exists instead of ignoring it. +# +connection slave; +create table federated.t1 (a int primary key, b varchar(64)) + DEFAULT CHARSET=utf8; +connection master; +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval create table federated.t1 (a int primary key, b varchar(64)) + ENGINE=FEDERATED + connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1' + DEFAULT CHARSET=utf8; + +--error ER_DUP_KEY +insert into federated.t1 values (1,"Larry"), (2,"Curly"), (1,"Moe") +on duplicate key update a=a+100; +select * from federated.t1; + +drop table federated.t1; +connection slave; +drop table federated.t1; + + source include/federated_cleanup.inc; diff --git a/mysql-test/t/federated_innodb-slave.opt b/mysql-test/t/federated_innodb-slave.opt new file mode 100644 index 00000000000..627becdbfb5 --- /dev/null +++ b/mysql-test/t/federated_innodb-slave.opt @@ -0,0 +1 @@ +--innodb diff --git a/mysql-test/t/federated_innodb.test b/mysql-test/t/federated_innodb.test new file mode 100644 index 00000000000..772e37a2929 --- /dev/null +++ b/mysql-test/t/federated_innodb.test @@ -0,0 +1,34 @@ +source include/federated.inc; +source include/have_innodb.inc; + +# +# Bug#25513 Federated transaction failures +# +connection slave; +create table federated.t1 (a int primary key, b varchar(64)) + engine=myisam; +connection master; +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval create table federated.t1 (a int primary key, b varchar(64)) + engine=federated + connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; + +--error ER_DUP_KEY +insert into federated.t1 values (1,"Larry"), (2,"Curly"), (1,"Moe"); +select * from federated.t1; + +connection slave; +truncate federated.t1; +alter table federated.t1 engine=innodb; +connection master; + +--error ER_DUP_KEY +insert into federated.t1 values (1,"Larry"), (2,"Curly"), (1,"Moe"); +select * from federated.t1; + +drop table federated.t1; +connection slave; +drop table federated.t1; + + +source include/federated_cleanup.inc; diff --git a/mysql-test/t/flush_block_commit_notembedded.test b/mysql-test/t/flush_block_commit_notembedded.test index 4650a5a15a8..4a0300acf78 100644 --- a/mysql-test/t/flush_block_commit_notembedded.test +++ b/mysql-test/t/flush_block_commit_notembedded.test @@ -3,8 +3,10 @@ # We verify that we did not introduce a deadlock. # This is intended to mimick how mysqldump and innobackup work. +-- source include/have_log_bin.inc + # And it requires InnoDB --- source include/not_embedded.inc +-- source include/have_log_bin.inc -- source include/have_innodb.inc connect (con1,localhost,root,,); diff --git a/mysql-test/t/fulltext3.test b/mysql-test/t/fulltext3.test new file mode 100644 index 00000000000..a57fd48daaa --- /dev/null +++ b/mysql-test/t/fulltext3.test @@ -0,0 +1,24 @@ +--source include/have_gbk.inc +# +# test of new fulltext search features +# + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + + +# +# BUG#29299 - repeatable myisam fulltext index corruption +# +CREATE TABLE t1(a VARCHAR(255) CHARACTER SET gbk, FULLTEXT(a)); +SET NAMES utf8; +INSERT INTO t1 VALUES(0xF043616161),(0xBEF361616197C22061616161); +SELECT HEX(a) FROM t1 WHERE MATCH(a) AGAINST(0x97C22061616161 IN BOOLEAN MODE); +DELETE FROM t1 LIMIT 1; +CHECK TABLE t1; +SET NAMES latin1; +DROP TABLE t1; + +# End of 5.0 tests + diff --git a/mysql-test/t/func_date_add.test b/mysql-test/t/func_date_add.test index b575eeececa..fc5a5cb2823 100644 --- a/mysql-test/t/func_date_add.test +++ b/mysql-test/t/func_date_add.test @@ -77,4 +77,14 @@ SELECT CAST('2006-09-26' AS DATE) + INTERVAL 1 MONTH; SELECT CAST('2006-09-26' AS DATE) + INTERVAL 1 YEAR; SELECT CAST('2006-09-26' AS DATE) + INTERVAL 1 WEEK; +# +# Bug#28450: The Item_date_add_interval in select list may fail the field +# type assertion. +# +create table t1 (a int, b varchar(10)); +insert into t1 values (1, '2001-01-01'),(2, '2002-02-02'); +select '2007-01-01' + interval a day from t1; +select b + interval a day from t1; +drop table t1; + --echo End of 5.0 tests diff --git a/mysql-test/t/func_gconcat.test b/mysql-test/t/func_gconcat.test index 7771f216f69..767df5ae233 100644 --- a/mysql-test/t/func_gconcat.test +++ b/mysql-test/t/func_gconcat.test @@ -520,5 +520,35 @@ SELECT GROUP_CONCAT( a ORDER BY b ) FROM t1; SELECT GROUP_CONCAT( DISTINCT a ORDER BY b ) FROM t1; SET group_concat_max_len = DEFAULT; DROP TABLE t1; +# Bug #23856:GROUP_CONCAT and ORDER BY: junk from previous rows for query on I_S +# +SET group_concat_max_len= 65535; +CREATE TABLE t1( a TEXT, b INTEGER ); +INSERT INTO t1 VALUES ( 'a', 0 ), ( 'b', 1 ); +SELECT GROUP_CONCAT( a ORDER BY b ) FROM t1; +SELECT GROUP_CONCAT(DISTINCT a ORDER BY b) FROM t1; +SELECT GROUP_CONCAT(DISTINCT a) FROM t1; +SET group_concat_max_len= 10; +SELECT GROUP_CONCAT(a ORDER BY b) FROM t1; +SELECT GROUP_CONCAT(DISTINCT a ORDER BY b) FROM t1; +SELECT GROUP_CONCAT(DISTINCT a) FROM t1; + +SET group_concat_max_len= 65535; +CREATE TABLE t2( a TEXT ); +INSERT INTO t2 VALUES( REPEAT( 'a', 5000 ) ); +INSERT INTO t2 VALUES( REPEAT( 'b', 5000 ) ); +INSERT INTO t2 VALUES( REPEAT( 'a', 5000 ) ); +SELECT LENGTH( GROUP_CONCAT( DISTINCT a ) ) FROM t2; + +CREATE TABLE t3( a TEXT, b INT ); +INSERT INTO t3 VALUES( REPEAT( 'a', 65534 ), 1 ); +INSERT INTO t3 VALUES( REPEAT( 'a', 65535 ), 2 ); +INSERT INTO t3 VALUES( REPEAT( 'a', 65536 ), 3 ); +SELECT LENGTH( GROUP_CONCAT( a ) ) FROM t3 WHERE b = 1; +SELECT LENGTH( GROUP_CONCAT( a ) ) FROM t3 WHERE b = 2; +SELECT LENGTH( GROUP_CONCAT( a ) ) FROM t3 WHERE b = 3; + +SET group_concat_max_len= DEFAULT; +DROP TABLE t1, t2, t3; --echo End of 5.0 tests diff --git a/mysql-test/t/func_in.test b/mysql-test/t/func_in.test index 77592d015eb..a84ffada1ee 100644 --- a/mysql-test/t/func_in.test +++ b/mysql-test/t/func_in.test @@ -335,19 +335,28 @@ insert into t2 values(13491727406643098568), (0x8000004000000001), (0x8000040000000001); -SELECT HEX(a) FROM t2 WHERE a IN (0xBB3C3E98175D33C8, 42); +SELECT HEX(a) FROM t2 WHERE a IN + (CAST(0xBB3C3E98175D33C8 AS UNSIGNED), + 42); SELECT HEX(a) FROM t2 WHERE a IN -(0xBB3C3E98175D33C8, - 0x7fffffffffffffff, - 0x8000000000000000, - 0x8000000000000400, - 0x8000000000000401, - 42); + (CAST(0xBB3C3E98175D33C8 AS UNSIGNED), + CAST(0x7fffffffffffffff AS UNSIGNED), + CAST(0x8000000000000000 AS UNSIGNED), + CAST(0x8000000000000400 AS UNSIGNED), + CAST(0x8000000000000401 AS UNSIGNED), + 42); -SELECT HEX(a) FROM t2 WHERE a IN (0x7fffffffffffffff,0x8000000000000001); -SELECT HEX(a) FROM t2 WHERE a IN (0x7ffffffffffffffe,0x7fffffffffffffff); -SELECT HEX(a) FROM t2 WHERE a IN (0x7ffffffffffffffe,0x7fffffffffffffff,'abc'); +SELECT HEX(a) FROM t2 WHERE a IN + (CAST(0x7fffffffffffffff AS UNSIGNED), + CAST(0x8000000000000001 AS UNSIGNED)); +SELECT HEX(a) FROM t2 WHERE a IN + (CAST(0x7ffffffffffffffe AS UNSIGNED), + CAST(0x7fffffffffffffff AS UNSIGNED)); +SELECT HEX(a) FROM t2 WHERE a IN + (0x7ffffffffffffffe, + 0x7fffffffffffffff, + 'abc'); CREATE TABLE t3 (a BIGINT UNSIGNED); INSERT INTO t3 VALUES (9223372036854775551); diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test index bca977e6df3..1a32580aa0f 100644 --- a/mysql-test/t/func_str.test +++ b/mysql-test/t/func_str.test @@ -1076,4 +1076,52 @@ SELECT * FROM (SELECT * FROM v1) x; DROP TABLE t1, t2; DROP VIEW v1; +# +# Bug #27932: LOCATE with argument evaluated to NULL +# + +SELECT LOCATE('foo', NULL) FROM DUAL; +SELECT LOCATE(NULL, 'o') FROM DUAL; +SELECT LOCATE(NULL, NULL) FROM DUAL; +SELECT LOCATE('foo', NULL) IS NULL FROM DUAL; +SELECT LOCATE(NULL, 'o') IS NULL FROM DUAL; +SELECT LOCATE(NULL, NULL) IS NULL FROM DUAL; +SELECT ISNULL(LOCATE('foo', NULL)) FROM DUAL; +SELECT ISNULL(LOCATE(NULL, 'o')) FROM DUAL; +SELECT ISNULL(LOCATE(NULL, NULL)) FROM DUAL; +SELECT LOCATE('foo', NULL) <=> NULL FROM DUAL; +SELECT LOCATE(NULL, 'o') <=> NULL FROM DUAL; +SELECT LOCATE(NULL, NULL) <=> NULL FROM DUAL; + +CREATE TABLE t1 (id int NOT NULL PRIMARY KEY, a varchar(10), p varchar(10)); + +INSERT INTO t1 VALUES (1, 'foo', 'o'); +INSERT INTO t1 VALUES (2, 'foo', NULL); +INSERT INTO t1 VALUES (3, NULL, 'o'); +INSERT INTO t1 VALUES (4, NULL, NULL); + +SELECT id, LOCATE(a,p) FROM t1; +SELECT id, LOCATE(a,p) IS NULL FROM t1; +SELECT id, ISNULL(LOCATE(a,p)) FROM t1; +SELECT id, LOCATE(a,p) <=> NULL FROM t1; +SELECT id FROM t1 WHERE LOCATE(a,p) IS NULL; +SELECT id FROM t1 WHERE LOCATE(a,p) <=> NULL; + +DROP TABLE t1; + +# +# Bug #27130: SUBSTR with UNSIGNED 0 as the last argument +# + +SELECT SUBSTR('foo',1,0) FROM DUAL; +SELECT SUBSTR('foo',1,CAST(0 AS SIGNED)) FROM DUAL; +SELECT SUBSTR('foo',1,CAST(0 AS UNSIGNED)) FROM DUAL; + +CREATE TABLE t1 (a varchar(10), len int unsigned); +INSERT INTO t1 VALUES ('bar', 2), ('foo', 0); + +SELECT SUBSTR(a,1,len) FROM t1; + +DROP TABLE t1; + --echo End of 5.0 tests diff --git a/mysql-test/t/gis.test b/mysql-test/t/gis.test index ccc38db8dea..79743a0b8f4 100644 --- a/mysql-test/t/gis.test +++ b/mysql-test/t/gis.test @@ -557,4 +557,37 @@ SELECT Overlaps(@horiz1, @point2) FROM DUAL; DROP TABLE t1; +# +# Bug#28763: Selecting geometry fields in UNION caused server crash. +# +create table t1(f1 geometry, f2 point, f3 linestring); +select f1 from t1 union select f1 from t1; +insert into t1 (f2,f3) values (GeomFromText('POINT(1 1)'), + GeomFromText('LINESTRING(0 0,1 1,2 2)')); +select AsText(f2),AsText(f3) from t1; +select AsText(a) from (select f2 as a from t1 union select f3 from t1) t; +create table t2 as select f2 as a from t1 union select f3 from t1; +desc t2; +select AsText(a) from t2; +drop table t1, t2; + +# +# Bug #29166: MYsql crash when query is run +# + +# The test query itself is not logged : too large output. +# The real test is the second query : see if the first hasn't crashed the +# server +--disable_query_log +--disable_result_log +SELECT AsText(GeometryFromText(CONCAT( + 'MULTIPOLYGON(((', + REPEAT ('-0.00000000001234567890123456789012 -0.123456789012345678,', 1000), + '-0.00000000001234567890123456789012 -0.123456789012345678', + ')))' +))) AS a; +--enable_result_log +--enable_query_log +SELECT 1; + --echo End of 5.0 tests diff --git a/mysql-test/t/grant.test b/mysql-test/t/grant.test index aa43e4225c5..32eb262fd51 100644 --- a/mysql-test/t/grant.test +++ b/mysql-test/t/grant.test @@ -890,7 +890,7 @@ REVOKE EXECUTE ON PROCEDURE t1 FROM some_user_name@1234567890abcdefghij123456789 # Bug #6774: Replication fails with Wrong usage of DB GRANT and GLOBAL PRIVILEGES # # Check if GRANT ... ON * ... fails when no database is selected -connect (con1, localhost, root,,*NO-ONE*) +connect (con1, localhost, root,,*NO-ONE*); connection con1; --error ER_NO_DB_ERROR GRANT PROCESS ON * TO user@localhost; diff --git a/mysql-test/t/grant2.test b/mysql-test/t/grant2.test index d08a9e3f83d..a3a8e2d5d53 100644 --- a/mysql-test/t/grant2.test +++ b/mysql-test/t/grant2.test @@ -513,3 +513,77 @@ disconnect bug13310; connection default; REVOKE ALL PRIVILEGES, GRANT OPTION FROM `a@`@localhost; drop user `a@`@localhost; + + +# +# Bug#25578 "CREATE TABLE LIKE does not require any privileges on source table" +# +--disable_warnings +drop database if exists mysqltest_1; +drop database if exists mysqltest_2; +--enable_warnings +--error 0,ER_CANNOT_USER +drop user mysqltest_u1@localhost; + +create database mysqltest_1; +create database mysqltest_2; +grant all on mysqltest_1.* to mysqltest_u1@localhost; +use mysqltest_2; +create table t1 (i int); + +# Connect as user with all rights on mysqltest_1 but with no rights on mysqltest_2. +connect (user1,localhost,mysqltest_u1,,mysqltest_1); +connection user1; +# As expected error is emitted +--error ER_TABLEACCESS_DENIED_ERROR +show create table mysqltest_2.t1; +# This should emit error as well +--error ER_TABLEACCESS_DENIED_ERROR +create table t1 like mysqltest_2.t1; + +# Now let us check that SELECT privilege on the source is enough +connection default; +grant select on mysqltest_2.t1 to mysqltest_u1@localhost; +connection user1; +show create table mysqltest_2.t1; +create table t1 like mysqltest_2.t1; + +# Clean-up +connection default; +use test; +drop database mysqltest_1; +drop database mysqltest_2; +drop user mysqltest_u1@localhost; + +# +# Bug#18660 Can't grant any privileges on single table in database +# with underscore char +# +grant all on `mysqltest\_%`.* to mysqltest_1@localhost with grant option; +grant usage on *.* to mysqltest_2@localhost; +connect (con18600_1,localhost,mysqltest_1,,); + +create database mysqltest_1; +use mysqltest_1; +create table t1 (f1 int); + +grant create on `mysqltest\_1`.* to mysqltest_2@localhost; +grant select on mysqltest_1.t1 to mysqltest_2@localhost; +connect (con3,localhost,mysqltest_2,,); +connection con3; +--error 1044 +create database mysqltest_3; +use mysqltest_1; +create table t2(f1 int); +select * from t1; +connection default; +drop database mysqltest_1; + +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; + + +--echo End of 5.0 tests + diff --git a/mysql-test/t/greedy_optimizer.test b/mysql-test/t/greedy_optimizer.test index 049d0ab09f7..b73f70c6a3e 100644 --- a/mysql-test/t/greedy_optimizer.test +++ b/mysql-test/t/greedy_optimizer.test @@ -145,11 +145,11 @@ select @@optimizer_prune_level; # # These are the values for the parameters that control the greedy optimizer # (total 6 combinations - 3 for optimizer_search_depth, 2 for optimizer_prune_level): --- +# 3: # set optimizer_search_depth=0; - automatic # set optimizer_search_depth=1; - min # set optimizer_search_depth=62; - max (default) --- +# 2: # set optimizer_prune_level=0 - exhaustive; # set optimizer_prune_level=1 - heuristic; # default diff --git a/mysql-test/t/group_min_max.test b/mysql-test/t/group_min_max.test index b3049498f90..e1010c9fcfe 100644 --- a/mysql-test/t/group_min_max.test +++ b/mysql-test/t/group_min_max.test @@ -870,3 +870,25 @@ DELETE FROM t3 WHERE (SELECT (SELECT MAX(b) FROM t1 GROUP BY a HAVING a < 2) x SHOW STATUS LIKE 'handler_read__e%'; DROP TABLE t1,t2,t3; + +# +# Bug#25602: queries with DISTINCT and SQL_BIG_RESULT hint +# for which loose scan optimization is applied +# + +CREATE TABLE t1 (a int, INDEX idx(a)); +INSERT INTO t1 VALUES + (4), (2), (1), (2), (4), (2), (1), (4), + (4), (2), (1), (2), (2), (4), (1), (4); + +EXPLAIN SELECT DISTINCT(a) FROM t1; +SELECT DISTINCT(a) FROM t1; +EXPLAIN SELECT SQL_BIG_RESULT DISTINCT(a) FROM t1; +SELECT SQL_BIG_RESULT DISTINCT(a) FROM t1; + +DROP TABLE t1; + + + + + diff --git a/mysql-test/t/heap_hash.test b/mysql-test/t/heap_hash.test index 28a75a5ee11..c0f37fe490e 100644 --- a/mysql-test/t/heap_hash.test +++ b/mysql-test/t/heap_hash.test @@ -260,4 +260,27 @@ select a from t1 where a in (1,3); explain select a from t1 where a in (1,3); drop table t1; -# End of 4.1 tests +--echo End of 4.1 tests + +# +# Bug #27643: query failed : 1114 (The table '' is full) +# +# Check that HASH indexes disregard trailing spaces when comparing +# strings with binary collations + +CREATE TABLE t1(col1 VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, + col2 VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, + UNIQUE KEY key1 USING HASH (col1, col2)) ENGINE=MEMORY; +INSERT INTO t1 VALUES('A', 'A'); +--error ER_DUP_ENTRY +INSERT INTO t1 VALUES('A ', 'A '); +DROP TABLE t1; +CREATE TABLE t1(col1 VARCHAR(32) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL, + col2 VARCHAR(32) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL, + UNIQUE KEY key1 USING HASH (col1, col2)) ENGINE=MEMORY; +INSERT INTO t1 VALUES('A', 'A'); +--error ER_DUP_ENTRY +INSERT INTO t1 VALUES('A ', 'A '); +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 f8922317eb3..1d368ac6075 100644 --- a/mysql-test/t/information_schema.test +++ b/mysql-test/t/information_schema.test @@ -1023,4 +1023,19 @@ where t.table_schema = 'information_schema' and group by c2.column_type order by num limit 1) group by t.table_name order by num1, t.table_name; +# +# Bug#28266 IS_UPDATABLE field on VIEWS table in I_S database is wrong +# +create table t1(f1 int); +create view v1 as select f1+1 as a from t1; +create table t2 (f1 int, f2 int); +create view v2 as select f1+1 as a, f2 as b from t2; +select table_name, is_updatable from information_schema.views; +# +# Note: we can perform 'delete' for non updatable view. +# +delete from v1; +drop view v1,v2; +drop table t1,t2; + # End of 5.0 tests. diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test index f7fa7366101..a9679c01071 100644 --- a/mysql-test/t/innodb.test +++ b/mysql-test/t/innodb.test @@ -753,6 +753,45 @@ select * from t1; select * from t2; drop table t1,t2; +# +# Bug#27716 multi-update did partially and has not binlogged +# + +CREATE TABLE `t1` ( + `a` int(11) NOT NULL auto_increment, + `b` int(11) default NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 ; + +CREATE TABLE `t2` ( + `a` int(11) NOT NULL auto_increment, + `b` int(11) default NULL, + PRIMARY KEY (`a`) +) ENGINE=INNODB DEFAULT CHARSET=latin1 ; + +# A. testing multi_update::send_eof() execution branch +insert into t1 values (1,1),(2,2); +insert into t2 values (1,1),(4,4); +reset master; +--error ER_DUP_ENTRY +UPDATE t2,t1 SET t2.a=t1.a+2; +# check +select * from t2 /* must be (3,1), (4,4) */; +show master status /* there must no UPDATE in binlog */; + +# B. testing multi_update::send_error() execution branch +delete from t1; +delete from t2; +insert into t1 values (1,2),(3,4),(4,4); +insert into t2 values (1,2),(3,4),(4,4); +reset master; +--error ER_DUP_ENTRY +UPDATE t2,t1 SET t2.a=t2.b where t2.a=t1.a; +show master status /* there must be no UPDATE query event */; + +# cleanup bug#27716 +drop table t1, t2; + # # Testing of IFNULL # @@ -1154,40 +1193,6 @@ show create table t2; drop table t2, t1; -# -# Let us test binlog_cache_use and binlog_cache_disk_use status vars. -# Actually this test has nothing to do with innodb per se, it just requires -# transactional table. -# -show status like "binlog_cache_use"; -show status like "binlog_cache_disk_use"; - -create table t1 (a int) engine=innodb; - -# Now we are going to create transaction which is long enough so its -# transaction binlog will be flushed to disk... -let $1=2000; -disable_query_log; -begin; -while ($1) -{ - eval insert into t1 values( $1 ); - dec $1; -} -commit; -enable_query_log; -show status like "binlog_cache_use"; -show status like "binlog_cache_disk_use"; - -# Transaction which should not be flushed to disk and so should not -# increase binlog_cache_disk_use. -begin; -delete from t1; -commit; -show status like "binlog_cache_use"; -show status like "binlog_cache_disk_use"; -drop table t1; - # # Bug #6126: Duplicate columns in keys gives misleading error message # diff --git a/mysql-test/t/innodb_mysql.test b/mysql-test/t/innodb_mysql.test index d9e50add8bf..d4ce997ddb1 100644 --- a/mysql-test/t/innodb_mysql.test +++ b/mysql-test/t/innodb_mysql.test @@ -1,7 +1,7 @@ -- source include/have_innodb.inc --disable_warnings -drop table if exists t1,t2; +drop table if exists t1,t2,t3,t4; --enable_warnings # BUG#16798: Uninitialized row buffer reads in ref-or-null optimizer @@ -597,4 +597,148 @@ EXPLAIN SELECT COUNT(*) FROM t2 WHERE stat_id IN (1,3) AND acct_id=785; DROP TABLE t1,t2; +# +# Bug #28652: assert when alter innodb table operation +# +create table t1(a int) engine=innodb; +alter table t1 comment '123'; +show create table t1; +drop table t1; + +# +# Bug #25866: Getting "#HY000 Can't find record in..." on and INSERT +# +CREATE TABLE t1 (a CHAR(2), KEY (a)) ENGINE = InnoDB DEFAULT CHARSET=UTF8; +INSERT INTO t1 VALUES ('uk'),('bg'); +SELECT * FROM t1 WHERE a = 'uk'; +DELETE FROM t1 WHERE a = 'uk'; +SELECT * FROM t1 WHERE a = 'uk'; +UPDATE t1 SET a = 'us' WHERE a = 'uk'; +SELECT * FROM t1 WHERE a = 'uk'; + +CREATE TABLE t2 (a CHAR(2), KEY (a)) ENGINE = InnoDB; +INSERT INTO t2 VALUES ('uk'),('bg'); +SELECT * FROM t2 WHERE a = 'uk'; +DELETE FROM t2 WHERE a = 'uk'; +SELECT * FROM t2 WHERE a = 'uk'; +INSERT INTO t2 VALUES ('uk'); +UPDATE t2 SET a = 'us' WHERE a = 'uk'; +SELECT * FROM t2 WHERE a = 'uk'; + +CREATE TABLE t3 (a CHAR(2), KEY (a)) ENGINE = MyISAM; +INSERT INTO t3 VALUES ('uk'),('bg'); +SELECT * FROM t3 WHERE a = 'uk'; +DELETE FROM t3 WHERE a = 'uk'; +SELECT * FROM t3 WHERE a = 'uk'; +INSERT INTO t3 VALUES ('uk'); +UPDATE t3 SET a = 'us' WHERE a = 'uk'; +SELECT * FROM t3 WHERE a = 'uk'; + +DROP TABLE t1,t2,t3; + +# +# Test bug when trying to drop data file which no InnoDB directory entry +# + +create table t1 (a int) engine=innodb; +copy_file $MYSQLTEST_VARDIR/master-data/test/t1.frm $MYSQLTEST_VARDIR/master-data/test/t2.frm; +--error 1146 +select * from t2; +drop table t1; +--error 1051 +drop table t2; +create table t2 (a int); +drop table t2; + + +# +# Bug #29154: LOCK TABLES is not atomic when >1 InnoDB tables are locked +# + +CREATE TABLE t1 (a INT) ENGINE=InnoDB; +CREATE TABLE t2 (a INT) ENGINE=InnoDB; + +CONNECT (c1,localhost,root,,); +CONNECT (c2,localhost,root,,); + +--echo switch to connection c1 +CONNECTION c1; +SET AUTOCOMMIT=0; +INSERT INTO t2 VALUES (1); + +--echo switch to connection c2 +CONNECTION c2; +SET AUTOCOMMIT=0; +--error ER_LOCK_WAIT_TIMEOUT +LOCK TABLES t1 READ, t2 READ; + +--echo switch to connection c1 +CONNECTION c1; +COMMIT; +INSERT INTO t1 VALUES (1); + +--echo switch to connection default +CONNECTION default; +SET AUTOCOMMIT=default; +DISCONNECT c1; +DISCONNECT c2; +DROP TABLE t1,t2; + +# +# Bug #25798: a query with forced index merge returns wrong result +# + +CREATE TABLE t1 ( + id int NOT NULL auto_increment PRIMARY KEY, + b int NOT NULL, + c datetime NOT NULL, + INDEX idx_b(b), + INDEX idx_c(c) +) ENGINE=InnoDB; + +CREATE TABLE t2 ( + b int NOT NULL auto_increment PRIMARY KEY, + c datetime NOT NULL +) ENGINE= MyISAM; + +INSERT INTO t2(c) VALUES ('2007-01-01'); +INSERT INTO t2(c) SELECT c FROM t2; +INSERT INTO t2(c) SELECT c FROM t2; +INSERT INTO t2(c) SELECT c FROM t2; +INSERT INTO t2(c) SELECT c FROM t2; +INSERT INTO t2(c) SELECT c FROM t2; +INSERT INTO t2(c) SELECT c FROM t2; +INSERT INTO t2(c) SELECT c FROM t2; +INSERT INTO t2(c) SELECT c FROM t2; +INSERT INTO t2(c) SELECT c FROM t2; +INSERT INTO t2(c) SELECT c FROM t2; + +INSERT INTO t1(b,c) SELECT b,c FROM t2; +UPDATE t2 SET c='2007-01-02'; +INSERT INTO t1(b,c) SELECT b,c FROM t2; +UPDATE t2 SET c='2007-01-03'; +INSERT INTO t1(b,c) SELECT b,c FROM t2; + +set @@sort_buffer_size=8192; + +SELECT COUNT(*) FROM t1; + +--replace_column 9 # +EXPLAIN +SELECT COUNT(*) FROM t1 + WHERE (c >= '2007-01-02' AND c <= '2007-01-03') OR b >= 1; +SELECT COUNT(*) FROM t1 + WHERE (c >= '2007-01-02' AND c <= '2007-01-03') OR b >= 1; + +--replace_column 9 # +EXPLAIN +SELECT COUNT(*) FROM t1 FORCE INDEX(idx_b, idx_c) + WHERE (c >= '2007-01-02' AND c <= '2007-01-03') OR b >= 1; +SELECT COUNT(*) FROM t1 FORCE INDEX(idx_b, idx_c) + WHERE (c >= '2007-01-02' AND c <= '2007-01-03') OR b >= 1; + +set @@sort_buffer_size=default; + +DROP TABLE t1,t2; + --echo End of 5.0 tests diff --git a/mysql-test/t/insert_select-binlog.test b/mysql-test/t/insert_select-binlog.test index d4041f86ab5..4bff09577a7 100644 --- a/mysql-test/t/insert_select-binlog.test +++ b/mysql-test/t/insert_select-binlog.test @@ -1,5 +1,6 @@ # Embedded server doesn't support binlog -- source include/not_embedded.inc +-- source include/have_log_bin.inc # Check if a partly-completed INSERT SELECT in a MyISAM table goes into the # binlog diff --git a/mysql-test/t/insert_select.test b/mysql-test/t/insert_select.test index bbc51be6dc9..bf6dae96847 100644 --- a/mysql-test/t/insert_select.test +++ b/mysql-test/t/insert_select.test @@ -233,7 +233,9 @@ drop table t1,t2; CREATE TABLE t1 (a int PRIMARY KEY); INSERT INTO t1 values (1), (2); +flush status; INSERT INTO t1 SELECT a + 2 FROM t1 LIMIT 1; +show status like 'Handler_read%'; DROP TABLE t1; @@ -332,3 +334,26 @@ INSERT INTO t2 (d) SELECT * FROM t2; DROP TABLE t1,t2; + +# +# Bug #29095: incorrect pushing of LIMIT into the temporary +# table ignoring ORDER BY clause +# + +CREATE TABLE t1 ( + id INT AUTO_INCREMENT PRIMARY KEY, + prev_id INT, + join_id INT DEFAULT 0); + +INSERT INTO t1 (prev_id) VALUES (NULL), (1), (2); +SELECT * FROM t1; + +CREATE TABLE t2 (join_id INT); +INSERT INTO t2 (join_id) VALUES (0); + +INSERT INTO t1 (prev_id) SELECT id + FROM t2 LEFT JOIN t1 ON t1.join_id = t2.join_id + ORDER BY id DESC LIMIT 1; +SELECT * FROM t1; + +DROP TABLE t1,t2; diff --git a/mysql-test/t/insert_update.test b/mysql-test/t/insert_update.test index 725fbdb25d7..67108744ec6 100644 --- a/mysql-test/t/insert_update.test +++ b/mysql-test/t/insert_update.test @@ -290,3 +290,19 @@ INSERT IGNORE INTO t1 (id,c1) SELECT * FROM t2 SELECT * FROM t1; DROP TABLE t1; + +# +# Bug#28904: INSERT .. ON DUPLICATE was silently updating rows when it +# shouldn't. +# +create table t1(f1 int primary key, + f2 timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP); +insert into t1(f1) values(1); +--replace_column 1 # +select @stamp1:=f2 from t1; +--sleep 2 +insert into t1(f1) values(1) on duplicate key update f1=1; +--replace_column 1 # +select @stamp2:=f2 from t1; +select if( @stamp1 = @stamp2, "correct", "wrong"); +drop table t1; diff --git a/mysql-test/t/join.test b/mysql-test/t/join.test index 68b97854c3b..5b599c3dad7 100644 --- a/mysql-test/t/join.test +++ b/mysql-test/t/join.test @@ -512,10 +512,12 @@ select * from v1a join (t3 natural join t4) on a = y; #-------------------------------------------------------------------- # Negative tests (tests for errors) #-------------------------------------------------------------------- +# works in Oracle - bug -- error 1052 -select * from t1 natural join (t3 cross join t4); -- works in Oracle - bug +select * from t1 natural join (t3 cross join t4); +# works in Oracle - bug -- error 1052 -select * from (t3 cross join t4) natural join t1; -- works in Oracle - bug +select * from (t3 cross join t4) natural join t1; -- error 1052 select * from t1 join (t2, t3) using (b); -- error 1052 diff --git a/mysql-test/t/join_outer.test b/mysql-test/t/join_outer.test index 51e79a20d65..1a59dbf8fc2 100644 --- a/mysql-test/t/join_outer.test +++ b/mysql-test/t/join_outer.test @@ -845,3 +845,19 @@ SELECT t1.id, a FROM t1 LEFT JOIN t2 ON t1.id=t2.id WHERE t2.b IS NULL; show status like 'Handler_read%'; DROP TABLE t1,t2; + +# +# Bug 28571: outer join with false on condition over constant tables +# + +CREATE TABLE t1 (c int PRIMARY KEY, e int NOT NULL); +INSERT INTO t1 VALUES (1,0), (2,1); +CREATE TABLE t2 (d int PRIMARY KEY); +INSERT INTO t2 VALUES (1), (2), (3); + +EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON e<>0 WHERE c=1 AND d IS NULL; +SELECT * FROM t1 LEFT JOIN t2 ON e<>0 WHERE c=1 AND d IS NULL; +SELECT * FROM t1 LEFT JOIN t2 ON e<>0 WHERE c=1 AND d<=>NULL; + +DROP TABLE t1,t2; + diff --git a/mysql-test/t/key.test b/mysql-test/t/key.test index e84b2071ab1..3d0e68dc0f3 100644 --- a/mysql-test/t/key.test +++ b/mysql-test/t/key.test @@ -432,3 +432,15 @@ ORDER BY c.b, c.d ; DROP TABLE t1, t2; + + +# +# Bug #20604: Test for disabled keys with aggregate functions and FORCE INDEX. +# +CREATE TABLE t1( a TINYINT, KEY(a) ) ENGINE=MyISAM; +INSERT INTO t1 VALUES( 1 ); +ALTER TABLE t1 DISABLE KEYS; +EXPLAIN SELECT MAX(a) FROM t1 FORCE INDEX(a); +DROP TABLE t1; + +--echo End of 5.0 tests. diff --git a/mysql-test/t/key_cache.test b/mysql-test/t/key_cache.test index 3044964ebc3..4c14dc96aaa 100644 --- a/mysql-test/t/key_cache.test +++ b/mysql-test/t/key_cache.test @@ -219,4 +219,31 @@ set global key_cache_block_size= @my_key_cache_block_size; set @@global.key_buffer_size=0; select @@global.key_buffer_size; +# +# Bug#28478 - Improper key_cache_block_size corrupts MyISAM tables +# +SET @bug28478_key_cache_block_size= @@global.key_cache_block_size; +SET GLOBAL key_cache_block_size= 1536; +CREATE TABLE t1 ( + id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY, + c1 CHAR(150), + c2 CHAR(150), + c3 CHAR(150), + KEY(c1, c2, c3) + ) ENGINE= MyISAM; +INSERT INTO t1 (c1, c2, c3) VALUES + ('a', 'b', 'c'), ('b', 'c', 'd'), ('c', 'd', 'e'), ('d', 'e', 'f'), + ('e', 'f', 'g'), ('f', 'g', 'h'), ('g', 'h', 'i'), ('h', 'i', 'j'), + ('i', 'j', 'k'), ('j', 'k', 'l'), ('k', 'l', 'm'), ('l', 'm', 'n'), + ('m', 'n', 'o'), ('n', 'o', 'p'), ('o', 'p', 'q'), ('p', 'q', 'r'), + ('q', 'r', 's'), ('r', 's', 't'), ('s', 't', 'u'), ('t', 'u', 'v'), + ('u', 'v', 'w'), ('v', 'w', 'x'), ('w', 'x', 'y'), ('x', 'y', 'z'); +INSERT INTO t1 (c1, c2, c3) SELECT c1, c2, c3 from t1; +INSERT INTO t1 (c1, c2, c3) SELECT c1, c2, c3 from t1; +INSERT INTO t1 (c1, c2, c3) SELECT c1, c2, c3 from t1; +CHECK TABLE t1; +SHOW VARIABLES LIKE 'key_cache_block_size'; +SET GLOBAL key_cache_block_size= @bug28478_key_cache_block_size; +DROP TABLE t1; + # End of 4.1 tests diff --git a/mysql-test/t/kill.test b/mysql-test/t/kill.test index 1e99911a7e3..cedca9db3da 100644 --- a/mysql-test/t/kill.test +++ b/mysql-test/t/kill.test @@ -81,7 +81,9 @@ connection conn2; connection conn1; -- disable_result_log -send select id from t1 where id in (select distinct id from t2); +# This is a very long running query. If this test start failing, it may +# be necessary to change to an even longer query. +send select id from t1 where id in (select distinct a.id from t2 a, t2 b, t2 c, t2 d group by a.id, b.id, c.id, d.id having a.id between 10 and 20); -- enable_result_log connection conn2; @@ -117,3 +119,188 @@ reap; select 1; connection con1; select RELEASE_LOCK("a"); + +# +# Bug#27563: Stored functions and triggers wasn't throwing an error when killed. +# +create table t1(f1 int); +delimiter |; +create function bug27563() returns int(11) +deterministic +begin + declare continue handler for sqlstate '70100' set @a:= 'killed'; + declare continue handler for sqlexception set @a:= 'exception'; + set @a= get_lock("lock27563", 10); + return 1; +end| +delimiter ;| +# Test stored functions +# Test INSERT +connection con1; +select get_lock("lock27563",10); +connection con2; +let $ID= `select connection_id()`; +send insert into t1 values (bug27563()); +real_sleep 2; +connection con1; +disable_query_log; +eval kill query $ID; +enable_query_log; +connection con2; +--error 1317 +reap; +select @a; +connection con1; +select * from t1; + +# Test UPDATE +insert into t1 values(0); +connection con2; +send update t1 set f1= bug27563(); +real_sleep 2; +connection con1; +disable_query_log; +eval kill query $ID; +enable_query_log; +connection con2; +--error 1317 +reap; +select @a; +connection con1; +select * from t1; + +# Test DELETE +insert into t1 values(1); +connection con2; +send delete from t1 where bug27563() is null; +real_sleep 2; +connection con1; +disable_query_log; +eval kill query $ID; +enable_query_log; +connection con2; +--error 1317 +reap; +select @a; +connection con1; +select * from t1; + +# Test SELECT +connection con2; +send select * from t1 where f1= bug27563(); +real_sleep 2; +connection con1; +disable_query_log; +eval kill query $ID; +enable_query_log; +connection con2; +--error 1317 +reap; +select @a; + +# Test PROCEDURE +connection con2; +delimiter |; +create procedure proc27563() +begin + declare continue handler for sqlstate '70100' set @a:= 'killed'; + declare continue handler for sqlexception set @a:= 'exception'; + select get_lock("lock27563",10); + select "shouldn't be selected"; +end| +delimiter ;| +send call proc27563(); +real_sleep 2; +connection con1; +disable_query_log; +eval kill query $ID; +enable_query_log; +connection con2; +--error 1317 +reap; +select @a; + +# Test TRIGGERS +connection con2; +create table t2 (f2 int); +delimiter |; +create trigger trg27563 before insert on t1 for each row +begin + declare continue handler for sqlstate '70100' set @a:= 'killed'; + declare continue handler for sqlexception set @a:= 'exception'; + set @a:= get_lock("lock27563",10); + insert into t2 values(1); +end| +delimiter ;| +send insert into t1 values(2),(3); +real_sleep 2; +connection con1; +disable_query_log; +eval kill query $ID; +enable_query_log; +connection con2; +--error 1317 +reap; +select @a; +connection con1; +select * from t1; +select * from t2; + +# Cleanup +select release_lock("lock27563"); +drop table t1, t2; +drop function bug27563; +drop procedure proc27563; + +# +# Bug#28598: mysqld crash when killing a long-running explain query. +# +--disable_query_log +connection con1; +let $ID= `select connection_id()`; +let $tab_count= 40; + +let $i= $tab_count; +while ($i) +{ + eval CREATE TABLE t$i (a$i int, KEY(a$i)); + eval INSERT INTO t$i VALUES (1),(2),(3),(4),(5),(6),(7); + dec $i ; +} +set session optimizer_search_depth=0; + +let $i=$tab_count; +while ($i) +{ + let $a= a$i; + let $t= t$i; + dec $i; + if ($i) + { + let $comma=,; + let $from=$comma$t$from; + let $where=a$i=$a $and $where; + } + if (!$i) + { + let $from=FROM $t$from; + let $where=WHERE $where; + } + let $and=AND; +} + +--enable_query_log +eval PREPARE stmt FROM 'EXPLAIN SELECT * $from $where'; +send EXECUTE stmt; +--disable_query_log + +connection con2; +real_sleep 2; +eval kill query $ID; +let $i= $tab_count; +while ($i) +{ + eval DROP TABLE t$i; + dec $i ; +} +--enable_query_log diff --git a/mysql-test/t/limit.test b/mysql-test/t/limit.test index bc599b20d36..286c04785ff 100644 --- a/mysql-test/t/limit.test +++ b/mysql-test/t/limit.test @@ -71,3 +71,20 @@ explain select sum(a) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3; select sum(a) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3; drop table t1; # End of 4.1 tests + +# +# Bug #28464: a string argument to 'limit ?' PS +# + +prepare s from "select 1 limit ?"; +set @a='qwe'; +--error 1210 +execute s using @a; +prepare s from "select 1 limit 1, ?"; +--error 1210 +execute s using @a; +prepare s from "select 1 limit ?, ?"; +--error 1210 +execute s using @a, @a; + +--echo End of 5.0 tests diff --git a/mysql-test/t/loaddata.test b/mysql-test/t/loaddata.test index 2757a37b881..260e760e7b3 100644 --- a/mysql-test/t/loaddata.test +++ b/mysql-test/t/loaddata.test @@ -67,6 +67,41 @@ load data infile '../std_data_ln/loaddata_dq.dat' into table t1 fields terminate select * from t1; drop table t1; +# +# Bug #29294 SELECT INTO OUTFILE/LOAD DATA INFILE with special +# characters in the FIELDS ENCLOSED BY clause +# + +CREATE TABLE t1 ( + id INT AUTO_INCREMENT PRIMARY KEY, + c1 VARCHAR(255) +); + +CREATE TABLE t2 ( + id INT, + c2 VARCHAR(255) +); + +INSERT INTO t1 (c1) VALUES + ('r'), ('rr'), ('rrr'), ('rrrr'), + ('.r'), ('.rr'), ('.rrr'), ('.rrrr'), + ('r.'), ('rr.'), ('rrr.'), ('rrrr.'), + ('.r.'), ('.rr.'), ('.rrr.'), ('.rrrr.'); +SELECT * FROM t1; + +--exec rm -f $MYSQLTEST_VARDIR/tmp/t1 +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +eval SELECT * INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/t1' FIELDS ENCLOSED BY 'r' FROM t1; +--exec cat $MYSQLTEST_VARDIR/tmp/t1 + +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/t1' INTO TABLE t2 FIELDS ENCLOSED BY 'r'; +SELECT t1.id, c1, c2 FROM t1 LEFT JOIN t2 ON t1.id=t2.id WHERE c1 != c2; +SELECT t1.id, c1, c2 FROM t1 RIGHT JOIN t2 ON t1.id=t2.id WHERE c1 != c2; + +--exec rm $MYSQLTEST_VARDIR/tmp/t1 +DROP TABLE t1,t2; + # End of 4.1 tests # @@ -178,4 +213,29 @@ select f1 from t1 where f2 <> '0000-00-00 00:00:00' order by f1; --exec rm $MYSQLTEST_VARDIR/tmp/t2 drop table t1,t2; +# +# Bug#29442: SELECT INTO OUTFILE FIELDS ENCLOSED BY digit, minus sign etc +# corrupts non-string fields containing this character. +# + +CREATE TABLE t1 (c1 INT, c2 TIMESTAMP, c3 REAL, c4 DOUBLE); + +INSERT INTO t1 (c1, c2, c3, c4) VALUES (10, '1970-02-01 01:02:03', 1.1E-100, 1.1E+100); +SELECT * FROM t1; + +--exec rm -f $MYSQLTEST_VARDIR/tmp/t1 +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +eval SELECT * INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/t1' FIELDS ENCLOSED BY '-' FROM t1; +--exec cat $MYSQLTEST_VARDIR/tmp/t1 +--exec echo EOF + +TRUNCATE t1; + +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/t1' INTO TABLE t1 FIELDS ENCLOSED BY '-'; +SELECT * FROM t1; + +--exec rm $MYSQLTEST_VARDIR/tmp/t1 +DROP TABLE t1; + # End of 5.0 tests diff --git a/mysql-test/t/long_tmpdir-master.opt b/mysql-test/t/long_tmpdir-master.opt new file mode 100644 index 00000000000..398abfc4632 --- /dev/null +++ b/mysql-test/t/long_tmpdir-master.opt @@ -0,0 +1 @@ +--tmpdir=$MYSQLTEST_VARDIR/tmp/long_temporary_directory_path_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789 diff --git a/mysql-test/t/long_tmpdir-master.sh b/mysql-test/t/long_tmpdir-master.sh new file mode 100644 index 00000000000..318955fbcca --- /dev/null +++ b/mysql-test/t/long_tmpdir-master.sh @@ -0,0 +1,3 @@ +d="$MYSQLTEST_VARDIR/tmp/long_temporary_directory_path_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789" +test -d "$d" || mkdir "$d" +rm -f "$d"/* diff --git a/mysql-test/t/long_tmpdir.test b/mysql-test/t/long_tmpdir.test new file mode 100644 index 00000000000..cf0bed29918 --- /dev/null +++ b/mysql-test/t/long_tmpdir.test @@ -0,0 +1,9 @@ +# +# Bug #29015: Stack overflow in processing temporary table name when tmpdir path +# is long +# + +create view v1 as select table_name from information_schema.tables; +drop view v1; + +--echo End of 5.0 tests diff --git a/mysql-test/t/merge.test b/mysql-test/t/merge.test index b3944416adc..c3e5cef5e63 100644 --- a/mysql-test/t/merge.test +++ b/mysql-test/t/merge.test @@ -486,4 +486,25 @@ insert into t1 values (1); drop table t2; drop table t1; +# +# BUG#26976 - Missing table in merge not noted in related error msg + SHOW +# CREATE TABLE fails +# +CREATE TABLE tm1(a INT) ENGINE=MERGE UNION=(t1, t2); +--error 1168 +SELECT * FROM tm1; +CHECK TABLE tm1; +CREATE TABLE t1(a INT); +--error 1168 +SELECT * FROM tm1; +CHECK TABLE tm1; +CREATE TABLE t2(a BLOB); +--error 1168 +SELECT * FROM tm1; +CHECK TABLE tm1; +ALTER TABLE t2 MODIFY a INT; +SELECT * FROM tm1; +CHECK TABLE tm1; +DROP TABLE tm1, t1, t2; + --echo End of 5.0 tests diff --git a/mysql-test/t/metadata.test b/mysql-test/t/metadata.test index a6ebfdc14c1..65c062399b7 100644 --- a/mysql-test/t/metadata.test +++ b/mysql-test/t/metadata.test @@ -81,3 +81,35 @@ drop view v1,v2,v3; --disable_metadata # End of 4.1 tests + +# +# Bug #28492: subselect returns LONG in >5.0.24a and LONGLONG in <=5.0.24a +# +--enable_metadata +select a.* from (select 2147483648 as v_large) a; +select a.* from (select 214748364 as v_small) a; +--disable_metadata + +# +# Bug #28898: table alias and database name of VIEW columns is empty in the +# metadata of # SELECT statement where join is executed via temporary table. +# + +CREATE TABLE t1 (c1 CHAR(1)); +CREATE TABLE t2 (c2 CHAR(1)); +CREATE VIEW v1 AS SELECT t1.c1 FROM t1; +CREATE VIEW v2 AS SELECT t2.c2 FROM t2; +INSERT INTO t1 VALUES ('1'), ('2'), ('3'); +INSERT INTO t2 VALUES ('1'), ('2'), ('3'), ('2'); + +--enable_metadata +SELECT v1.c1 FROM v1 JOIN t2 ON c1=c2 ORDER BY 1; +SELECT v1.c1, v2.c2 FROM v1 JOIN v2 ON c1=c2; +SELECT v1.c1, v2.c2 FROM v1 JOIN v2 ON c1=c2 GROUP BY v1.c1; +SELECT v1.c1, v2.c2 FROM v1 JOIN v2 ON c1=c2 GROUP BY v1.c1 ORDER BY v2.c2; +--disable_metadata + +DROP VIEW v1,v2; +DROP TABLE t1,t2; + +--echo End of 5.0 tests diff --git a/mysql-test/t/mix_innodb_myisam_binlog.test b/mysql-test/t/mix_innodb_myisam_binlog.test index 8bced9f069c..428aba92342 100644 --- a/mysql-test/t/mix_innodb_myisam_binlog.test +++ b/mysql-test/t/mix_innodb_myisam_binlog.test @@ -5,9 +5,7 @@ # did some tests manually on a slave; tables are replicated fine and # Exec_Master_Log_Pos advances as expected. -# Embedded server doesn't support binlogging --- source include/not_embedded.inc - +-- source include/have_log_bin.inc -- source include/have_innodb.inc --disable_warnings @@ -28,9 +26,7 @@ insert into t1 values(1); insert into t2 select * from t1; commit; ---replace_column 5 # ---replace_result "xid=14" "xid=8" -show binlog events from 98; +source include/show_binlog_events.inc; delete from t1; delete from t2; @@ -42,8 +38,7 @@ insert into t2 select * from t1; # should say some changes to non-transact1onal tables couldn't be rolled back rollback; ---replace_column 5 # -show binlog events from 98; +source include/show_binlog_events.inc; delete from t1; delete from t2; @@ -57,9 +52,7 @@ insert into t2 select * from t1; rollback to savepoint my_savepoint; commit; ---replace_column 5 # ---replace_result "xid=47" "xid=25" -show binlog events from 98; +source include/show_binlog_events.inc; delete from t1; delete from t2; @@ -75,9 +68,7 @@ insert into t1 values(7); commit; select a from t1 order by a; # check that savepoints work :) ---replace_column 5 # ---replace_result "xid=69" "xid=37" -show binlog events from 98; +source include/show_binlog_events.inc; # and when ROLLBACK is not explicit? delete from t1; @@ -97,8 +88,7 @@ connection con2; # so SHOW BINLOG EVENTS may come before con1 does the loggin. To be sure that # logging has been done, we use a user lock. select get_lock("a",10); ---replace_column 5 # -show binlog events from 98; +source include/show_binlog_events.inc; # and when not in a transact1on? delete from t1; @@ -108,9 +98,7 @@ reset master; insert into t1 values(9); insert into t2 select * from t1; ---replace_column 5 # ---replace_result "xid=117" "xid=60" -show binlog events from 98; +source include/show_binlog_events.inc; # Check that when the query updat1ng the MyISAM table is the first in the # transaction, we log it immediately. @@ -121,16 +109,11 @@ reset master; insert into t1 values(10); # first make t1 non-empty begin; insert into t2 select * from t1; ---replace_column 5 # ---replace_result "xid=131" "xid=66" -show binlog events from 98; +source include/show_binlog_events.inc; insert into t1 values(11); commit; ---replace_column 5 # ---replace_result "xid=131" "xid=66" "xid=134" "xid=68" -show binlog events from 98; - +source include/show_binlog_events.inc; # Check that things work like before this BEGIN/ROLLBACK code was added, # when t2 is INNODB @@ -146,9 +129,7 @@ insert into t1 values(12); insert into t2 select * from t1; commit; ---replace_column 5 # ---replace_result "xid=153" "xid=78" -show binlog events from 98; +source include/show_binlog_events.inc; delete from t1; delete from t2; @@ -159,8 +140,7 @@ insert into t1 values(13); insert into t2 select * from t1; rollback; ---replace_column 5 # -show binlog events from 98; +source include/show_binlog_events.inc; delete from t1; delete from t2; @@ -174,9 +154,7 @@ insert into t2 select * from t1; rollback to savepoint my_savepoint; commit; ---replace_column 5 # ---replace_result "xid=185" "xid=94" -show binlog events from 98; +source include/show_binlog_events.inc; delete from t1; delete from t2; @@ -192,9 +170,7 @@ insert into t1 values(18); commit; select a from t1 order by a; # check that savepoints work :) ---replace_column 5 # ---replace_result "xid=206" "xid=105" -show binlog events from 98; +source include/show_binlog_events.inc; # Test for BUG#5714, where a MyISAM update in the transaction used to # release row-level locks in InnoDB @@ -253,9 +229,7 @@ insert into t2 values (3); disconnect con2; connection con3; select get_lock("lock1",60); ---replace_column 5 # ---replace_result "xid=206" "xid=105" "xid=224" "xid=114" "xid=227" "xid=115" "xid=231" "xid=117" "xid=258" "xid=132" -show binlog events from 98; +source include/show_binlog_events.inc; do release_lock("lock1"); drop table t0,t2; diff --git a/mysql-test/t/multi_update.test b/mysql-test/t/multi_update.test index da19a18c73a..84e6a444d47 100644 --- a/mysql-test/t/multi_update.test +++ b/mysql-test/t/multi_update.test @@ -534,3 +534,44 @@ select * from t1; select * from t2; drop view v1; drop table t1, t2; + +# +# Bug#27716 multi-update did partially and has not binlogged +# + +CREATE TABLE `t1` ( + `a` int(11) NOT NULL auto_increment, + `b` int(11) default NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 ; + +CREATE TABLE `t2` ( + `a` int(11) NOT NULL auto_increment, + `b` int(11) default NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 ; + +# A. testing multi_update::send_eof() execution branch +insert into t1 values (1,1),(2,2); +insert into t2 values (1,1),(4,4); +reset master; +--error ER_DUP_ENTRY +UPDATE t2,t1 SET t2.a=t1.a+2; +# check +select * from t2 /* must be (3,1), (4,4) */; +show master status /* there must be the UPDATE query event */; + +# B. testing multi_update::send_error() execution branch +delete from t1; +delete from t2; +insert into t1 values (1,2),(3,4),(4,4); +insert into t2 values (1,2),(3,4),(4,4); +reset master; +--error ER_DUP_ENTRY +UPDATE t2,t1 SET t2.a=t2.b where t2.a=t1.a; +show master status /* there must be the UPDATE query event */; + +# cleanup bug#27716 +drop table t1, t2; + +--echo end of tests diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test index 82d10059c65..12b9423be21 100644 --- a/mysql-test/t/myisam.test +++ b/mysql-test/t/myisam.test @@ -1145,4 +1145,20 @@ create table t3 (c1 int) engine=myisam pack_keys=default; create table t4 (c1 int) engine=myisam pack_keys=2; drop table t1, t2, t3; +# +# Bug#28476: force index on a disabled myisam index gives error 124 +# +CREATE TABLE t1(a INT, b INT, KEY inx (a), UNIQUE KEY uinx (b)) ENGINE=MyISAM; +INSERT INTO t1(a,b) VALUES (1,1),(2,2),(3,3),(4,4),(5,5); +SELECT a FROM t1 FORCE INDEX (inx) WHERE a=1; +ALTER TABLE t1 DISABLE KEYS; +SELECT a FROM t1 FORCE INDEX (inx) WHERE a=1; +SELECT a FROM t1 USE INDEX (inx) WHERE a=1; +SELECT b FROM t1 FORCE INDEX (uinx) WHERE b=1; +SELECT b FROM t1 USE INDEX (uinx) WHERE b=1; +SELECT a FROM t1 FORCE INDEX (inx,uinx) WHERE a=1; +ALTER TABLE t1 ENABLE KEYS; +SELECT a FROM t1 FORCE INDEX (inx) WHERE a=1; +DROP TABLE t1; + --echo End of 5.0 tests diff --git a/mysql-test/t/mysql.test b/mysql-test/t/mysql.test index 0732559e7e1..37bbca77d9f 100644 --- a/mysql-test/t/mysql.test +++ b/mysql-test/t/mysql.test @@ -262,7 +262,7 @@ EOF --exec $MYSQL test -e "show status" 2>&1 > /dev/null --exec $MYSQL --help 2>&1 > /dev/null --exec $MYSQL --version 2>&1 > /dev/null ---enable_quary_log +--enable_query_log # # bug #26851: Mysql Client --pager Buffer Overflow diff --git a/mysql-test/t/mysqlbinlog-cp932.test b/mysql-test/t/mysqlbinlog-cp932.test index 1487606a6c2..1c9f91fd9a8 100644 --- a/mysql-test/t/mysqlbinlog-cp932.test +++ b/mysql-test/t/mysqlbinlog-cp932.test @@ -1,6 +1,7 @@ # disabled in embedded until tools running is fixed with embedded ---source include/not_embedded.inc +-- source include/not_embedded.inc -- source include/have_cp932.inc +-- source include/have_log_bin.inc # Bug#16217 (mysql client did not know how not switch its internal charset) flush logs; diff --git a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test index a7b3f413f23..bd90dcfb930 100644 --- a/mysql-test/t/mysqlbinlog.test +++ b/mysql-test/t/mysqlbinlog.test @@ -1,7 +1,6 @@ # We are using .opt file since we need small binlog size -# Embedded server doesn't support binlogging --- source include/not_embedded.inc +-- source include/have_log_bin.inc # we need this for getting fixed timestamps inside of this test set timestamp=1000000000; @@ -204,4 +203,17 @@ flush logs; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLTEST_VARDIR/log/master-bin.000009 +# +# Bug#28293 missed '#' sign in the hex dump when the dump length +# is divisible by 16. +# + +CREATE TABLE t1 (c1 CHAR(10)); +# we need this for getting fixed timestamps inside of this test +flush logs; +INSERT INTO t1 VALUES ('0123456789'); +flush logs; +DROP TABLE t1; +--exec $MYSQL_BINLOG --hexdump --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLTEST_VARDIR/log/master-bin.000011 | grep 'Query' | sed 's/[0-9]\{1,\}/REMOVED/g' + --echo End of 5.0 tests diff --git a/mysql-test/t/mysqlbinlog2.test b/mysql-test/t/mysqlbinlog2.test index 14b213cd9cc..c6869d67da1 100644 --- a/mysql-test/t/mysqlbinlog2.test +++ b/mysql-test/t/mysqlbinlog2.test @@ -1,8 +1,7 @@ # Test for the new options --start-datetime, stop-datetime, # and a few others. -# Embedded server doesn't support binlogging --- source include/not_embedded.inc +-- source include/have_log_bin.inc --disable_warnings drop table if exists t1; diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test index 4c4690520c6..30c241d4096 100644 --- a/mysql-test/t/mysqldump.test +++ b/mysql-test/t/mysqldump.test @@ -1,5 +1,9 @@ # Embedded server doesn't support external clients --source include/not_embedded.inc +--source include/have_log_bin.inc + +# Binlog is required +--source include/have_log_bin.inc --disable_warnings DROP TABLE IF EXISTS t1, `"t"1`, t1aa, t2, t2aa, t3; @@ -1528,7 +1532,14 @@ drop user user2; drop database mysqldump_test_db; +--echo # +--echo # Bug #28522: buffer overrun by '\0' byte using --hex-blob. +--echo # +CREATE TABLE t1 (c1 INT, c2 LONGBLOB); +INSERT INTO t1 SET c1=11, c2=REPEAT('q',509); +--exec $MYSQL_DUMP --skip-create --compact --hex-blob test t1 +DROP TABLE t1; --echo # --echo # End of 5.0 tests diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test index 057432d37fd..b01579dce53 100644 --- a/mysql-test/t/mysqltest.test +++ b/mysql-test/t/mysqltest.test @@ -1,3 +1,5 @@ +-- source include/have_log_bin.inc + # This test should work in embedded server after mysqltest is fixed -- source include/not_embedded.inc @@ -46,11 +48,6 @@ select otto from (select 1 as otto) as t1; --error 0 select otto from (select 1 as otto) as t1; -# expectation <> response --- // --error 1054 --- // select otto from (select 1 as otto) as t1; - - # ---------------------------------------------------------------------------- # Negative case(statement): # The derived table t1 does not contain a column named 'friedrich' . @@ -331,9 +328,9 @@ select 3 from t1 ; # This is a comment # This is a ; comment # This is a -- comment --- This is also a comment --- # This is also a comment --- This is also a ; comment +# -- This is also a comment +# -- # This is also a comment +# -- This is also a ; comment # ---------------------------------------------------------------------------- # Test comments with embedded command @@ -840,6 +837,10 @@ while ($num) } --enable_abort_on_error --enable_query_log + +# Test source $variable/ +--source $MYSQLTEST_VARDIR/tmp/sourced.inc + --remove_file $MYSQLTEST_VARDIR/tmp/sourced.inc # ---------------------------------------------------------------------------- @@ -1227,11 +1228,9 @@ select "a" as col1, "c" as col2; # Test sync_with_master # ---------------------------------------------------------------------------- --error 1 ---exec echo "save_master_pos; sync_with_master 10!;" | $MYSQL_TEST 2>&1 +--exec echo "sync_with_master 10!;" | $MYSQL_TEST 2>&1 --error 1 ---exec echo "save_master_pos; sync_with_master 10 !;" | $MYSQL_TEST 2>&1 ---error 1 ---exec echo "save_master_pos; sync_with_master a;" | $MYSQL_TEST 2>&1 +--exec echo "sync_with_master a;" | $MYSQL_TEST 2>&1 # ---------------------------------------------------------------------------- # Test connect @@ -1264,7 +1263,7 @@ while ($i) EOF --exec echo "source $MYSQLTEST_VARDIR/tmp/mysqltest.sql; echo OK;" | $MYSQL_TEST 2>&1 -# Repeat connect/disconnect, exceed max number of connections +# Repeat connect/disconnect --write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql let $i=200; while ($i) @@ -1871,10 +1870,132 @@ DROP TABLE t1; --disable_query_log --exec $MYSQL_TEST --help 2>&1 > /dev/null --exec $MYSQL_TEST --version 2>&1 > /dev/null ---enable_quary_log +--enable_query_log --disable_abort_on_error --error 1 --exec $MYSQL_TEST a b c 2>&1 > /dev/null --enable_abort_on_error +--enable_query_log + +# ---------------------------------------------------------------------------- +# test for query_get_value +# ---------------------------------------------------------------------------- + +CREATE TABLE t1( + a int, b varchar(255), c datetime +); +SHOW COLUMNS FROM t1; + +#------------ Positive tests ------------ +# 1. constant parameters +# value is simple string without spaces +let $value= query_get_value(SHOW COLUMNS FROM t1, Type, 1); +--echo statement=SHOW COLUMNS FROM t1 row_number=1, column_name="Type", Value=$value +let $value= query_get_value("SHOW COLUMNS FROM t1", Type, 1); +--echo statement="SHOW COLUMNS FROM t1" row_number=1, column_name="Type", Value=$value +# +# 2. $variables as parameters +# value IS NULL +let $my_show= SHOW COLUMNS FROM t1; +let $column_name= Default; +let $row_number= 1; +let $value= query_get_value($my_show, $column_name, $row_number); +--echo statement=$my_show row_number=$row_number, column_name=$column_name, Value=$value +# +# 3. result set of a SELECT (not recommended, because projection and +# selection could be done much better by pure SELECT functionality) +# value is string with space in the middle +let $value= query_get_value(SELECT 'A B' AS "MyColumn", MyColumn, 1); +--echo value= ->$value<- +# +# 4. column name with space +let $value= query_get_value(SELECT 1 AS "My Column", My Column, 1); +--echo value= $value +# +#------------ Negative tests ------------ +# 5. Incomplete statement including missing parameters +# 5.1 incomplete statement +--error 1 +--exec echo "let \$value= query_get_value(SHOW;" | $MYSQL_TEST 2>&1 +# 5.2 missing query +--error 1 +--exec echo "let \$value= query_get_value;" | $MYSQL_TEST 2>&1 +# 5.3 missing column name +--error 1 +--exec echo "let \$value= query_get_value(SHOW COLUMNS FROM t1);" | $MYSQL_TEST 2>&1 +# 5.4 missing row number +--error 1 +--exec echo "let \$value= query_get_value(SHOW COLUMNS FROM t1, Field);" | $MYSQL_TEST 2>&1 +# +# 6. Somehow "wrong" value of parameters +# 6.1 row parameter +# 6.1.1 non sense number 0 +let $value= initialized; +let $value= query_get_value(SHOW COLUMNS FROM t1, Field, 0); +--echo value= $value +# 6.1.2 after the last row +let $value= initialized; +let $value= query_get_value(SHOW COLUMNS FROM t1, Field, 10); +--echo value= $value +# 6.1.3 invalid row number +--error 1 +--exec echo "let \$value= query_get_value(SHOW COLUMNS FROM t1, Field, notnumber);" | $MYSQL_TEST 2>&1 +# 6.2 column name parameter, name of not existing column +--error 1 +--exec echo "let \$value= query_get_value(SHOW COLUMNS FROM t1, column_not_exists, 1);" | $MYSQL_TEST 2>&1 +# 6.3. statement which never gives a result set +--error 1 +--exec echo "let \$value= query_get_value(SET @A = 1, Field, 1);" | $MYSQL_TEST 2>&1 +# 6.4. statement contains a "," +# Note: There is no need to improve this, because we need query_get_value +# for SHOW commands only. +--error 1 +--exec echo "let \$value= query_get_value(SELECT 1 AS "A", 1 AS "B", 1);" | $MYSQL_TEST 2>&1 +# +# 7. empty result set +let $value= initialized; +let $value= query_get_value(SELECT a FROM t1, a, 1); +--echo value= $value +# +# 9. failing statement +--error 1 +--exec echo "let \$value= query_get_value(SHOW COLNS FROM t1, Field, 1);" | $MYSQL_TEST 2>&1 +# +# 10. Artificial example how to process a complete SHOW result set: +let $show_statement= SHOW COLUMNS FROM t1; +let $rowno= 1; +let $run=1; +let $count= 0; +--echo +--echo Field Type Null Key Default Extra +while ($run) +{ + let $Field= query_get_value($show_statement, Field, $rowno); + if (`SELECT '$Field' = 'No such row'`) + { + let $run= 0; + } + if (`SELECT '$Field' <> 'No such row'`) + { + let $Type= query_get_value($show_statement, Type, $rowno); + let $Null= query_get_value($show_statement, Null, $rowno); + if (`SELECT '$Null' = 'YES'`) + { + inc $count; + } + let $Key= query_get_value($show_statement, Key, $rowno); + let $Default= query_get_value($show_statement, Default, $rowno); + let $Extra= query_get_value($show_statement, Extra, $rowno); + --echo $Field $Type $Null ->$Key<- $Default $Extra + inc $rowno; + } +} +--echo +--echo Number of columns with Default NULL: $count +--echo +eval $show_statement; + +drop table t1; --echo End of tests + diff --git a/mysql-test/t/ndb_index_ordered.test b/mysql-test/t/ndb_index_ordered.test index 19b024a043f..31385fd56b2 100644 --- a/mysql-test/t/ndb_index_ordered.test +++ b/mysql-test/t/ndb_index_ordered.test @@ -50,7 +50,7 @@ update t1 set c = 13 where b <= 3; select * from t1 order by a; update t1 set b = b + 1 where b > 4 and b < 7; select * from t1 order by a; --- Update primary key +# Update primary key update t1 set a = a + 10 where b > 1 and b < 7; select * from t1 order by a; diff --git a/mysql-test/t/order_by.test b/mysql-test/t/order_by.test index 3e8fa07dfb7..29a290c7fbf 100644 --- a/mysql-test/t/order_by.test +++ b/mysql-test/t/order_by.test @@ -719,10 +719,10 @@ CREATE TABLE t1 (a INT UNSIGNED NOT NULL, b TIME); INSERT INTO t1 (a) VALUES (100000), (0), (100), (1000000),(10000), (1000), (10); UPDATE t1 SET b = SEC_TO_TIME(a); --- Correct ORDER +# Correct ORDER SELECT a, b FROM t1 ORDER BY b DESC; --- must be ordered as the above +# must be ordered as the above SELECT a, b FROM t1 ORDER BY SEC_TO_TIME(a) DESC; DROP TABLE t1; diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test index 5b7adc40755..93a89c2b275 100644 --- a/mysql-test/t/ps.test +++ b/mysql-test/t/ps.test @@ -1791,5 +1791,13 @@ execute stmt; deallocate prepare stmt; drop tables t1; +# +# Bug #28509: strange behaviour: passing a decimal value to PS +# +prepare stmt from "create table t1 select ?"; +set @a=1.0; +execute stmt using @a; +show create table t1; +drop table t1; --echo End of 5.0 tests. diff --git a/mysql-test/t/ps_1general.test b/mysql-test/t/ps_1general.test index 2e7fea2ff3d..952931f2ad1 100644 --- a/mysql-test/t/ps_1general.test +++ b/mysql-test/t/ps_1general.test @@ -423,6 +423,10 @@ prepare stmt1 from ' execute stmt2 ' ; --error ER_UNSUPPORTED_PS prepare stmt1 from ' deallocate prepare never_prepared ' ; +## We don't support alter view as prepared statements +--error ER_UNSUPPORTED_PS +prepare stmt1 from 'alter view v1 as select 2'; + ## switch the database connection --error 1295 prepare stmt4 from ' use test ' ; diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test index 1ef104f820b..965ebf5df62 100644 --- a/mysql-test/t/query_cache.test +++ b/mysql-test/t/query_cache.test @@ -89,7 +89,11 @@ show status like "Qcache_queries_in_cache"; select sql_cache * from t1 union select * from t1; set query_cache_type=2; select sql_cache * from t1 union select * from t1; + +# all sql_cache statements, except for the first select, are ignored. select * from t1 union select sql_cache * from t1; +select * from t1 where a IN (select sql_cache a from t1); +select * from t1 where a IN (select a from t1 union select sql_cache a from t1); show status like "Qcache_hits"; show status like "Qcache_queries_in_cache"; set query_cache_type=on; @@ -102,6 +106,15 @@ show status like "Qcache_queries_in_cache"; # SELECT SQL_NO_CACHE # select sql_no_cache * from t1; +# sql_no_cache can occur in any nested select to turn on cacheing for the whole +# expression and it will always override a sql_cache statement. +select * from t1 union select sql_no_cache * from t1; +select * from t1 where a IN (select sql_no_cache a from t1); +select * from t1 where a IN (select a from t1 union select sql_no_cache a from t1); +select sql_cache sql_no_cache * from t1; +select sql_cache * from t1 union select sql_no_cache * from t1; +select sql_cache * from t1 where a IN (select sql_no_cache a from t1); +select sql_cache * from t1 where a IN (select a from t1 union select sql_no_cache a from t1); show status like "Qcache_queries_in_cache"; drop table t1; # @@ -965,9 +978,54 @@ delimiter ;| select *, change_global() from t1; drop function change_global; +drop table t1; + set GLOBAL query_cache_type=default; set GLOBAL query_cache_limit=default; set GLOBAL query_cache_min_res_unit=default; set GLOBAL query_cache_size= default; + +# +# Bug #28897 UUID() returns non-unique values when query cache is enabled +# + +set GLOBAL query_cache_size=1000000; + +create table t1 (a char); +insert into t1 values ('c'); + +let $q1= `select UUID(), a from t1`; +let $q2= `select UUID(), a from t1`; + +# disabling the logging of the query because the UUIDs are different each run. +--disable_query_log +eval select a from t1 where "$q1" = "$q2"; +--enable_query_log + +drop table t1; + +set GLOBAL query_cache_size= default; + +# +# Bug #29053 SQL_CACHE in UNION causes non-deterministic functions to be cached +# + +set GLOBAL query_cache_size=1000000; + +create table t1 (a char); +insert into t1 values ('c'); + +let $q1= `select RAND() from t1 union select sql_cache 1 from t1;`; +let $q2= `select RAND() from t1 union select sql_cache 1 from t1;`; + +# disabling the logging of the query because the times are different each run. +--disable_query_log +eval select a from t1 where "$q1" = "$q2"; +--enable_query_log + +drop table t1; + +set GLOBAL query_cache_size= default; + # End of 5.0 tests diff --git a/mysql-test/t/row.test b/mysql-test/t/row.test index d2750fecbac..20d044306a6 100644 --- a/mysql-test/t/row.test +++ b/mysql-test/t/row.test @@ -7,10 +7,8 @@ select (1,2,3) IN ((3,2,3), (1,2,3), (1,3,3)); select row(10,2,3) IN (row(3,2,3), row(1,2,3), row(1,3,3)); select row(1,2,3) IN (row(3,NULL,3), row(1,2,3), row(1,3,3)); select row(10,2,3) IN (row(3,NULL,3), row(1,2,3), row(1,3,3)); ---disable_ps_warnings select row('a',1.5,3) IN (row(1,2,3), row('a',1.5,3), row('a','a','a')); select row('a',0,3) IN (row(3,2,3), row('a','a','3'), row(1,3,3)); ---enable_ps_warnings select row('a',0,3) IN (row(3,2,3), row('a','0','3'), row(1,3,3)); select row('a',1.5,3) IN (row(3,NULL,3), row('a',1.5,3), row(1,3,3)); select row('b',1.5,3) IN (row(3,NULL,3), row('a',1.5,3), row(1,3,3)); diff --git a/mysql-test/t/rpl000015.test b/mysql-test/t/rpl000015.test index d05e4df66b1..e103d40943f 100644 --- a/mysql-test/t/rpl000015.test +++ b/mysql-test/t/rpl000015.test @@ -1,3 +1,5 @@ +-- source include/have_log_bin.inc + connect (master,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK); connect (slave,localhost,root,,test,$SLAVE_MYPORT,$SLAVE_MYSOCK); connection master; diff --git a/mysql-test/t/rpl000017.test b/mysql-test/t/rpl000017.test index c1d36d53501..4488cbad230 100644 --- a/mysql-test/t/rpl000017.test +++ b/mysql-test/t/rpl000017.test @@ -1,3 +1,5 @@ +-- source include/have_log_bin.inc + connect (master,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK); connect (slave,localhost,root,,test,$SLAVE_MYPORT,$SLAVE_MYSOCK); connection master; diff --git a/mysql-test/t/rpl_change_master.test b/mysql-test/t/rpl_change_master.test index 6c055a81ceb..9dd1505af90 100644 --- a/mysql-test/t/rpl_change_master.test +++ b/mysql-test/t/rpl_change_master.test @@ -20,11 +20,11 @@ connection slave; stop slave; --replace_result $MASTER_MYPORT MASTER_MYPORT --replace_column 1 # 8 # 9 # 23 # 33 # -show slave status; +query_vertical show slave status; change master to master_user='root'; --replace_result $MASTER_MYPORT MASTER_MYPORT --replace_column 1 # 8 # 9 # 23 # 33 # -show slave status; +query_vertical show slave status; start slave; sync_with_master; select * from t1; diff --git a/mysql-test/t/rpl_grant.test b/mysql-test/t/rpl_grant.test new file mode 100644 index 00000000000..71e36342584 --- /dev/null +++ b/mysql-test/t/rpl_grant.test @@ -0,0 +1,42 @@ +# Tests of grants and users + +source include/master-slave.inc; +source include/not_embedded.inc; + +--echo **** On Master **** +connection master; + +CREATE USER dummy@localhost; +CREATE USER dummy1@localhost, dummy2@localhost; + +SELECT user, host FROM mysql.user WHERE user != 'root'; # root host non-determ +SELECT COUNT(*) FROM mysql.user; +sync_slave_with_master; +--echo **** On Slave **** +SELECT user,host FROM mysql.user WHERE user != 'root'; # root host non-determ +SELECT COUNT(*) FROM mysql.user; + +--echo **** On Master **** +connection master; + +# No user exists +error ER_CANNOT_USER; +DROP USER nonexisting@localhost; + +# At least one user exists, but not all +error ER_CANNOT_USER; +DROP USER nonexisting@localhost, dummy@localhost; + +# All users exist +DROP USER dummy1@localhost, dummy2@localhost; + +SELECT user, host FROM mysql.user WHERE user != 'root'; # root host non-determ +SELECT COUNT(*) FROM mysql.user; +sync_slave_with_master; +--echo **** On Slave **** +SELECT user,host FROM mysql.user WHERE user != 'root'; # root host non-determ +SELECT COUNT(*) FROM mysql.user; + +--replace_result $MASTER_MYPORT MASTER_PORT +--replace_column 1 # 8 # 9 # 23 # 33 # +query_vertical SHOW SLAVE STATUS; diff --git a/mysql-test/t/rpl_loaddata.test b/mysql-test/t/rpl_loaddata.test index 5ebdec6f761..a4781ed4faa 100644 --- a/mysql-test/t/rpl_loaddata.test +++ b/mysql-test/t/rpl_loaddata.test @@ -12,6 +12,7 @@ # Last_slave_errno in SHOW SLAVE STATUS (1st and 3rd commands did not: bug 986) source include/master-slave.inc; +source include/have_innodb.inc; connection slave; reset master; @@ -150,5 +151,14 @@ drop table t2; connection master; drop table t2; drop table t1; + +# BUG#17233 LOAD DATA INFILE: failure causes mysqld dbug_assert, binlog not flushed +CREATE TABLE t1 (word CHAR(20) NOT NULL PRIMARY KEY) ENGINE=INNODB; + +--error 1062 +LOAD DATA INFILE "../std_data_ln/words.dat" INTO TABLE t1; + +DROP TABLE t1; + sync_with_master; # End of 4.1 tests diff --git a/mysql-test/t/rpl_log_pos.test b/mysql-test/t/rpl_log_pos.test index 979b146bb22..ee8da494f86 100644 --- a/mysql-test/t/rpl_log_pos.test +++ b/mysql-test/t/rpl_log_pos.test @@ -4,31 +4,29 @@ source include/master-slave.inc; show master status; sync_slave_with_master; ---replace_result $MASTER_MYPORT MASTER_PORT ---replace_column 1 # 8 # 9 # 23 # 33 # -show slave status; -stop slave; -change master to master_log_pos=73; -start slave; -sleep 5; + stop slave; +--source include/wait_for_slave_to_stop.inc change master to master_log_pos=73; --replace_result $MASTER_MYPORT MASTER_PORT --replace_column 1 # 8 # 9 # 23 # 33 # -show slave status; +query_vertical show slave status; + start slave; -sleep 5; ---replace_result $MASTER_MYPORT MASTER_PORT ---replace_column 1 # 8 # 9 # 23 # 33 # -show slave status; +let $slave_param= Slave_SQL_Running; +let $slave_param_value= Yes; +--source include/wait_for_slave_param.inc +let $slave_param= Slave_IO_Running; +let $slave_param_value= No; +--source include/wait_for_slave_param.inc stop slave; -change master to master_log_pos=173; -start slave; -sleep 2; +--source include/wait_for_slave_to_stop.inc + --replace_result $MASTER_MYPORT MASTER_PORT --replace_column 1 # 8 # 9 # 23 # 33 # -show slave status; +query_vertical show slave status; + connection master; show master status; create table if not exists t1 (n int); @@ -37,7 +35,6 @@ create table t1 (n int); insert into t1 values (1),(2),(3); save_master_pos; connection slave; -stop slave; change master to master_log_pos=98; start slave; sync_with_master; @@ -46,4 +43,4 @@ connection master; drop table t1; sync_slave_with_master; -# End of 4.1 tests +--echo End of 5.0 tests diff --git a/mysql-test/t/rpl_misc_functions.test b/mysql-test/t/rpl_misc_functions.test index f00beff583a..1c94471c975 100644 --- a/mysql-test/t/rpl_misc_functions.test +++ b/mysql-test/t/rpl_misc_functions.test @@ -43,15 +43,16 @@ drop table t1; DROP TABLE IF EXISTS t1; --enable_warnings -CREATE TABLE t1 (col_a double default NULL); +CREATE TABLE t1 (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, + col_a DOUBLE DEFAULT NULL); DELIMITER |; # Use a SP that calls rand() multiple times CREATE PROCEDURE test_replication_sp1() BEGIN - INSERT INTO t1 VALUES (rand()), (rand()); - INSERT INTO t1 VALUES (rand()); + INSERT INTO t1 (col_a) VALUES (rand()), (rand()); + INSERT INTO t1 (col_a) VALUES (rand()); END| # Use a SP that calls another SP to call rand() multiple times @@ -73,31 +74,41 @@ DELIMITER ;| # the master to those on the slave. CALL test_replication_sp1(); CALL test_replication_sp2(); -INSERT INTO t1 VALUES (test_replication_sf()); -INSERT INTO t1 VALUES (test_replication_sf()); -INSERT INTO t1 VALUES (test_replication_sf()); - -# Record the results of the query on the master ---exec $MYSQL --port=$MASTER_MYPORT test -e "SELECT * FROM test.t1" > $MYSQLTEST_VARDIR/tmp/rpl_rand_master.sql +INSERT INTO t1 (col_a) VALUES (test_replication_sf()); +INSERT INTO t1 (col_a) VALUES (test_replication_sf()); +INSERT INTO t1 (col_a) VALUES (test_replication_sf()); --sync_slave_with_master -# Record the results of the query on the slave ---exec $MYSQL --port=$SLAVE_MYPORT test -e "SELECT * FROM test.t1" > $MYSQLTEST_VARDIR/tmp/rpl_rand_slave.sql +# Dump table on slave +select * from t1 into outfile "../tmp/t1_slave.txt"; -# Compare the results from the master to the slave. ---exec diff $MYSQLTEST_VARDIR/tmp/rpl_rand_master.sql $MYSQLTEST_VARDIR/tmp/rpl_rand_slave.sql +# Load data from slave into temp table on master +connection master; +create temporary table t1_slave select * from t1 where 1=0; +load data infile '../tmp/t1_slave.txt' into table t1_slave; +--remove_file $MYSQLTEST_VARDIR/tmp/t1_slave.txt + +# Compare master and slave temp table, use subtraction +# for floating point comparison of "double" +select count(*) into @aux from t1 join t1_slave using (id) +where ABS(t1.col_a - t1_slave.col_a) < 0.0000001 ; +SELECT @aux; +if (`SELECT @aux <> 12 OR @aux IS NULL`) +{ + --echo # ERROR: We expected to get count(*) = 12. + SELECT id, col_a FROM t1; + SELECT id, col_a FROM t1_slave; + --echo # abort + exit; +} # Cleanup connection master; ---disable_warnings -DROP PROCEDURE IF EXISTS test_replication_sp1; -DROP PROCEDURE IF EXISTS test_replication_sp2; -DROP FUNCTION IF EXISTS test_replication_sf; -DROP TABLE IF EXISTS t1; ---enable_warnings +DROP TABLE t1, t1_slave; +DROP PROCEDURE test_replication_sp1; +DROP PROCEDURE test_replication_sp2; +DROP FUNCTION test_replication_sf; --sync_slave_with_master -# If all is good, when can cleanup our dump files. ---system rm $MYSQLTEST_VARDIR/tmp/rpl_rand_master.sql ---system rm $MYSQLTEST_VARDIR/tmp/rpl_rand_slave.sql + diff --git a/mysql-test/t/rpl_packet.test b/mysql-test/t/rpl_packet.test index db6f475dc94..f410b561663 100644 --- a/mysql-test/t/rpl_packet.test +++ b/mysql-test/t/rpl_packet.test @@ -56,7 +56,7 @@ START SLAVE; # Reconnect to master for new setting to take effect disconnect master; -connect (master, localhost, root) +connect (master, localhost, root); connection master; CREATE TABLe `t1` (`f1` LONGTEXT) ENGINE=MyISAM; diff --git a/mysql-test/t/rpl_rotate_logs.test b/mysql-test/t/rpl_rotate_logs.test index 5d9f1c29fe2..0b7efb81f61 100644 --- a/mysql-test/t/rpl_rotate_logs.test +++ b/mysql-test/t/rpl_rotate_logs.test @@ -1,6 +1,8 @@ # This test uses chmod, can't be run with root permissions -- source include/not_as_root.inc +-- source include/have_log_bin.inc + # # Test is run with max_binlog_size=2048 to force automatic rotation of the # binary log @@ -107,9 +109,18 @@ show master logs; # we just tests if synonyms are accepted purge binary logs to 'master-bin.000002'; show binary logs; -# sleeping 10 seconds or more would make the slave believe connection is down ---real_sleep 1 -purge master logs before now(); + +# Calculate time to use in "purge master logs before" by taking +# last modification time of t2 and adding 1 second +# This is donw in order to handle the case where file system +# time differs from mysqld's time +--disable_result_log +select @time_for_purge:=DATE_ADD(UPDATE_TIME, INTERVAL 1 SECOND) + from information_schema.tables + where TABLE_SCHEMA="test" and TABLE_NAME="t2"; +--enable_result_log + +purge master logs before (@time_for_purge); show binary logs; insert into t2 values (65); sync_slave_with_master; @@ -158,4 +169,16 @@ connection master; drop table if exists t1,t2,t3,t4; sync_slave_with_master; -# End of 4.1 tests +--echo End of 4.1 tests + +# +# Bug #29420: crash with show and purge binlogs +# +--error 1220 +show binlog events in 'non existing_binlog_file'; +purge master logs before now(); +--error 1220 +show binlog events in ''; +purge master logs before now(); + +--echo End of 5.0 tests diff --git a/mysql-test/t/rpl_skip_error.test b/mysql-test/t/rpl_skip_error.test index f6fc73f58f2..baa7a88b8bb 100644 --- a/mysql-test/t/rpl_skip_error.test +++ b/mysql-test/t/rpl_skip_error.test @@ -17,3 +17,24 @@ connection master; drop table t1; sync_with_master; # End of 4.1 tests + +# +# #28839 Errors in strict mode silently stop SQL thread if --slave-skip-errors exists +# +create table t1(a int primary key); +insert into t1 values (1),(2); +delete from t1 where @@server_id=1; +set sql_mode=strict_trans_tables; +select @@server_id; +insert into t1 values (1),(2),(3); +sync_slave_with_master; +connection slave; +select @@server_id; +select * from t1; +--replace_column 1 # 8 # 9 # 23 # 33 # +--replace_result $MASTER_MYPORT MASTER_PORT +show slave status; +connection master; +drop table t1; +sync_with_master; +# End of 5.0 tests diff --git a/mysql-test/t/rpl_ssl.test b/mysql-test/t/rpl_ssl.test index f83f8b983b2..d08004cb00b 100644 --- a/mysql-test/t/rpl_ssl.test +++ b/mysql-test/t/rpl_ssl.test @@ -56,6 +56,9 @@ enable_query_log; connection master; insert into t1 values (NULL); sync_slave_with_master; +--source include/wait_for_slave_to_start.inc --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_MYPORT --replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # query_vertical show slave status; + +--echo End of 5.0 tests diff --git a/mysql-test/t/rpl_user_variables.test b/mysql-test/t/rpl_user_variables.test index b2f4bfbb29d..8f8f0accbd1 100644 --- a/mysql-test/t/rpl_user_variables.test +++ b/mysql-test/t/rpl_user_variables.test @@ -296,21 +296,55 @@ SELECT * from t1; SELECT * from t2; connection master; +drop table t1, t2; + +# +# Bug #26842: master binary log contains invalid queries - replication fails +# +save_master_pos; +connection slave; +sync_with_master; +reset master; + +connection master; +create table t1 (a int); +prepare s from "insert into t1 values (@a),(?)"; +set @a=98; execute s using @a; +prepare s from "insert into t1 values (?)"; +set @a=99; execute s using @a; +prepare s from "insert into t1 select 100 limit ?"; +set @a=100; execute s using @a; + +save_master_pos; +connection slave; +sync_with_master; +show binlog events from 98; +select * from t1; +connection master; +drop table t1; + +# +# Bug #12826: Possible to get inconsistent slave using SQL syntax Prepared Statements +# +connection master; +create table t1(a int, b int); +prepare s1 from 'insert into t1 values (@x:=@x+1, ?)'; +set @x=1; execute s1 using @x; +select * from t1; +sync_slave_with_master; +connection slave; +select * from t1; +connection master; +drop table t1; --echo End of 5.0 tests. -# Cleanup - -DROP TABLE t1; -DROP TABLE t2; - # This test uses a stored function that uses user-defined variables to return data # The test ensures the value of the user-defined variable is replicated correctly # and in the correct order of assignment. # This test was constructed for BUG#20141 --disable_warnings -DROP TABLE IF EXISTS t1; DROP FUNCTION IF EXISTS f1; DROP FUNCTION IF EXISTS f2; --enable_warnings @@ -358,4 +392,3 @@ DROP TABLE t1; sync_slave_with_master; stop slave; - diff --git a/mysql-test/t/rpl_view.test b/mysql-test/t/rpl_view.test index 812e5d44d58..21748586130 100644 --- a/mysql-test/t/rpl_view.test +++ b/mysql-test/t/rpl_view.test @@ -149,4 +149,16 @@ drop view v1; sync_slave_with_master; +# +# BUG#28244 CREATE VIEW breaks replication when view exists +# +connection master; +CREATE TABLE t1(a INT); +CREATE VIEW v1 AS SELECT * FROM t1; +--error ER_TABLE_EXISTS_ERROR +CREATE VIEW v1 AS SELECT * FROM t1; +DROP VIEW v1; +DROP TABLE t1; +sync_slave_with_master; + --echo End of 5.0 tests diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test index 369ae9bff65..a58d81a414b 100644 --- a/mysql-test/t/show_check.test +++ b/mysql-test/t/show_check.test @@ -18,6 +18,12 @@ flush privileges; create table t1 (a int not null primary key, b int not null,c int not null, key(b,c)); insert into t1 values (1,2,2),(2,2,3),(3,2,4),(4,2,4); + +--echo -- Here we enable metadata just to check that the collation of the +--echo -- resultset is non-binary for string type. This should be changed +--echo -- after Bug#29394 is implemented. + +--enable_metadata check table t1 fast; check table t1 fast; check table t1 changed; @@ -26,28 +32,58 @@ check table t1 changed; check table t1 medium; check table t1 extended; show index from t1; +--disable_metadata --error 1062 insert into t1 values (5,5,5); + +--echo -- Here we enable metadata just to check that the collation of the +--echo -- resultset is non-binary for string type. This should be changed +--echo -- after Bug#29394 is implemented. + +--enable_metadata optimize table t1; +--disable_metadata optimize table t1; drop table t1; #show variables; + +--echo -- Here we enable metadata just to check that the collation of the +--echo -- resultset is non-binary for string type. This should be changed +--echo -- after Bug#29394 is implemented. + +--enable_metadata show variables like "wait_timeout%"; show variables like "WAIT_timeout%"; show variables like "this_doesn't_exists%"; show table status from test like "this_doesn't_exists%"; show databases; show databases like "test%"; +--disable_metadata # # Check of show index # create table t1 (f1 int not null, f2 int not null, f3 int not null, f4 int not null, primary key(f1,f2,f3,f4)); insert into t1 values (1,1,1,0),(1,1,2,0),(1,1,3,0),(1,2,1,0),(1,2,2,0),(1,2,3,0),(1,3,1,0),(1,3,2,0),(1,3,3,0),(1,1,1,1),(1,1,2,1),(1,1,3,1),(1,2,1,1),(1,2,2,1),(1,2,3,1),(1,3,1,1),(1,3,2,1),(1,3,3,1); + +--echo -- Here we enable metadata just to check that the collation of the +--echo -- resultset is non-binary for string type. This should be changed +--echo -- after Bug#29394 is implemented. + +--enable_metadata analyze table t1; +--disable_metadata show index from t1; + +--echo -- Here we enable metadata just to check that the collation of the +--echo -- resultset is non-binary for string type. This should be changed +--echo -- after Bug#29394 is implemented. + +--enable_metadata + repair table t1; +--disable_metadata show index from t1; drop table t1; @@ -518,4 +554,232 @@ show status like 'slow_queries'; select 1 from information_schema.tables limit 1; show status like 'slow_queries'; +# +# BUG#10491: Server returns data as charset binary SHOW CREATE TABLE or SELECT +# FROM I_S. +# + +# Ensure that all needed objects are dropped. + +--disable_warnings +DROP DATABASE IF EXISTS mysqltest1; +DROP TABLE IF EXISTS t1; +DROP VIEW IF EXISTS v1; +DROP PROCEDURE IF EXISTS p1; +DROP FUNCTION IF EXISTS f1; +--enable_warnings + +# Create objects. + +CREATE DATABASE mysqltest1; + +CREATE TABLE t1(c INT NOT NULL PRIMARY KEY); + +CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1; + +CREATE VIEW v1 AS SELECT 1; + +CREATE PROCEDURE p1() SELECT 1; + +CREATE FUNCTION f1() RETURNS INT RETURN 1; + + +# Test. + +set names utf8; + +--echo -- Here we enable metadata just to check that the collation of the +--echo -- resultset is non-binary for string type. This should be changed +--echo -- after Bug#29394 is implemented. + +--enable_metadata + +--echo ---------------------------------------------------------------- + +SHOW CHARACTER SET LIKE 'utf8'; + +--echo ---------------------------------------------------------------- + +SHOW COLLATION LIKE 'latin1_bin'; + +--echo ---------------------------------------------------------------- + +SHOW CREATE DATABASE mysqltest1; + +--echo ---------------------------------------------------------------- + +SHOW DATABASES LIKE 'mysqltest1'; + +--echo ---------------------------------------------------------------- + +SHOW CREATE TABLE t1; + +--echo ---------------------------------------------------------------- + +SHOW INDEX FROM t1; + +--echo ---------------------------------------------------------------- + +SELECT + TABLE_CATALOG, + TABLE_SCHEMA, + TABLE_NAME, + TABLE_TYPE, + ENGINE, + ROW_FORMAT, + TABLE_COLLATION, + CREATE_OPTIONS, + TABLE_COMMENT +FROM INFORMATION_SCHEMA.TABLES +WHERE table_name = 't1'; + +--echo ---------------------------------------------------------------- + +SELECT + TABLE_CATALOG, + TABLE_SCHEMA, + TABLE_NAME, + COLUMN_NAME, + COLUMN_DEFAULT, + IS_NULLABLE, + DATA_TYPE, + CHARACTER_SET_NAME, + COLLATION_NAME, + COLUMN_TYPE, + COLUMN_KEY, + EXTRA, + PRIVILEGES, + COLUMN_COMMENT +FROM INFORMATION_SCHEMA.COLUMNS +WHERE table_name = 't1'; + +--echo ---------------------------------------------------------------- + +SHOW TABLES LIKE 't1'; + +--echo ---------------------------------------------------------------- + +SHOW COLUMNS FROM t1; + +--echo ---------------------------------------------------------------- + +SHOW TRIGGERS LIKE 't1'; + +--echo ---------------------------------------------------------------- + +SELECT + TRIGGER_CATALOG, + TRIGGER_SCHEMA, + TRIGGER_NAME, + EVENT_MANIPULATION, + EVENT_OBJECT_CATALOG, + EVENT_OBJECT_SCHEMA, + EVENT_OBJECT_TABLE, + ACTION_CONDITION, + ACTION_STATEMENT, + ACTION_ORIENTATION, + ACTION_TIMING, + ACTION_REFERENCE_OLD_TABLE, + ACTION_REFERENCE_NEW_TABLE, + ACTION_REFERENCE_OLD_ROW, + ACTION_REFERENCE_NEW_ROW, + SQL_MODE, + DEFINER +FROM INFORMATION_SCHEMA.TRIGGERS +WHERE trigger_name = 't1_bi'; + +--echo ---------------------------------------------------------------- + +SHOW CREATE VIEW v1; + +--echo ---------------------------------------------------------------- + +SELECT * +FROM INFORMATION_SCHEMA.VIEWS +WHERE table_name = 'v1'; + +--echo ---------------------------------------------------------------- + +SHOW CREATE PROCEDURE p1; + +--echo ---------------------------------------------------------------- + +SELECT + SPECIFIC_NAME, + ROUTINE_CATALOG, + ROUTINE_SCHEMA, + ROUTINE_NAME, + ROUTINE_TYPE, + DTD_IDENTIFIER, + ROUTINE_BODY, + ROUTINE_DEFINITION, + EXTERNAL_NAME, + EXTERNAL_LANGUAGE, + PARAMETER_STYLE, + IS_DETERMINISTIC, + SQL_DATA_ACCESS, + SQL_PATH, + SECURITY_TYPE, + SQL_MODE, + ROUTINE_COMMENT, + DEFINER +FROM INFORMATION_SCHEMA.ROUTINES +WHERE routine_name = 'p1'; + +--echo ---------------------------------------------------------------- + +SHOW CREATE FUNCTION f1; + +--echo ---------------------------------------------------------------- + +SELECT + SPECIFIC_NAME, + ROUTINE_CATALOG, + ROUTINE_SCHEMA, + ROUTINE_NAME, + ROUTINE_TYPE, + DTD_IDENTIFIER, + ROUTINE_BODY, + ROUTINE_DEFINITION, + EXTERNAL_NAME, + EXTERNAL_LANGUAGE, + PARAMETER_STYLE, + IS_DETERMINISTIC, + SQL_DATA_ACCESS, + SQL_PATH, + SECURITY_TYPE, + SQL_MODE, + ROUTINE_COMMENT, + DEFINER +FROM INFORMATION_SCHEMA.ROUTINES +WHERE routine_name = 'f1'; + +--echo ---------------------------------------------------------------- + +--disable_metadata + +# Cleanup. + +DROP DATABASE mysqltest1; +DROP TABLE t1; +DROP VIEW v1; +DROP PROCEDURE p1; +DROP FUNCTION f1; + +# +# Bug #28808: log_queries_not_using_indexes variable dynamic change is ignored +# +flush status; +show variables like "log_queries_not_using_indexes"; +select 1 from information_schema.tables limit 1; +show status like 'slow_queries'; +set global log_queries_not_using_indexes=OFF; +show variables like "log_queries_not_using_indexes"; +select 1 from information_schema.tables limit 1; +show status like 'slow_queries'; +set global log_queries_not_using_indexes=ON; +show variables like "log_queries_not_using_indexes"; +select 1 from information_schema.tables limit 1; +show status like 'slow_queries'; + --echo End of 5.0 tests diff --git a/mysql-test/t/sp-code.test b/mysql-test/t/sp-code.test index 0f249c95172..10755f2bf8a 100644 --- a/mysql-test/t/sp-code.test +++ b/mysql-test/t/sp-code.test @@ -2,7 +2,7 @@ # Test the debugging feature "show procedure/function code " # --- source include/is_debug_build.inc +-- source include/have_debug.inc --disable_warnings drop procedure if exists empty; diff --git a/mysql-test/t/sp-dynamic.test b/mysql-test/t/sp-dynamic.test index 6546a5ab548..e6f4aae96ac 100644 --- a/mysql-test/t/sp-dynamic.test +++ b/mysql-test/t/sp-dynamic.test @@ -85,7 +85,7 @@ call p1()| call p1()| drop procedure p1| # -# D. Create/Drop a table (a DDL that issues a commit) in Dynamic SQL. +# D. Create/Drop/Alter a table (a DDL that issues a commit) in Dynamic SQL. # (should work ok). # create procedure p1() @@ -96,6 +96,10 @@ begin execute stmt; insert into t1 (a) values (1); select * from t1; + prepare stmt_alter from "alter table t1 add (b int)"; + execute stmt_alter; + insert into t1 (a,b) values (2,1); + deallocate prepare stmt_alter; deallocate prepare stmt; deallocate prepare stmt_drop; end| @@ -239,6 +243,7 @@ drop procedure p1| # K. Use of continue handlers with Dynamic SQL. # drop table if exists t1| +drop table if exists t2| create table t1 (id integer primary key auto_increment, stmt_text char(35), status varchar(20))| insert into t1 (stmt_text) values @@ -249,7 +254,10 @@ insert into t1 (stmt_text) values ("help help"), ("show databases"), ("show tables"), ("show table status"), ("show open tables"), ("show storage engines"), ("insert into t1 (id) values (1)"), ("update t1 set status=''"), - ("delete from t1"), ("truncate t1"), ("call p1()"), ("foo bar")| + ("delete from t1"), ("truncate t1"), ("call p1()"), ("foo bar"), + ("create view v1 as select 1"), ("alter view v1 as select 2"), + ("drop view v1"),("create table t2 (a int)"),("alter table t2 add (b int)"), + ("drop table t2")| create procedure p1() begin declare v_stmt_text varchar(255); diff --git a/mysql-test/t/sp-error.test b/mysql-test/t/sp-error.test index 9e5c795d586..240cda67edc 100644 --- a/mysql-test/t/sp-error.test +++ b/mysql-test/t/sp-error.test @@ -1087,12 +1087,12 @@ delimiter ;| # # BUG 12490 (Packets out of order if calling HELP CONTENTS from Stored Procedure) # ---error 1314 +--error ER_SP_BADSTATEMENT CREATE PROCEDURE BUG_12490() HELP CONTENTS; ---error 1314 +--error ER_SP_BADSTATEMENT CREATE FUNCTION BUG_12490() RETURNS INT HELP CONTENTS; CREATE TABLE t_bug_12490(a int); ---error 1314 +--error ER_SP_BADSTATEMENT CREATE TRIGGER BUG_12490 BEFORE UPDATE ON t_bug_12490 FOR EACH ROW HELP CONTENTS; DROP TABLE t_bug_12490; @@ -1397,9 +1397,9 @@ CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN create view v1 as sele -- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG CREATE FUNCTION bug_13627_f() returns int BEGIN create view v1 as select 1; return 1; END | --- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG +-- error ER_SP_BADSTATEMENT CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN alter view v1 as select 1; END | --- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG +-- error ER_SP_BADSTATEMENT CREATE FUNCTION bug_13627_f() returns int BEGIN alter view v1 as select 1; return 1; END | -- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG @@ -1454,7 +1454,7 @@ select bug12329(); # Until we implement proper mechanism for invalidation of PS/SP when table # or SP's are changed the following statement will fail with 'Table ... was # not locked' error (this mechanism should be based on the new TDC). ---error 1100 +--error ER_NO_SUCH_TABLE execute stmt1; deallocate prepare stmt1; drop function bug12329; @@ -1639,13 +1639,13 @@ create trigger t1_ai after insert on t1 for each row insert into t2 values (new. create view v1 as select * from t1; drop table t2; # Limitation, the desired error is ER_VIEW_INVALID ---error ER_TABLE_NOT_LOCKED +--error ER_NO_SUCH_TABLE insert into v1 values (1); drop trigger t1_ai; create function bug11555_1() returns int return (select max(i) from t2); create trigger t1_ai after insert on t1 for each row set @a:=bug11555_1(); # Limitation, the desired error is ER_VIEW_INVALID ---error ER_TABLE_NOT_LOCKED +--error ER_NO_SUCH_TABLE insert into v1 values (2); drop function bug11555_1; drop table t1; diff --git a/mysql-test/t/sp-prelocking.test b/mysql-test/t/sp-prelocking.test index cc3e3b93e06..ec5b7fbad7c 100644 --- a/mysql-test/t/sp-prelocking.test +++ b/mysql-test/t/sp-prelocking.test @@ -301,5 +301,36 @@ deallocate prepare stmt; drop function bug19634; drop table t1, t2, t3; +# +# Bug #27907 Misleading error message when opening/locking tables +# + +--disable_warnings +drop table if exists bug_27907_logs; +drop table if exists bug_27907_t1; +--enable_warnings + +create table bug_27907_logs (a int); +create table bug_27907_t1 (a int); + +delimiter |; + +create trigger bug_27907_t1_ai after insert on bug_27907_t1 +for each row +begin + insert into bug_27907_logs (a) values (1); +end| + +delimiter ;| + +drop table bug_27907_logs; + +# +# was failing before with error ER_NOT_LOCKED +# +--error ER_NO_SUCH_TABLE +insert into bug_27907_t1(a) values (1); + +drop table bug_27907_t1; --echo End of 5.0 tests diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index ff203a85ef7..2f82482bdf7 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -705,9 +705,11 @@ begin insert into test.t1 values (concat(x, "2"), y+2); end| ---system rm -f $MYSQLTEST_VARDIR/tmp/spout +# Check that file does not exists +--error 1 +--file_exists $MYSQLTEST_VARDIR/tmp/spout call into_outfile("ofile", 1)| ---system rm -f $MYSQLTEST_VARDIR/tmp/spout +--remove_file $MYSQLTEST_VARDIR/tmp/spout delete from t1| drop procedure into_outfile| @@ -722,9 +724,11 @@ begin insert into test.t1 values (concat(x, "2"), y+2); end| ---system rm -f $MYSQLTEST_VARDIR/tmp/spdump +# Check that file does not exists +--error 1 +--file_exists $MYSQLTEST_VARDIR/tmp/spdump call into_dumpfile("dfile", 1)| ---system rm -f $MYSQLTEST_VARDIR/tmp/spdump +--remove_file $MYSQLTEST_VARDIR/tmp/spdump delete from t1| drop procedure into_dumpfile| @@ -6975,7 +6979,7 @@ use test| --disable_warnings drop function if exists bug20777| drop table if exists examplebug20777| ---enabled_warnings +--enable_warnings create function bug20777(f1 bigint unsigned) returns bigint unsigned begin set f1 = (f1 - 10); set f1 = (f1 + 10); @@ -7112,3 +7116,23 @@ select count(*) from t1 /* must be 3 */; drop table t1,t2; drop function bug27354; + +# +# Bug #28605: SHOW CREATE VIEW with views using stored_procedures no longer +# showing SP names. +# +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2); + +CREATE FUNCTION metered(a INT) RETURNS INT RETURN 12; + +CREATE VIEW v1 AS SELECT test.metered(a) as metered FROM t1; + +SHOW CREATE VIEW v1; + +DROP VIEW v1; +DROP FUNCTION metered; +DROP TABLE t1; + + +--echo End of 5.0 tests diff --git a/mysql-test/t/sp_trans.test b/mysql-test/t/sp_trans.test index 8eccaafcf0e..60f7e3326b4 100644 --- a/mysql-test/t/sp_trans.test +++ b/mysql-test/t/sp_trans.test @@ -2,6 +2,7 @@ # tests that require InnoDB... # +-- source include/have_log_bin.inc -- source include/have_innodb.inc --disable_warnings @@ -553,34 +554,6 @@ drop procedure bug14210| set @@session.max_heap_table_size=default| -# -# Bug #13270 INSERT,UPDATE,etc that calls func with side-effect does not binlog -# Bug #23333 stored function + non-transac table + transac table = -# breaks stmt-based binlog -# Bug #27395 OPTION_STATUS_NO_TRANS_UPDATE is not preserved at the end of SF() -# -CREATE TABLE t1 (a int NOT NULL auto_increment primary key) ENGINE=MyISAM| -CREATE TABLE t2 (a int NOT NULL auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB| - -insert into t2 values (1,1)| - -create function bug23333() -RETURNS int(11) -DETERMINISTIC -begin - insert into t1 values (null); - select count(*) from t1 into @a; - return @a; -end| - -reset master| ---error ER_DUP_ENTRY -insert into t2 values (bug23333(),1)| ---replace_column 2 # 5 # 6 # -show binlog events from 98 /* with fixes for #23333 will show there is the query */| -select count(*),@a from t1 /* must be 1,1 */| -drop table t1, t2| - # # BUG#NNNN: New bug synopsis # diff --git a/mysql-test/t/sp_trans_log.test b/mysql-test/t/sp_trans_log.test new file mode 100644 index 00000000000..3e440b3ccc1 --- /dev/null +++ b/mysql-test/t/sp_trans_log.test @@ -0,0 +1,33 @@ +-- source include/have_innodb.inc +-- source include/have_log_bin.inc + +delimiter |; + +# +# Bug #13270 INSERT,UPDATE,etc that calls func with side-effect does not binlog +# Bug #23333 stored function + non-transac table + transac table = +# breaks stmt-based binlog +# Bug #27395 OPTION_STATUS_NO_TRANS_UPDATE is not preserved at the end of SF() +# +CREATE TABLE t1 (a int NOT NULL auto_increment primary key) ENGINE=MyISAM| +CREATE TABLE t2 (a int NOT NULL auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB| + +insert into t2 values (1,1)| + +create function bug23333() +RETURNS int(11) +DETERMINISTIC +begin + insert into t1 values (null); + select count(*) from t1 into @a; + return @a; +end| + +reset master| +--error ER_DUP_ENTRY +insert into t2 values (bug23333(),1)| +--replace_column 2 # 5 # 6 # +show binlog events from 98 /* with fixes for #23333 will show there is the query */| +select count(*),@a from t1 /* must be 1,1 */| +drop table t1, t2| + diff --git a/mysql-test/t/ssl-big.test b/mysql-test/t/ssl-big.test new file mode 100644 index 00000000000..099c64df08f --- /dev/null +++ b/mysql-test/t/ssl-big.test @@ -0,0 +1,56 @@ +# Turn on ssl between the client and server +# and run a number of tests + +-- source include/have_ssl.inc +-- source include/big_test.inc + +--disable_warnings +DROP TABLE IF EXISTS t1, t2; +--enable_warnings + +# +# Bug #29579 Clients using SSL can hang the server +# + +connect (ssl_con,localhost,root,,,,,SSL); + +create table t1 (a int); + +disconnect ssl_con; + + +--disable_query_log +--disable_result_log + +let $count= 2000; +while ($count) +{ + connect (ssl_con,localhost,root,,,,,SSL); + + eval insert into t1 values ($count); + dec $count; + + # This select causes the net buffer to fill as the server sends the results + # but the client doesn't reap the results. The results are larger each time + # through the loop, so that eventually the buffer is completely full + # at the exact moment the server attempts to the close the connection with + # the lock held. + send select * from t1; + + # now send the quit the command so the server will initiate the shutdown. + send_quit ssl_con; + + # if the server is hung, this will hang too: + connect (ssl_con2,localhost,root,,,,,SSL); + + # no hang if we get here, close and retry + disconnect ssl_con2; + disconnect ssl_con; +} +--enable_query_log +--enable_result_log + +connect (ssl_con,localhost,root,,,,,SSL); + +drop table t1; + diff --git a/mysql-test/t/status.test b/mysql-test/t/status.test index 3f7671b18d4..6fcb82e160d 100644 --- a/mysql-test/t/status.test +++ b/mysql-test/t/status.test @@ -25,7 +25,7 @@ connection con1; --send update t1 set n = 3; connection con2; -sleep 0.5; +sleep 1; unlock tables; connection con1; reap; diff --git a/mysql-test/t/strict.test b/mysql-test/t/strict.test index fc663853174..2b71bf1093c 100644 --- a/mysql-test/t/strict.test +++ b/mysql-test/t/strict.test @@ -890,11 +890,11 @@ INSERT INTO t1 (col1,col2,col3) VALUES (NULL, '', '2004-01-01'); INSERT INTO t1 (col1,col2,col3) VALUES (102, NULL, '2004-01-01'); --error 1048 INSERT INTO t1 VALUES (103,'',NULL); ---error 1263 +--error 1048 UPDATE t1 SET col1=NULL WHERE col1 =100; ---error 1263 +--error 1048 UPDATE t1 SET col2 =NULL WHERE col2 ='hello'; ---error 1263 +--error 1048 UPDATE t1 SET col2 =NULL where col3 IS NOT NULL; INSERT IGNORE INTO t1 values (NULL,NULL,NULL); SELECT * FROM t1; @@ -914,7 +914,7 @@ INSERT INTO t1 (col1) VALUES (2); INSERT INTO t1 VALUES(default(col1),default(col2)); --error 1364 INSERT INTO t1 (col1) SELECT 1; ---error 1263 +--error 1048 INSERT INTO t1 SELECT 1,NULL; INSERT IGNORE INTO t1 values (NULL,NULL); INSERT IGNORE INTO t1 (col1) values (3); @@ -975,9 +975,7 @@ select * from t1; # Check that select don't abort even in strict mode (for now) set sql_mode='traditional'; ---disable_ps_warnings select count(*) from t1 where STR_TO_DATE('2004.12.12 10:22:61','%Y.%m.%d %T') IS NULL; ---enable_ps_warnings drop table t1; diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index 5840e434b64..d076ca6bd33 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -1821,13 +1821,6 @@ SELECT * FROM t1 DROP TABLE t1,t2,t3; -# -# BUG #10308: purge log with subselect -# - -purge master logs before (select adddate(current_timestamp(), interval -4 day)); - - # # Bug#18503: Queries with a quantified subquery returning empty set may # return a wrong result. @@ -2906,4 +2899,92 @@ SELECT id, st FROM t1 DROP TABLE t1,t2; +# +# Bug #28728: crash with EXPLAIN EXTENDED for a query with a derived table +# over a grouping subselect +# + +CREATE TABLE t1 (a int); + +INSERT INTO t1 VALUES (1), (2); + +EXPLAIN EXTENDED +SELECT * FROM (SELECT count(*) FROM t1 GROUP BY a) as res; + +DROP TABLE t1; + +# +# Bug #28811: crash for query containing subquery with ORDER BY and LIMIT 1 +# + +CREATE TABLE t1 ( + a varchar(255) default NULL, + b timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, + INDEX idx(a,b) +); +CREATE TABLE t2 ( + a varchar(255) default NULL +); + +INSERT INTO t1 VALUES ('abcdefghijk','2007-05-07 06:00:24'); +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO `t1` VALUES ('asdf','2007-02-08 01:11:26'); +INSERT INTO `t2` VALUES ('abcdefghijk'); +INSERT INTO `t2` VALUES ('asdf'); + +SET session sort_buffer_size=8192; + +SELECT (SELECT 1 FROM t1 WHERE t1.a=t2.a ORDER BY t1.b LIMIT 1) AS d1 FROM t2; + +DROP TABLE t1,t2; + + +# +# Bug #27333: subquery grouped for aggregate of outer query / no aggregate +# of subquery +# +CREATE TABLE t1 (a INTEGER, b INTEGER); +CREATE TABLE t2 (x INTEGER); +INSERT INTO t1 VALUES (1,11), (2,22), (2,22); +INSERT INTO t2 VALUES (1), (2); + +# wasn't failing, but should +--error ER_SUBQUERY_NO_1_ROW +SELECT a, COUNT(b), (SELECT COUNT(b) FROM t2) FROM t1 GROUP BY a; + +# fails as it should +--error ER_SUBQUERY_NO_1_ROW +SELECT a, COUNT(b), (SELECT COUNT(b)+0 FROM t2) FROM t1 GROUP BY a; + +SELECT (SELECT SUM(t1.a)/AVG(t2.x) FROM t2) FROM t1; +DROP TABLE t1,t2; + +# second test case from 27333 +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 +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; +DROP TABLE t1; + +#test cases from 29297 +CREATE TABLE t1 (a INT); +CREATE TABLE t2 (a INT); +INSERT INTO t1 VALUES (1),(2); +INSERT INTO t2 VALUES (1),(2); +SELECT (SELECT SUM(t1.a) FROM t2 WHERE a=0) FROM t1; +--error ER_SUBQUERY_NO_1_ROW +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; + --echo End of 5.0 tests. diff --git a/mysql-test/t/subselect3.test b/mysql-test/t/subselect3.test index 65556012588..2f844c9cc21 100644 --- a/mysql-test/t/subselect3.test +++ b/mysql-test/t/subselect3.test @@ -260,11 +260,11 @@ insert into t2 values ('dd', 1, NULL); alter table t1 add index idx(ie1,ie2); ---cc 3 NULL NULL +# cc 3 NULL NULL select oref, a, b, (a,b) in (select ie1,ie2 from t1 where oref=t2.oref) Z from t2 where a=3 and b is null ; insert into t2 values ('new1', 10,10); insert into t1 values ('new1', 1234, 10, NULL); --- new1, 10, 10, NULL, +# new1, 10, 10, NULL, select oref, a, b, (a,b) in (select ie1,ie2 from t1 where oref=t2.oref) Z from t2 where a=10 and b=10; explain extended select oref, a, b, (a,b) in (select ie1,ie2 from t1 where oref=t2.oref) Z from t2 where a=10 and b=10; @@ -571,3 +571,21 @@ SELECT (t1.id IN (SELECT t2.id FROM t2,t3 FROM t1; DROP TABLE t1,t2,t3; + +# +# Bug #22855: Optimizer doesn't rewrite NOT IN subselects to a correlated +# subquery +# +CREATE TABLE t1 (a INT NOT NULL); +INSERT INTO t1 VALUES (1),(-1), (65),(66); + +CREATE TABLE t2 (a INT UNSIGNED NOT NULL PRIMARY KEY); +INSERT INTO t2 VALUES (65),(66); + +SELECT a FROM t1 WHERE a NOT IN (65,66); +SELECT a FROM t1 WHERE a NOT IN (SELECT a FROM t2); +EXPLAIN SELECT a FROM t1 WHERE a NOT IN (SELECT a FROM t2); + +DROP TABLE t1; + +--echo End of 5.0 tests diff --git a/mysql-test/t/subselect_notembedded.test b/mysql-test/t/subselect_notembedded.test index c5b23f6dac8..c112272e8ad 100644 --- a/mysql-test/t/subselect_notembedded.test +++ b/mysql-test/t/subselect_notembedded.test @@ -1,8 +1,9 @@ -- source include/not_embedded.inc # -# BUG #10308: purge log with subselect +# BUG#10308: purge log with subselect +# Bug#28553: mysqld crash in "purge master log before(select time from information_schema)" # - +--error 1064 purge master logs before (select adddate(current_timestamp(), interval -4 day)); - +purge master logs before adddate(current_timestamp(), interval -4 day); diff --git a/mysql-test/t/trigger.test b/mysql-test/t/trigger.test index 82de4dac111..7158d02956e 100644 --- a/mysql-test/t/trigger.test +++ b/mysql-test/t/trigger.test @@ -1000,9 +1000,9 @@ create trigger t1_bi after insert on t1 for each row insert into t3 values (new. # Until we implement proper mechanism for invalidation of PS/SP when table # or SP's are changed these two statements will fail with 'Table ... was # not locked' error (this mechanism should be based on the new TDC). ---error 1100 #ER_TABLE_NOT_LOCKED +--error ER_NO_SUCH_TABLE execute stmt1; ---error 1100 #ER_TABLE_NOT_LOCKED +--error ER_NO_SUCH_TABLE call p1(); deallocate prepare stmt1; drop procedure p1; @@ -1763,4 +1763,70 @@ select * from t1; select * from t3; drop table t1, t2, t3; +disconnect addconroot1; +disconnect addconroot2; +disconnect addconwithoutdb; +# +# Bug #26162: Trigger DML ignores low_priority_updates setting +# +CREATE TABLE t1 (id INTEGER); +CREATE TABLE t2 (id INTEGER); + +INSERT INTO t2 VALUES (1),(2); + +# trigger that produces the high priority insert, but should be low, adding +# LOW_PRIORITY fixes this +CREATE TRIGGER t1_test AFTER INSERT ON t1 FOR EACH ROW + INSERT INTO t2 VALUES (new.id); + +CONNECT (rl_holder, localhost, root,,); +CONNECT (rl_acquirer, localhost, root,,); +CONNECT (wl_acquirer, localhost, root,,); +CONNECT (rl_contender, localhost, root,,); + +CONNECTION rl_holder; +SELECT GET_LOCK('B26162',120); + +CONNECTION rl_acquirer; +--send +SELECT 'rl_acquirer', GET_LOCK('B26162',120), id FROM t2 WHERE id = 1; + +CONNECTION wl_acquirer; +SET SESSION LOW_PRIORITY_UPDATES=1; +SET GLOBAL LOW_PRIORITY_UPDATES=1; +#need to wait for rl_acquirer to lock on the B26162 lock +sleep 2; +--send +INSERT INTO t1 VALUES (5); + +CONNECTION rl_contender; +# must not "see" the row inserted by the INSERT (as it must run before the +# INSERT) +--send +SELECT 'rl_contender', id FROM t2 WHERE id > 1; + +CONNECTION rl_holder; +#need to wait for wl_acquirer and rl_contender to lock on t2 +sleep 2; +SELECT RELEASE_LOCK('B26162'); + +CONNECTION rl_acquirer; +--reap +SELECT RELEASE_LOCK('B26162'); +CONNECTION wl_acquirer; +--reap +CONNECTION rl_contender; +--reap + +CONNECTION default; +DISCONNECT rl_acquirer; +DISCONNECT wl_acquirer; +DISCONNECT rl_contender; +DISCONNECT rl_holder; + +DROP TRIGGER t1_test; +DROP TABLE t1,t2; +SET SESSION LOW_PRIORITY_UPDATES=DEFAULT; +SET GLOBAL LOW_PRIORITY_UPDATES=DEFAULT; + --echo End of 5.0 tests diff --git a/mysql-test/t/type_datetime.test b/mysql-test/t/type_datetime.test index d420afbde37..ffda593f320 100644 --- a/mysql-test/t/type_datetime.test +++ b/mysql-test/t/type_datetime.test @@ -271,3 +271,14 @@ select if(@bug28261 = f1, '', @bug28261:= f1) from t1; select if(@bug28261 = f1, '', @bug28261:= f1) from t1; select if(@bug28261 = f1, '', @bug28261:= f1) from t1; drop table t1; + +# +# Bug#28778: Wrong result of BETWEEN when comparing a DATETIME field with an +# integer constants. +# +create table t1(f1 datetime); +insert into t1 values('2001-01-01'),('2002-02-02'); +select * from t1 where f1 between 20020101 and 20070101000000; +select * from t1 where f1 between 2002010 and 20070101000000; +select * from t1 where f1 between 20020101 and 2007010100000; +drop table t1; diff --git a/mysql-test/t/type_decimal.test b/mysql-test/t/type_decimal.test index 4fdb0c8458f..5538f19f5f9 100644 --- a/mysql-test/t/type_decimal.test +++ b/mysql-test/t/type_decimal.test @@ -394,3 +394,17 @@ create table t1 as from (select 1 as s,'t' as t union select null, null ) as sub1; select group_concat(t) from t1 group by week(date)/10; drop table t1; + +# +# Bug#28980: ROUND(, ) returned double values +# + +CREATE TABLE t1 ( + qty decimal(16,6) default NULL, + dps tinyint(3) unsigned default NULL +); +INSERT INTO t1 VALUES (1.1325,3); + +SELECT ROUND(qty,3), dps, ROUND(qty,dps) FROM t1; + +DROP TABLE t1; diff --git a/mysql-test/t/type_enum.test b/mysql-test/t/type_enum.test index 4b3429d9ea0..ecc945a3157 100644 --- a/mysql-test/t/type_enum.test +++ b/mysql-test/t/type_enum.test @@ -156,4 +156,29 @@ drop table t1; create table t1(exhausting_charset enum('ABCDEFGHIJKLMNOPQRSTUVWXYZ','  !"','#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~','xx\','yy\€','zz‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ')); +# +# Bug #29251: MySQL coerces special 0 enum values to normal '' value +# when ALTERing the column +# + +CREATE TABLE t1 ( + id INT AUTO_INCREMENT PRIMARY KEY, + c1 ENUM('a', '', 'b') +); +INSERT INTO t1 (c1) VALUES (0), ('a'), (''), ('b'); +SELECT id, c1 + 0, c1 FROM t1; + +ALTER TABLE t1 CHANGE c1 c1 ENUM('a', '') NOT NULL; +SELECT id, c1 + 0, c1 FROM t1; + +DROP TABLE t1; + --echo End of 4.1 tests + +# +# Bug#28729: Field_enum wrongly reported an error while storing an empty string. +# +create table t1(f1 set('a','b'), index(f1)); +insert into t1 values(''),(''),('a'),('b'); +select * from t1 where f1=''; +drop table t1; diff --git a/mysql-test/t/type_float.test b/mysql-test/t/type_float.test index f790bcf6daa..a55200c8853 100644 --- a/mysql-test/t/type_float.test +++ b/mysql-test/t/type_float.test @@ -222,3 +222,23 @@ drop table t1; create table t1 (s1 float(0,2)); --error 1427 create table t1 (s1 float(1,2)); + +# +# Bug #28121 "INSERT or UPDATE into DOUBLE(200,0) field being truncated to 31 digits" +# + +create table t1 (f1 double(200, 0)); +insert into t1 values (1e199), (-1e199); +insert into t1 values (1e200), (-1e200); +insert into t1 values (2e200), (-2e200); +select f1 + 0e0 from t1; +drop table t1; + +create table t1 (f1 float(30, 0)); +insert into t1 values (1e29), (-1e29); +insert into t1 values (1e30), (-1e30); +insert into t1 values (2e30), (-2e30); +select f1 + 0e0 from t1; +drop table t1; + +--echo End of 5.0 tests diff --git a/mysql-test/t/type_newdecimal.test b/mysql-test/t/type_newdecimal.test index a7906be79d4..5a631b6163e 100644 --- a/mysql-test/t/type_newdecimal.test +++ b/mysql-test/t/type_newdecimal.test @@ -1149,4 +1149,52 @@ select cast(a as DECIMAL(3,2)), count(*) UNION select 12.1234 ) t group by 1; +# +# Bug #28361 Buffer overflow in DECIMAL code on Windows +# + +create table t1 (s varchar(100)); +insert into t1 values (0.00000000010000000000000000364321973154977415791655470655996396089904010295867919921875); +drop table t1; + +# +# Bug #27984 Long Decimal Maths produces truncated results +# + +SELECT 1.000000000000 * 99.999999999998 / 100 a,1.000000000000 * (99.999999999998 / 100) b; + +# +# Bug #29415: CAST AS DECIMAL(P,S) with too big precision/scale +# + +SELECT CAST(1 AS decimal(65,10)); +--error ER_TOO_BIG_PRECISION +SELECT CAST(1 AS decimal(66,10)); + +SELECT CAST(1 AS decimal(65,30)); +--error ER_TOO_BIG_SCALE +SELECT CAST(1 AS decimal(65,31)); + +CREATE TABLE t1 (a int DEFAULT NULL, b int DEFAULT NULL); +INSERT INTO t1 VALUES (3,30), (1,10), (2,10); +SELECT a+CAST(1 AS decimal(65,30)) AS aa, SUM(b) FROM t1 GROUP BY aa; +--error ER_TOO_BIG_SCALE +SELECT a+CAST(1 AS decimal(65,31)) AS aa, SUM(b) FROM t1 GROUP BY aa; + +DROP TABLE t1; + +# +# Bug #29417: assertion abort for a grouping query with decimal user variable +# + +CREATE TABLE t1 (a int DEFAULT NULL, b int DEFAULT NULL); +INSERT INTO t1 VALUES (3,30), (1,10), (2,10); + +SET @a= CAST(1 AS decimal); +SELECT 1 FROM t1 GROUP BY @b := @a, @b; + +DROP TABLE t1; + --echo End of 5.0 tests + + diff --git a/mysql-test/t/udf.test b/mysql-test/t/udf.test index 0b582dc61b6..75af1f4be4b 100644 --- a/mysql-test/t/udf.test +++ b/mysql-test/t/udf.test @@ -288,4 +288,28 @@ drop function metaphon; drop function myfunc_double; drop function myfunc_int; +# +# Bug #28921: Queries containing UDF functions are cached +# + +--replace_result $UDF_EXAMPLE_LIB UDF_EXAMPLE_LIB +eval CREATE FUNCTION metaphon RETURNS STRING SONAME "$UDF_EXAMPLE_LIB"; +create table t1 (a char); + +set GLOBAL query_cache_size=1355776; +reset query cache; + +select metaphon('MySQL') from t1; +show status like "Qcache_hits"; +show status like "Qcache_queries_in_cache"; + +select metaphon('MySQL') from t1; +show status like "Qcache_hits"; +show status like "Qcache_queries_in_cache"; + +drop table t1; +drop function metaphon; +set GLOBAL query_cache_size=default; + + --echo End of 5.0 tests. diff --git a/mysql-test/t/user_var-binlog.test b/mysql-test/t/user_var-binlog.test index 12a5e616fa2..57bf9df2fb0 100644 --- a/mysql-test/t/user_var-binlog.test +++ b/mysql-test/t/user_var-binlog.test @@ -1,5 +1,4 @@ -# Embedded server does not support binlogging ---source include/not_embedded.inc +-- source include/have_log_bin.inc # Check that user variables are binlogged correctly (BUG#3875) create table t1 (a varchar(50)); diff --git a/mysql-test/t/user_var.test b/mysql-test/t/user_var.test index 70f57fdf283..3a3e8f88f83 100644 --- a/mysql-test/t/user_var.test +++ b/mysql-test/t/user_var.test @@ -222,3 +222,18 @@ drop table t1,t2; insert into city 'blah'; SHOW COUNT(*) WARNINGS; SHOW COUNT(*) ERRORS; + +# +# Bug#28494: Grouping by Item_func_set_user_var produces incorrect result. +# +create table t1(f1 int, f2 varchar(2), f3 float, f4 decimal(2,1)); +insert into t1 values + (1, "a", 1.5, 1.6), (1, "a", 1.5, 1.6), (2, "b", 2.5, 2.6), + (3, "c", 3.5, 3.6), (4, "d", 4.5, 4.6), (1, "a", 1.5, 1.6), + (3, "c", 3.5, 3.6), (1, "a", 1.5, 1.6); +select @a:=f1, count(f1) from t1 group by 1 desc; +select @a:=f1, count(f1) from t1 group by 1 asc; +select @a:=f2, count(f2) from t1 group by 1 desc; +select @a:=f3, count(f3) from t1 group by 1 desc; +select @a:=f4, count(f4) from t1 group by 1 desc; +drop table t1; diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index 3275ba0a687..c7f722a18a5 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -32,6 +32,7 @@ create view v1 (c,d) as select a,b from t1 # simple view create view v1 (c) as select b+1 from t1; select c from v1; +select is_updatable from information_schema.views where table_name='v1'; # temporary table should not hide table of view create temporary table t1 (a int, b int); @@ -228,6 +229,8 @@ create table t1 (a int, b int, primary key(a)); insert into t1 values (10,2), (20,3), (30,4), (40,5), (50,10); create view v1 (a,c) as select a, b+1 from t1; create algorithm=temptable view v2 (a,c) as select a, b+1 from t1; +select is_updatable from information_schema.views where table_name='v2'; +select is_updatable from information_schema.views where table_name='v1'; # try to update expression -- error 1348 update v1 set c=a+c; @@ -497,6 +500,7 @@ insert into t1 values(5,'Hello, world of views'); create view v1 as select * from t1; create view v2 as select * from v1; update v2 set col2='Hello, view world'; +select is_updatable from information_schema.views; select * from t1; drop view v2, v1; drop table t1; @@ -3233,4 +3237,170 @@ CREATE VIEW v1 AS SELECT CAST(1.23456789 AS DECIMAL(8,0)) AS col; SHOW CREATE VIEW v1; DROP VIEW v1; +# +# Bug #28716: CHECK OPTION expression is evaluated over expired record buffers +# when VIEW is updated via temporary tables +# +CREATE TABLE t1 (a INT); +CREATE TABLE t2 (b INT, c INT DEFAULT 0); +INSERT INTO t1 (a) VALUES (1), (2); +INSERT INTO t2 (b) VALUES (1), (2); +CREATE VIEW v1 AS SELECT t2.b,t2.c FROM t1, t2 + WHERE t1.a=t2.b AND t2.b < 3 WITH CHECK OPTION; +SELECT * FROM v1; +UPDATE v1 SET c=1 WHERE b=1; +SELECT * FROM v1; +DROP VIEW v1; +DROP TABLE t1,t2; + +# +# Bug #28561: update on multi-table view with CHECK OPTION and +# a subquery in WHERE condition +# + +CREATE TABLE t1 (id int); +CREATE TABLE t2 (id int, c int DEFAULT 0); +INSERT INTO t1 (id) VALUES (1); +INSERT INTO t2 (id) VALUES (1); + +CREATE VIEW v1 AS + SELECT t2.c FROM t1, t2 + WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION; + +UPDATE v1 SET c=1; + +DROP VIEW v1; +DROP TABLE t1,t2; + +# +# Bug #27827: CHECK OPTION ignores ON conditions when updating +# a multi-table view with CHECK OPTION. +# + +CREATE TABLE t1 (a1 INT, c INT DEFAULT 0); +CREATE TABLE t2 (a2 INT); +CREATE TABLE t3 (a3 INT); +CREATE TABLE t4 (a4 INT); +INSERT INTO t1 (a1) VALUES (1),(2); +INSERT INTO t2 (a2) VALUES (1),(2); +INSERT INTO t3 (a3) VALUES (1),(2); +INSERT INTO t4 (a4) VALUES (1),(2); + +CREATE VIEW v1 AS + SELECT t1.a1, t1.c FROM t1 JOIN t2 ON t1.a1=t2.a2 AND t1.c < 3 + WITH CHECK OPTION; +SELECT * FROM v1; +--error 1369 +UPDATE v1 SET c=3; +PREPARE t FROM 'UPDATE v1 SET c=3'; +--error 1369 +EXECUTE t; +--error 1369 +EXECUTE t; +--error 1369 +INSERT INTO v1(a1, c) VALUES (3, 3); +UPDATE v1 SET c=1 WHERE a1=1; +SELECT * FROM v1; +SELECT * FROM t1; + +CREATE VIEW v2 AS SELECT t1.a1, t1.c + FROM (t1 JOIN t2 ON t1.a1=t2.a2 AND t1.c < 3) + JOIN (t3 JOIN t4 ON t3.a3=t4.a4) + ON t2.a2=t3.a3 WITH CHECK OPTION; +SELECT * FROM v2; +--error 1369 +UPDATE v2 SET c=3; +PREPARE t FROM 'UPDATE v2 SET c=3'; +--error 1369 +EXECUTE t; +--error 1369 +EXECUTE t; +--error 1369 +INSERT INTO v2(a1, c) VALUES (3, 3); +UPDATE v2 SET c=2 WHERE a1=1; +SELECT * FROM v2; +SELECT * FROM t1; + +DROP VIEW v1,v2; +DROP TABLE t1,t2,t3,t4; + +# +# Bug #29104: assertion abort for a query with a view column reference +# in the GROUP BY list and a condition requiring the value +# of another view column to be equal to a constant +# + +CREATE TABLE t1 (a int, b int); +INSERT INTO t1 VALUES (1,2), (2,2), (1,3), (1,2); + +CREATE VIEW v1 AS SELECT a, b+1 as b FROM t1; + + +SELECT b, SUM(a) FROM v1 WHERE b=3 GROUP BY b; +EXPLAIN SELECT b, SUM(a) FROM v1 WHERE b=3 GROUP BY b; + +SELECT a, SUM(b) FROM v1 WHERE b=3 GROUP BY a; +EXPLAIN SELECT a, SUM(b) FROM v1 WHERE b=3 GROUP BY a; + +SELECT a, SUM(b) FROM v1 WHERE a=1 GROUP BY a; +EXPLAIN SELECT a, SUM(b) FROM v1 WHERE a=1 GROUP BY a; + +DROP VIEW v1; +DROP TABLE t1; + +# +# Bug #29392: SELECT over a multi-table view with ORDER BY +# selecting the same view column with two different aliases +# + +CREATE TABLE t1 ( + person_id int NOT NULL PRIMARY KEY, + username varchar(40) default NULL, + status_flg char(1) NOT NULL default 'A' +); + +CREATE TABLE t2 ( + person_role_id int NOT NULL auto_increment PRIMARY KEY, + role_id int NOT NULL, + person_id int NOT NULL, + INDEX idx_person_id (person_id), + INDEX idx_role_id (role_id) +); + +CREATE TABLE t3 ( + role_id int NOT NULL auto_increment PRIMARY KEY, + role_name varchar(100) default NULL, + app_name varchar(40) NOT NULL, + INDEX idx_app_name(app_name) +); + +CREATE VIEW v1 AS +SELECT profile.person_id AS person_id + FROM t1 profile, t2 userrole, t3 role + WHERE userrole.person_id = profile.person_id AND + role.role_id = userrole.role_id AND + profile.status_flg = 'A' + ORDER BY profile.person_id,role.app_name,role.role_name; + +INSERT INTO t1 VALUES + (6,'Sw','A'), (-1136332546,'ols','e'), (0,' *\n','0'), + (-717462680,'ENTS Ta','0'), (-904346964,'ndard SQL\n','0'); + +INSERT INTO t2 VALUES + (1,3,6),(2,4,7),(3,5,8),(4,6,9),(5,1,6),(6,1,7),(7,1,8),(8,1,9),(9,1,10); + +INSERT INTO t3 VALUES + (1,'NUCANS_APP_USER','NUCANSAPP'),(2,'NUCANS_TRGAPP_USER','NUCANSAPP'), + (3,'IA_INTAKE_COORDINATOR','IACANS'),(4,'IA_SCREENER','IACANS'), + (5,'IA_SUPERVISOR','IACANS'),(6,'IA_READONLY','IACANS'), + (7,'SOC_USER','SOCCANS'),(8,'CAYIT_USER','CAYITCANS'), + (9,'RTOS_DCFSPOS_SUPERVISOR','RTOS'); + +EXPLAIN SELECT t.person_id AS a, t.person_id AS b FROM v1 t WHERE t.person_id=6; +SELECT t.person_id AS a, t.person_id AS b FROM v1 t WHERE t.person_id=6; + +DROP VIEW v1; +DROP TABLE t1,t2,t3; + --echo End of 5.0 tests. + diff --git a/mysql-test/t/windows_shm-master.opt b/mysql-test/t/windows_shm-master.opt new file mode 100644 index 00000000000..4476ea16360 --- /dev/null +++ b/mysql-test/t/windows_shm-master.opt @@ -0,0 +1 @@ +--skip-grant-tables --loose-shared-memory-base-name=HeyMrBaseNameXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX --loose-shared-memory=1 diff --git a/mysql-test/t/windows_shm.test b/mysql-test/t/windows_shm.test new file mode 100644 index 00000000000..1c6f05f2da0 --- /dev/null +++ b/mysql-test/t/windows_shm.test @@ -0,0 +1,9 @@ +# Windows-specific tests +--source include/windows.inc + +# +# Bug #24924: shared-memory-base-name that is too long causes buffer overflow +# +--exec $MYSQLADMIN --no-defaults --user=root --host=127.0.0.1 --port=$MASTER_MYPORT --shared-memory-base-name=HeyMrBaseNameXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ping + +--echo End of 5.0 tests. diff --git a/mysys/charset-def.c b/mysys/charset-def.c index 394fe6de1f3..36ff4139d9c 100644 --- a/mysys/charset-def.c +++ b/mysys/charset-def.c @@ -24,7 +24,6 @@ #ifdef HAVE_UCA_COLLATIONS #ifdef HAVE_CHARSET_ucs2 -extern CHARSET_INFO my_charset_ucs2_general_uca; extern CHARSET_INFO my_charset_ucs2_icelandic_uca_ci; extern CHARSET_INFO my_charset_ucs2_latvian_uca_ci; extern CHARSET_INFO my_charset_ucs2_romanian_uca_ci; @@ -46,7 +45,6 @@ extern CHARSET_INFO my_charset_ucs2_hungarian_uca_ci; #endif #ifdef HAVE_CHARSET_utf8 -extern CHARSET_INFO my_charset_utf8_general_uca_ci; extern CHARSET_INFO my_charset_utf8_icelandic_uca_ci; extern CHARSET_INFO my_charset_utf8_latvian_uca_ci; extern CHARSET_INFO my_charset_utf8_romanian_uca_ci; @@ -134,7 +132,7 @@ my_bool init_compiled_charsets(myf flags __attribute__((unused))) add_compiled_collation(&my_charset_ucs2_general_ci); add_compiled_collation(&my_charset_ucs2_bin); #ifdef HAVE_UCA_COLLATIONS - add_compiled_collation(&my_charset_ucs2_general_uca); + add_compiled_collation(&my_charset_ucs2_unicode_ci); add_compiled_collation(&my_charset_ucs2_icelandic_uca_ci); add_compiled_collation(&my_charset_ucs2_latvian_uca_ci); add_compiled_collation(&my_charset_ucs2_romanian_uca_ci); @@ -168,7 +166,7 @@ my_bool init_compiled_charsets(myf flags __attribute__((unused))) add_compiled_collation(&my_charset_utf8_general_cs); #endif #ifdef HAVE_UCA_COLLATIONS - add_compiled_collation(&my_charset_utf8_general_uca_ci); + add_compiled_collation(&my_charset_utf8_unicode_ci); add_compiled_collation(&my_charset_utf8_icelandic_uca_ci); add_compiled_collation(&my_charset_utf8_latvian_uca_ci); add_compiled_collation(&my_charset_utf8_romanian_uca_ci); diff --git a/mysys/charset.c b/mysys/charset.c index cce97677b14..9ea17c6515c 100644 --- a/mysys/charset.c +++ b/mysys/charset.c @@ -202,6 +202,19 @@ static my_bool simple_cs_is_full(CHARSET_INFO *cs) } +static void +copy_uca_collation(CHARSET_INFO *to, CHARSET_INFO *from) +{ + to->cset= from->cset; + to->coll= from->coll; + to->strxfrm_multiply= from->strxfrm_multiply; + to->min_sort_char= from->min_sort_char; + to->max_sort_char= from->max_sort_char; + to->mbminlen= from->mbminlen; + to->mbmaxlen= from->mbmaxlen; +} + + static int add_collation(CHARSET_INFO *cs) { if (cs->name && (cs->number || @@ -225,29 +238,30 @@ static int add_collation(CHARSET_INFO *cs) if (!(all_charsets[cs->number]->state & MY_CS_COMPILED)) { - CHARSET_INFO *new= all_charsets[cs->number]; + CHARSET_INFO *newcs= all_charsets[cs->number]; if (cs_copy_data(all_charsets[cs->number],cs)) return MY_XML_ERROR; if (!strcmp(cs->csname,"ucs2") ) { #if defined(HAVE_CHARSET_ucs2) && defined(HAVE_UCA_COLLATIONS) - new->cset= my_charset_ucs2_general_uca.cset; - new->coll= my_charset_ucs2_general_uca.coll; - new->strxfrm_multiply= my_charset_ucs2_general_uca.strxfrm_multiply; - new->min_sort_char= my_charset_ucs2_general_uca.min_sort_char; - new->max_sort_char= my_charset_ucs2_general_uca.max_sort_char; - new->mbminlen= 2; - new->mbmaxlen= 2; - new->state |= MY_CS_AVAILABLE | MY_CS_LOADED; + copy_uca_collation(newcs, &my_charset_ucs2_unicode_ci); + newcs->state|= MY_CS_AVAILABLE | MY_CS_LOADED; #endif + } + else if (!strcmp(cs->csname, "utf8")) + { +#if defined (HAVE_CHARSET_utf8) && defined(HAVE_UCA_COLLATIONS) + copy_uca_collation(newcs, &my_charset_utf8_unicode_ci); + newcs->state|= MY_CS_AVAILABLE | MY_CS_LOADED; +#endif } else { uchar *sort_order= all_charsets[cs->number]->sort_order; simple_cs_init_functions(all_charsets[cs->number]); - new->mbminlen= 1; - new->mbmaxlen= 1; + newcs->mbminlen= 1; + newcs->mbmaxlen= 1; if (simple_cs_is_full(all_charsets[cs->number])) { all_charsets[cs->number]->state |= MY_CS_LOADED; diff --git a/mysys/hash.c b/mysys/hash.c index 0c949b3a0d8..9e8404248eb 100644 --- a/mysys/hash.c +++ b/mysys/hash.c @@ -570,6 +570,25 @@ my_bool hash_update(HASH *hash,byte *record,byte *old_key,uint old_key_length) previous->next=pos->next; /* unlink pos */ /* Move data to correct position */ + if (new_index == empty) + { + /* + At this point record is unlinked from the old chain, thus it holds + random position. By the chance this position is equal to position + for the first element in the new chain. That means updated record + is the only record in the new chain. + */ + if (empty != idx) + { + /* + Record was moved while unlinking it from the old chain. + Copy data to a new position. + */ + data[empty]= org_link; + } + data[empty].next= NO_RECORD; + DBUG_RETURN(0); + } pos=data+new_index; new_pos_index=hash_rec_mask(hash,pos,blength,records); if (new_index != new_pos_index) diff --git a/mysys/mf_keycache.c b/mysys/mf_keycache.c index 87f136dbf81..af910678a1f 100644 --- a/mysys/mf_keycache.c +++ b/mysys/mf_keycache.c @@ -173,7 +173,7 @@ static void test_key_cache(KEY_CACHE *keycache, #endif #define KEYCACHE_HASH(f, pos) \ -(((ulong) ((pos) >> keycache->key_cache_shift)+ \ +(((ulong) ((pos) / keycache->key_cache_block_size) + \ (ulong) (f)) & (keycache->hash_entries-1)) #define FILE_HASH(f) ((uint) (f) & (CHANGED_BLOCKS_HASH-1)) @@ -329,7 +329,6 @@ int init_key_cache(KEY_CACHE *keycache, uint key_cache_block_size, keycache->key_cache_mem_size= use_mem; keycache->key_cache_block_size= key_cache_block_size; - keycache->key_cache_shift= my_bit_log2(key_cache_block_size); DBUG_PRINT("info", ("key_cache_block_size: %u", key_cache_block_size)); @@ -352,7 +351,7 @@ int init_key_cache(KEY_CACHE *keycache, uint key_cache_block_size, ALIGN_SIZE(hash_links * sizeof(HASH_LINK)) + ALIGN_SIZE(sizeof(HASH_LINK*) * keycache->hash_entries))) + - ((ulong) blocks << keycache->key_cache_shift) > use_mem) + ((ulong) blocks * keycache->key_cache_block_size) > use_mem) blocks--; /* Allocate memory for cache page buffers */ if ((keycache->block_mem= @@ -1807,7 +1806,7 @@ byte *key_cache_read(KEY_CACHE *keycache, uint status; int page_st; - offset= (uint) (filepos & (keycache->key_cache_block_size-1)); + offset= (uint) (filepos % keycache->key_cache_block_size); /* Read data in key_cache_block_size increments */ do { @@ -1946,7 +1945,7 @@ int key_cache_insert(KEY_CACHE *keycache, int error; uint offset; - offset= (uint) (filepos & (keycache->key_cache_block_size-1)); + offset= (uint) (filepos % keycache->key_cache_block_size); do { keycache_pthread_mutex_lock(&keycache->cache_lock); @@ -2081,7 +2080,7 @@ int key_cache_write(KEY_CACHE *keycache, int page_st; uint offset; - offset= (uint) (filepos & (keycache->key_cache_block_size-1)); + offset= (uint) (filepos % keycache->key_cache_block_size); do { keycache_pthread_mutex_lock(&keycache->cache_lock); diff --git a/mysys/my_init.c b/mysys/my_init.c index 2bcf5f44c4d..32d3f07fd31 100644 --- a/mysys/my_init.c +++ b/mysys/my_init.c @@ -262,6 +262,34 @@ void my_parameter_handler(const wchar_t * expression, const wchar_t * function, } +#ifdef __MSVC_RUNTIME_CHECKS +#include + +/* Turn off runtime checks for 'handle_rtc_failure' */ +#pragma runtime_checks("", off) + +/* + handle_rtc_failure + Catch the RTC error and dump it to stderr +*/ + +int handle_rtc_failure(int err_type, const char *file, int line, + const char* module, const char *format, ...) +{ + va_list args; + va_start(args, format); + fprintf(stderr, "Error:"); + vfprintf(stderr, format, args); + fprintf(stderr, " At %s:%d\n", file, line); + va_end(args); + (void) fflush(stderr); + + return 0; /* Error is handled */ +} +#pragma runtime_checks("", on) +#endif + + static void my_win_init(void) { HKEY hSoftMysql ; @@ -292,6 +320,14 @@ static void my_win_init(void) _set_invalid_parameter_handler(my_parameter_handler); #endif #endif +#ifdef __MSVC_RUNTIME_CHECKS + /* + Install handler to send RTC (Runtime Error Check) warnings + to log file + */ + _RTC_SetErrorFunc(handle_rtc_failure); +#endif + _tzset(); /* apre la chiave HKEY_LOCAL_MACHINES\software\MySQL */ diff --git a/mysys/my_seek.c b/mysys/my_seek.c index 3d415400aa2..5c1a6c44b6f 100644 --- a/mysys/my_seek.c +++ b/mysys/my_seek.c @@ -88,6 +88,7 @@ my_off_t my_tell(File fd, myf MyFlags __attribute__((unused))) os_off_t pos; DBUG_ENTER("my_tell"); DBUG_PRINT("my",("Fd: %d MyFlags: %d",fd, MyFlags)); + DBUG_ASSERT(fd >= 0); #ifdef HAVE_TELL pos=tell(fd); #else diff --git a/mysys/my_thr_init.c b/mysys/my_thr_init.c index 07a92e34dd3..cf7ea0a800f 100644 --- a/mysys/my_thr_init.c +++ b/mysys/my_thr_init.c @@ -87,27 +87,31 @@ my_bool my_thread_global_init(void) fprintf(stderr,"Can't initialize threads: error %d\n", pth_ret); return 1; } - + #ifdef NPTL_PTHREAD_EXIT_BUG + /* + BUG#24507: Race conditions inside current NPTL pthread_exit() + implementation. -/* - BUG#24507: Race conditions inside current NPTL pthread_exit() implementation. + To avoid a possible segmentation fault during concurrent + executions of pthread_exit(), a dummy thread is spawned which + initializes internal variables of pthread lib. See bug description + for a full explanation. - To avoid a possible segmentation fault during concurrent executions of - pthread_exit(), a dummy thread is spawned which initializes internal variables - of pthread lib. See bug description for thoroughfull explanation. - - TODO: Remove this code when fixed versions of glibc6 are in common use. -*/ + TODO: Remove this code when fixed versions of glibc6 are in common + use. + */ + if (thd_lib_detected == THD_LIB_NPTL) + { + pthread_t dummy_thread; + pthread_attr_t dummy_thread_attr; - pthread_t dummy_thread; - pthread_attr_t dummy_thread_attr; - - pthread_attr_init(&dummy_thread_attr); - pthread_attr_setdetachstate(&dummy_thread_attr,PTHREAD_CREATE_DETACHED); - - pthread_create(&dummy_thread,&dummy_thread_attr,nptl_pthread_exit_hack_handler,NULL); + pthread_attr_init(&dummy_thread_attr); + pthread_attr_setdetachstate(&dummy_thread_attr, PTHREAD_CREATE_DETACHED); + pthread_create(&dummy_thread,&dummy_thread_attr, + nptl_pthread_exit_hack_handler, NULL); + } #endif #ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP diff --git a/scripts/make_binary_distribution.sh b/scripts/make_binary_distribution.sh index e8bf39bd016..77f51c51c19 100644 --- a/scripts/make_binary_distribution.sh +++ b/scripts/make_binary_distribution.sh @@ -102,11 +102,41 @@ case $system in ;; esac +# This is needed to prefer GNU tar over platform tar because that can't +# always handle long filenames + +PATH_DIRS=`echo $PATH | \ + sed -e 's/^:/. /' -e 's/:$/ ./' -e 's/::/ . /g' -e 's/:/ /g' ` + +which_1 () +{ + for cmd + do + for d in $PATH_DIRS + do + for file in $d/$cmd + do + if [ -x $file -a ! -d $file ] ; then + echo $file + exit 0 + fi + done + done + done + exit 1 +} + +tar=`which_1 gnutar gtar` +if [ "$?" = "1" -o x"$tar" = x"" ] ; then + tar=tar +fi + mkdir $BASE $BASE/bin $BASE/docs \ $BASE/include $BASE/lib $BASE/support-files $BASE/share $BASE/scripts \ $BASE/mysql-test $BASE/mysql-test/t $BASE/mysql-test/r \ - $BASE/mysql-test/include $BASE/mysql-test/std_data $BASE/mysql-test/lib + $BASE/mysql-test/include $BASE/mysql-test/std_data $BASE/mysql-test/lib \ + $BASE/mysql-test/suite if [ $BASE_SYSTEM != "netware" ] ; then mkdir $BASE/share/mysql $BASE/tests $BASE/sql-bench $BASE/man \ @@ -117,8 +147,8 @@ fi # Copy files if they exists, warn for those that don't. # Note that when listing files to copy, we might list the file name -# twice, once in the directory location where it is build, and a -# second time in the ".libs" location. In the case the firs one +# twice, once in the directory location where it is built, and a +# second time in the ".libs" location. In the case the first one # is a wrapper script, the second one will overwrite it with the # binary file. copyfileto() @@ -274,6 +304,13 @@ $CP mysql-test/t/*.test mysql-test/t/*.imtest \ $CP mysql-test/r/*.result mysql-test/r/*.require \ $BASE/mysql-test/r +# Copy the additional suites "as is", they are in flux +$tar cf - mysql-test/suite | ( cd $BASE ; $tar xf - ) +# Clean up if we did this from a bk tree +if [ -d mysql-test/SCCS ] ; then + find $BASE/mysql-test -name SCCS -print | xargs rm -rf +fi + if [ $BASE_SYSTEM != "netware" ] ; then chmod a+x $BASE/bin/* copyfileto $BASE/bin scripts/* @@ -374,41 +411,12 @@ if [ x$DEBUG = x1 ] ; then exit fi -# This is needed to prefere gnu tar instead of tar because tar can't -# always handle long filenames - -PATH_DIRS=`echo $PATH | \ - sed -e 's/^:/. /' -e 's/:$/ ./' -e 's/::/ . /g' -e 's/:/ /g' ` - -which_1 () -{ - for cmd - do - for d in $PATH_DIRS - do - for file in $d/$cmd - do - if [ -x $file -a ! -d $file ] ; then - echo $file - exit 0 - fi - done - done - done - exit 1 -} - if [ $BASE_SYSTEM != "netware" ] ; then # # Create the result tar file # - tar=`which_1 gnutar gtar` - if [ "$?" = "1" -o x"$tar" = x"" ] ; then - tar=tar - fi - echo "Using $tar to create archive" OPT=cvf diff --git a/scripts/make_win_bin_dist b/scripts/make_win_bin_dist index 30127b0043f..beb274ca1a3 100755 --- a/scripts/make_win_bin_dist +++ b/scripts/make_win_bin_dist @@ -239,25 +239,45 @@ if [ x"$PACK_EMBEDDED" = x"" -a \ fi # ---------------------------------------------------------------------- -# FIXME why not copy it all in "include"?! +# Note: Make sure to sync with include/Makefile.am and WiX installer +# XML specifications # ---------------------------------------------------------------------- mkdir -p $DESTDIR/include -cp include/conf*.h \ - include/mysql*.h \ - include/errmsg.h \ - include/my_alloc.h \ - include/my_getopt.h \ - include/my_sys.h \ +cp include/mysql.h \ + include/mysql_com.h \ + include/mysql_time.h \ include/my_list.h \ - include/my_pthread.h \ + include/my_alloc.h \ + include/typelib.h \ include/my_dbug.h \ include/m_string.h \ - include/m_ctype.h \ - include/my_global.h \ + include/my_sys.h \ + include/my_xml.h \ + include/mysql_embed.h \ + include/my_pthread.h \ + include/my_no_pthread.h \ include/raid.h \ - include/typelib.h $DESTDIR/include/ -cp libmysql/libmysql.def $DESTDIR/include/ + include/decimal.h \ + include/errmsg.h \ + include/my_global.h \ + include/my_net.h \ + include/my_getopt.h \ + include/sslopt-longopts.h \ + include/my_dir.h \ + include/sslopt-vars.h \ + include/sslopt-case.h \ + include/sql_common.h \ + include/keycache.h \ + include/m_ctype.h \ + include/my_attribute.h \ + include/mysqld_error.h \ + include/sql_state.h \ + include/mysqld_ername.h \ + include/mysql_version.h \ + include/config-win.h \ + libmysql/libmysql.def \ + $DESTDIR/include/ # ---------------------------------------------------------------------- # Client libraries, and other libraries diff --git a/server-tools/instance-manager/mysql_connection.cc b/server-tools/instance-manager/mysql_connection.cc index 3e1694e24ee..2b377d60ad0 100644 --- a/server-tools/instance-manager/mysql_connection.cc +++ b/server-tools/instance-manager/mysql_connection.cc @@ -112,8 +112,8 @@ C_MODE_START void my_net_local_init(NET *net) { net->max_packet= net_buffer_length; - net->read_timeout= net_read_timeout; - net->write_timeout= net_write_timeout; + my_net_set_read_timeout(net, (uint)net_read_timeout); + my_net_set_write_timeout(net, (uint)net_write_timeout); net->retry_count= net_retry_count; net->max_packet_size= max_allowed_packet; } diff --git a/sql-common/client.c b/sql-common/client.c index 3342db4bcfe..a5dbeb66658 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -402,13 +402,19 @@ HANDLE create_shared_memory(MYSQL *mysql,NET *net, uint connect_timeout) HANDLE handle_file_map = NULL; ulong connect_number; char connect_number_char[22], *p; - char tmp[64]; + char *tmp= NULL; char *suffix_pos; DWORD error_allow = 0; DWORD error_code = 0; DWORD event_access_rights= SYNCHRONIZE | EVENT_MODIFY_STATE; char *shared_memory_base_name = mysql->options.shared_memory_base_name; + /* + get enough space base-name + '_' + longest suffix we might ever send + */ + if (!(tmp= (char *)my_malloc(strlen(shared_memory_base_name) + 32L, MYF(MY_FAE)))) + goto err; + /* The name of event and file-mapping events create agree next rule: shared_memory_base_name+unique_part @@ -416,7 +422,7 @@ HANDLE create_shared_memory(MYSQL *mysql,NET *net, uint connect_timeout) shared_memory_base_name is unique value for each server unique_part is uniquel value for each object (events and file-mapping) */ - suffix_pos = strxmov(tmp,shared_memory_base_name,"_",NullS); + suffix_pos = strxmov(tmp, "Global\\", shared_memory_base_name, "_", NullS); strmov(suffix_pos, "CONNECT_REQUEST"); if (!(event_connect_request= OpenEvent(event_access_rights, FALSE, tmp))) { @@ -470,8 +476,8 @@ HANDLE create_shared_memory(MYSQL *mysql,NET *net, uint connect_timeout) unique_part is uniquel value for each object (events and file-mapping) number_of_connection is number of connection between server and client */ - suffix_pos = strxmov(tmp,shared_memory_base_name,"_",connect_number_char, - "_",NullS); + suffix_pos = strxmov(tmp, "Global\\", shared_memory_base_name, "_", connect_number_char, + "_", NullS); strmov(suffix_pos, "DATA"); if ((handle_file_map = OpenFileMapping(FILE_MAP_WRITE,FALSE,tmp)) == NULL) { @@ -551,6 +557,8 @@ err2: CloseHandle(handle_file_map); } err: + if (tmp) + my_free(tmp, MYF(0)); if (error_allow) error_code = GetLastError(); if (event_connect_request) @@ -2047,13 +2055,11 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, /* If user set read_timeout, let it override the default */ if (mysql->options.read_timeout) - net->read_timeout= mysql->options.read_timeout; - vio_timeout(net->vio, 0, net->read_timeout); + my_net_set_read_timeout(net, mysql->options.read_timeout); /* If user set write_timeout, let it override the default */ if (mysql->options.write_timeout) - net->write_timeout= mysql->options.write_timeout; - vio_timeout(net->vio, 1, net->write_timeout); + my_net_set_write_timeout(net, mysql->options.write_timeout); if (mysql->options.max_allowed_packet) net->max_packet_size= mysql->options.max_allowed_packet; @@ -2453,6 +2459,7 @@ my_bool mysql_reconnect(MYSQL *mysql) } mysql_init(&tmp_mysql); tmp_mysql.options= mysql->options; + tmp_mysql.options.my_cnf_file= tmp_mysql.options.my_cnf_group= 0; tmp_mysql.rpl_pivot= mysql->rpl_pivot; if (!mysql_real_connect(&tmp_mysql,mysql->host,mysql->user,mysql->passwd, diff --git a/sql/Makefile.am b/sql/Makefile.am index 9be3bf93746..52a4c96f451 100644 --- a/sql/Makefile.am +++ b/sql/Makefile.am @@ -43,7 +43,7 @@ mysqld_LDADD = @MYSQLD_EXTRA_LDFLAGS@ \ @innodb_system_libs@ \ @ndbcluster_libs@ @ndbcluster_system_libs@ \ $(LDADD) $(CXXLDFLAGS) $(WRAPLIBS) @LIBDL@ \ - $(yassl_libs) $(openssl_libs) + $(yassl_libs) $(openssl_libs) @MYSQLD_EXTRA_LIBS@ noinst_HEADERS = item.h item_func.h item_sum.h item_cmpfunc.h \ item_strfunc.h item_timefunc.h item_uniq.h \ diff --git a/sql/examples/ha_tina.cc b/sql/examples/ha_tina.cc index 00f927aa7b7..2c5226222e2 100644 --- a/sql/examples/ha_tina.cc +++ b/sql/examples/ha_tina.cc @@ -301,7 +301,7 @@ ha_tina::ha_tina(TABLE *table_arg) chain_size(DEFAULT_CHAIN_LENGTH), records_is_known(0) { /* Set our original buffers from pre-allocated memory */ - buffer.set(byte_buffer, IO_SIZE, system_charset_info); + buffer.set(byte_buffer, IO_SIZE, &my_charset_bin); chain= chain_buffer; } @@ -447,7 +447,7 @@ int ha_tina::find_current_row(byte *buf) else buffer.append(*mapped_ptr); } - (*field)->store(buffer.ptr(), buffer.length(), system_charset_info); + (*field)->store(buffer.ptr(), buffer.length(), buffer.charset()); } next_position= (end_ptr - share->mapped_file)+1; /* Maybe use \N for null? */ diff --git a/sql/field.cc b/sql/field.cc index 8186659ae89..2e227f0e67e 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -2267,6 +2267,7 @@ Field_new_decimal::Field_new_decimal(char *ptr_arg, dec_arg, zero_arg, unsigned_arg) { precision= my_decimal_length_to_precision(len_arg, dec_arg, unsigned_arg); + set_if_smaller(precision, DECIMAL_MAX_PRECISION); DBUG_ASSERT((precision <= DECIMAL_MAX_PRECISION) && (dec <= DECIMAL_MAX_SCALE)); bin_size= my_decimal_get_binary_size(precision, dec); @@ -2286,6 +2287,7 @@ Field_new_decimal::Field_new_decimal(uint32 len_arg, 0, unsigned_arg) { precision= my_decimal_length_to_precision(len_arg, dec_arg, unsigned_arg); + set_if_smaller(precision, DECIMAL_MAX_PRECISION); DBUG_ASSERT((precision <= DECIMAL_MAX_PRECISION) && (dec <= DECIMAL_MAX_SCALE)); bin_size= my_decimal_get_binary_size(precision, dec); @@ -3675,56 +3677,9 @@ int Field_float::store(const char *from,uint len,CHARSET_INFO *cs) int Field_float::store(double nr) { - float j; - int error= 0; + int error= truncate(&nr, FLT_MAX); + float j= (float)nr; - if (isnan(nr)) - { - j= 0; - set_null(); - set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1); - error= 1; - } - else if (unsigned_flag && nr < 0) - { - j= 0; - set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1); - error= 1; - } - else - { - double max_value; - if (dec >= NOT_FIXED_DEC) - { - max_value= FLT_MAX; - } - else - { - uint tmp=min(field_length,array_elements(log_10)-1); - max_value= (log_10[tmp]-1)/log_10[dec]; - /* - The following comparison is needed to not get an overflow if nr - is close to FLT_MAX - */ - if (fabs(nr) < FLT_MAX/10.0e+32) - nr= floor(nr*log_10[dec]+0.5)/log_10[dec]; - } - if (nr < -max_value) - { - j= (float)-max_value; - set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1); - error= 1; - } - else if (nr > max_value) - { - j= (float)max_value; - set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1); - error= 1; - } - else - j= (float) nr; - } - #ifdef WORDS_BIGENDIAN if (table->s->db_low_byte_first) { @@ -3963,48 +3918,7 @@ int Field_double::store(const char *from,uint len,CHARSET_INFO *cs) int Field_double::store(double nr) { - int error= 0; - - if (isnan(nr)) - { - nr= 0; - set_null(); - set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1); - error= 1; - } - else if (unsigned_flag && nr < 0) - { - nr= 0; - set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1); - error= 1; - } - else - { - double max_value; - if (not_fixed) - { - max_value= DBL_MAX; - } - else - { - uint tmp=min(field_length,array_elements(log_10)-1); - max_value= (log_10[tmp]-1)/log_10[dec]; - if (fabs(nr) < DBL_MAX/10.0e+32) - nr= floor(nr*log_10[dec]+0.5)/log_10[dec]; - } - if (nr < -max_value) - { - nr= -max_value; - set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1); - error= 1; - } - else if (nr > max_value) - { - nr= max_value; - set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1); - error= 1; - } - } + int error= truncate(&nr, DBL_MAX); #ifdef WORDS_BIGENDIAN if (table->s->db_low_byte_first) @@ -4023,6 +3937,63 @@ int Field_double::store(longlong nr, bool unsigned_val) return store(unsigned_val ? ulonglong2double((ulonglong) nr) : (double) nr); } +/* + If a field has fixed length, truncate the double argument pointed to by 'nr' + appropriately. + Also ensure that the argument is within [-max_value; max_value] range. +*/ + +int Field_real::truncate(double *nr, double max_value) +{ + int error= 1; + double res= *nr; + + if (isnan(res)) + { + res= 0; + set_null(); + set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1); + goto end; + } + else if (unsigned_flag && res < 0) + { + res= 0; + set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1); + goto end; + } + + if (!not_fixed) + { + uint order= field_length - dec; + uint step= array_elements(log_10) - 1; + max_value= 1.0; + for (; order > step; order-= step) + max_value*= log_10[step]; + max_value*= log_10[order]; + max_value-= 1.0 / log_10[dec]; + + double tmp= rint((res - floor(res)) * log_10[dec]) / log_10[dec]; + res= floor(res) + tmp; + } + + if (res < -max_value) + { + res= -max_value; + set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1); + } + else if (res > max_value) + { + res= max_value; + set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1); + } + else + error= 0; + +end: + *nr= res; + return error; +} + int Field_real::store_decimal(const my_decimal *dm) { @@ -4285,7 +4256,7 @@ Field_timestamp::Field_timestamp(char *ptr_arg, uint32 len_arg, const char *field_name_arg, struct st_table *table_arg, CHARSET_INFO *cs) - :Field_str(ptr_arg, 19, null_ptr_arg, null_bit_arg, + :Field_str(ptr_arg, MAX_DATETIME_WIDTH, null_ptr_arg, null_bit_arg, unireg_check_arg, field_name_arg, table_arg, cs) { /* For 4.0 MYD and 4.0 InnoDB compatibility */ @@ -4303,7 +4274,8 @@ Field_timestamp::Field_timestamp(char *ptr_arg, uint32 len_arg, Field_timestamp::Field_timestamp(bool maybe_null_arg, const char *field_name_arg, struct st_table *table_arg, CHARSET_INFO *cs) - :Field_str((char*) 0, 19, maybe_null_arg ? (uchar*) "": 0, 0, + :Field_str((char*) 0, MAX_DATETIME_WIDTH, + maybe_null_arg ? (uchar*) "": 0, 0, NONE, field_name_arg, table_arg, cs) { /* For 4.0 MYD and 4.0 InnoDB compatibility */ @@ -4834,7 +4806,7 @@ String *Field_time::val_str(String *val_buffer, String *val_ptr __attribute__((unused))) { MYSQL_TIME ltime; - val_buffer->alloc(19); + val_buffer->alloc(MAX_DATE_STRING_REP_LENGTH); long tmp=(long) sint3korr(ptr); ltime.neg= 0; if (tmp < 0) @@ -5370,7 +5342,7 @@ int Field_newdate::store_time(MYSQL_TIME *ltime, timestamp_type time_type) (MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE | MODE_INVALID_DATES))), &error)) { - char buff[12]; + char buff[MAX_DATE_STRING_REP_LENGTH]; String str(buff, sizeof(buff), &my_charset_latin1); make_date((DATE_TIME_FORMAT *) 0, ltime, &str); set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, @@ -5595,7 +5567,7 @@ int Field_datetime::store_time(MYSQL_TIME *ltime,timestamp_type time_type) (MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE | MODE_INVALID_DATES))), &error)) { - char buff[19]; + 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_WARN, WARN_DATA_TRUNCATED, @@ -5669,7 +5641,7 @@ String *Field_datetime::val_str(String *val_buffer, part1=(long) (tmp/LL(1000000)); part2=(long) (tmp - (ulonglong) part1*LL(1000000)); - pos=(char*) val_buffer->ptr()+19; + pos= (char*) val_buffer->ptr() + MAX_DATETIME_WIDTH; *pos--=0; *pos--= (char) ('0'+(char) (part2%10)); part2/=10; *pos--= (char) ('0'+(char) (part2%10)); part3= (int) (part2 / 10); @@ -6249,7 +6221,8 @@ uint Field_string::get_key_image(char *buff, uint length, imagetype type_arg) length / field_charset->mbmaxlen); memcpy(buff, ptr, bytes); if (bytes < length) - bzero(buff + bytes, length - bytes); + field_charset->cset->fill(field_charset, buff + bytes, length - bytes, + field_charset->pad_char); return bytes; } @@ -7643,6 +7616,8 @@ int Field_enum::store(const char *from,uint length,CHARSET_INFO *cs) tmp=0; set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, 1); } + if (!table->in_use->count_cuted_fields) + err= 0; } else set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, 1); @@ -8565,15 +8540,18 @@ bool create_field::init(THD *thd, char *fld_name, enum_field_types fld_type, break; case FIELD_TYPE_TIMESTAMP: if (!fld_length) - length= 14; /* Full date YYYYMMDDHHMMSS */ - else if (length != 19) + { + /* Compressed date YYYYMMDDHHMMSS */ + length= MAX_DATETIME_COMPRESSED_WIDTH; + } + else if (length != MAX_DATETIME_WIDTH) { /* We support only even TIMESTAMP lengths less or equal than 14 and 19 as length of 4.1 compatible representation. */ length= ((length+1)/2)*2; /* purecov: inspected */ - length= min(length,14); /* purecov: inspected */ + length= min(length, MAX_DATETIME_COMPRESSED_WIDTH); /* purecov: inspected */ } flags|= ZEROFILL_FLAG | UNSIGNED_FLAG; if (fld_default_value) @@ -8626,7 +8604,7 @@ bool create_field::init(THD *thd, char *fld_name, enum_field_types fld_type, length= 10; break; case FIELD_TYPE_DATETIME: - length= 19; + length= MAX_DATETIME_WIDTH; break; case FIELD_TYPE_SET: { diff --git a/sql/field.h b/sql/field.h index 78aa12ad200..fb6534b7b55 100644 --- a/sql/field.h +++ b/sql/field.h @@ -360,7 +360,12 @@ public: { return field_length / charset()->mbmaxlen; } - + virtual geometry_type get_geometry_type() + { + /* shouldn't get here. */ + DBUG_ASSERT(0); + return GEOM_GEOMETRY; + } friend bool reopen_table(THD *,struct st_table *,bool); friend int cre_myisam(my_string name, register TABLE *form, uint options, ulonglong auto_increment_value); @@ -453,6 +458,7 @@ public: /* base class for float and double and decimal (old one) */ class Field_real :public Field_num { public: + my_bool not_fixed; Field_real(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, utype unireg_check_arg, @@ -460,13 +466,16 @@ public: struct st_table *table_arg, uint8 dec_arg, bool zero_arg, bool unsigned_arg) :Field_num(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, unireg_check_arg, - field_name_arg, table_arg, dec_arg, zero_arg, unsigned_arg) + field_name_arg, table_arg, dec_arg, zero_arg, unsigned_arg), + not_fixed(dec_arg >= NOT_FIXED_DEC) {} int store_decimal(const my_decimal *); my_decimal *val_decimal(my_decimal *); + int truncate(double *nr, double max_length); uint32 max_display_length() { return field_length; } + uint size_of() const { return sizeof(*this); } }; @@ -675,7 +684,7 @@ public: void sort_string(char *buff,uint length); uint32 pack_length() const { return 4; } void sql_type(String &str) const; - uint32 max_display_length() { return 11; } + uint32 max_display_length() { return MY_INT32_NUM_DECIMAL_DIGITS; } }; @@ -758,7 +767,6 @@ public: class Field_double :public Field_real { public: - my_bool not_fixed; Field_double(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, @@ -766,21 +774,18 @@ public: uint8 dec_arg,bool zero_arg,bool unsigned_arg) :Field_real(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, unireg_check_arg, field_name_arg, table_arg, - dec_arg, zero_arg, unsigned_arg), - not_fixed(dec_arg >= NOT_FIXED_DEC) + dec_arg, zero_arg, unsigned_arg) {} Field_double(uint32 len_arg, bool maybe_null_arg, const char *field_name_arg, struct st_table *table_arg, uint8 dec_arg) :Field_real((char*) 0, len_arg, maybe_null_arg ? (uchar*) "" : 0, (uint) 0, - NONE, field_name_arg, table_arg, dec_arg, 0, 0), - not_fixed(dec_arg >= NOT_FIXED_DEC) + NONE, field_name_arg, table_arg, dec_arg, 0, 0) {} Field_double(uint32 len_arg, bool maybe_null_arg, const char *field_name_arg, - struct st_table *table_arg, uint8 dec_arg, my_bool not_fixed_srg) + struct st_table *table_arg, uint8 dec_arg, my_bool not_fixed_arg) :Field_real((char*) 0, len_arg, maybe_null_arg ? (uchar*) "" : 0, (uint) 0, - NONE, field_name_arg, table_arg, dec_arg, 0, 0), - not_fixed(not_fixed_srg) - {} + NONE, field_name_arg, table_arg, dec_arg, 0, 0) + {not_fixed= not_fixed_arg; } enum_field_types type() const { return FIELD_TYPE_DOUBLE;} enum ha_base_keytype key_type() const { return HA_KEYTYPE_DOUBLE; } int store(const char *to,uint length,CHARSET_INFO *charset); @@ -795,7 +800,6 @@ public: void sort_string(char *buff,uint length); uint32 pack_length() const { return sizeof(double); } void sql_type(String &str) const; - uint size_of() const { return sizeof(*this); } }; @@ -1108,6 +1112,11 @@ public: class Field_varstring :public Field_longstr { public: + /* + The maximum space available in a Field_varstring, in bytes. See + length_bytes. + */ + static const uint MAX_SIZE= UINT_MAX16; /* Store number of bytes used to store length (1 or 2) */ uint32 length_bytes; Field_varstring(char *ptr_arg, @@ -1320,6 +1329,7 @@ public: 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; }; }; #endif /*HAVE_SPATIAL*/ diff --git a/sql/field_conv.cc b/sql/field_conv.cc index 5670b1e0676..a286255ec23 100644 --- a/sql/field_conv.cc +++ b/sql/field_conv.cc @@ -177,8 +177,7 @@ set_field_to_null_with_conversions(Field *field, bool no_conversions) } if (current_thd->count_cuted_fields == CHECK_FIELD_WARN) { - field->set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, - ER_WARN_NULL_TO_NOTNULL, 1); + field->set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_BAD_NULL_ERROR, 1); return 0; } if (!current_thd->no_errors) @@ -308,6 +307,15 @@ static void do_field_string(Copy_field *copy) } +static void do_field_enum(Copy_field *copy) +{ + if (copy->from_field->val_int() == 0) + ((Field_enum *) copy->to_field)->store_type((ulonglong) 0); + else + do_field_string(copy); +} + + static void do_field_varbinary_pre50(Copy_field *copy) { char buff[MAX_FIELD_WIDTH]; @@ -530,7 +538,21 @@ void Copy_field::set(char *to,Field *from) } +/* + To do: + If 'save\ is set to true and the 'from' is a blob field, do_copy is set to + do_save_blob rather than do_conv_blob. The only differences between them + appears to be: + + - do_save_blob allocates and uses an intermediate buffer before calling + Field_blob::store. Is this in order to trigger the call to + well_formed_copy_nchars, by changing the pointer copy->tmp.ptr()? + That call will take place anyway in all known cases. + + - The above causes a truncation to MAX_FIELD_WIDTH. Is this the intended + effect? Truncation is handled by well_formed_copy_nchars anyway. + */ void Copy_field::set(Field *to,Field *from,bool save) { if (to->type() == FIELD_TYPE_NULL) @@ -649,7 +671,13 @@ void (*Copy_field::get_copy_func(Field *to,Field *from))(Copy_field*) to->real_type() == FIELD_TYPE_SET) { if (!to->eq_def(from)) - return do_field_string; + { + if (from->real_type() == MYSQL_TYPE_ENUM && + to->real_type() == MYSQL_TYPE_ENUM) + return do_field_enum; + else + return do_field_string; + } } else if (to->charset() != from->charset()) return do_field_string; diff --git a/sql/filesort.cc b/sql/filesort.cc index a4bf04a6786..f8868ed6927 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -35,7 +35,8 @@ if (my_b_write((file),(byte*) (from),param->ref_length)) \ /* functions defined in this file */ -static char **make_char_array(register uint fields, uint length, myf my_flag); +static char **make_char_array(char **old_pos, register uint fields, + uint length, myf my_flag); static BUFFPEK *read_buffpek_from_file(IO_CACHE *buffer_file, uint count); static ha_rows find_all_keys(SORTPARAM *param,SQL_SELECT *select, uchar * *sort_keys, IO_CACHE *buffer_file, @@ -202,9 +203,9 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length, ulong old_memavl; ulong keys= memavl/(param.rec_length+sizeof(char*)); param.keys=(uint) min(records+1, keys); - if (table_sort.sort_keys || - (table_sort.sort_keys= (uchar **) make_char_array(param.keys, param.rec_length, - MYF(0)))) + if ((table_sort.sort_keys= + (uchar **) make_char_array((char **) table_sort.sort_keys, + param.keys, param.rec_length, MYF(0)))) break; old_memavl=memavl; if ((memavl=memavl/4*3) < min_sort_memory && old_memavl > min_sort_memory) @@ -346,14 +347,16 @@ void filesort_free_buffers(TABLE *table, bool full) /* Make a array of string pointers */ -static char **make_char_array(register uint fields, uint length, myf my_flag) +static char **make_char_array(char **old_pos, register uint fields, + uint length, myf my_flag) { register char **pos; - char **old_pos,*char_pos; + char *char_pos; DBUG_ENTER("make_char_array"); - if ((old_pos= (char**) my_malloc((uint) fields*(length+sizeof(char*)), - my_flag))) + if (old_pos || + (old_pos= (char**) my_malloc((uint) fields*(length+sizeof(char*)), + my_flag))) { pos=old_pos; char_pos=((char*) (pos+fields)) -length; while (fields--) *(pos++) = (char_pos+= length); @@ -1049,6 +1052,7 @@ int merge_buffers(SORTPARAM *param, IO_CACHE *from_file, BUFFPEK *buffpek; QUEUE queue; qsort2_cmp cmp; + void *first_cmp_arg; volatile THD::killed_state *killed= ¤t_thd->killed; THD::killed_state not_killable; DBUG_ENTER("merge_buffers"); @@ -1074,9 +1078,18 @@ int merge_buffers(SORTPARAM *param, IO_CACHE *from_file, /* The following will fire if there is not enough space in sort_buffer */ DBUG_ASSERT(maxcount!=0); + if (param->unique_buff) + { + cmp= param->compare; + first_cmp_arg= (void *) ¶m->cmp_context; + } + else + { + cmp= get_ptr_compare(sort_length); + first_cmp_arg= (void*) &sort_length; + } if (init_queue(&queue, (uint) (Tb-Fb)+1, offsetof(BUFFPEK,key), 0, - (queue_compare) (cmp= get_ptr_compare(sort_length)), - (void*) &sort_length)) + (queue_compare) cmp, first_cmp_arg)) DBUG_RETURN(1); /* purecov: inspected */ for (buffpek= Fb ; buffpek <= Tb ; buffpek++) { @@ -1129,7 +1142,7 @@ int merge_buffers(SORTPARAM *param, IO_CACHE *from_file, buffpek= (BUFFPEK*) queue_top(&queue); if (cmp) // Remove duplicates { - if (!(*cmp)(&sort_length, &(param->unique_buff), + if (!(*cmp)(first_cmp_arg, &(param->unique_buff), (uchar**) &buffpek->key)) goto skip_duplicate; memcpy(param->unique_buff, (uchar*) buffpek->key, rec_length); @@ -1181,7 +1194,7 @@ int merge_buffers(SORTPARAM *param, IO_CACHE *from_file, */ if (cmp) { - if (!(*cmp)(&sort_length, &(param->unique_buff), (uchar**) &buffpek->key)) + if (!(*cmp)(first_cmp_arg, &(param->unique_buff), (uchar**) &buffpek->key)) { buffpek->key+= rec_length; // Remove duplicate --buffpek->mem_count; diff --git a/sql/ha_archive.cc b/sql/ha_archive.cc index e2a2211259f..0c558bf2515 100644 --- a/sql/ha_archive.cc +++ b/sql/ha_archive.cc @@ -205,7 +205,7 @@ bool archive_db_init() else { zoffset_size= 2 << ((zlibCompileFlags() >> 6) & 3); - switch (sizeof(z_off_t)) { + switch (zoffset_size) { case 2: max_zfile_size= INT_MAX16; break; @@ -676,6 +676,7 @@ int ha_archive::real_write_row(byte *buf, gzFile writer) total_row_length+= ((Field_blob*) table->field[*ptr])->get_length(); if (share->approx_file_size > max_zfile_size - total_row_length) { + gzflush(writer, Z_SYNC_FLUSH); info(HA_STATUS_TIME); share->approx_file_size= (ulong) data_file_length; if (share->approx_file_size > max_zfile_size - total_row_length) @@ -1204,7 +1205,6 @@ bool ha_archive::is_crashed() const int ha_archive::check(THD* thd, HA_CHECK_OPT* check_opt) { int rc= 0; - byte *buf; const char *old_proc_info=thd->proc_info; ha_rows count= share->rows_recorded; DBUG_ENTER("ha_archive::check"); @@ -1213,25 +1213,13 @@ int ha_archive::check(THD* thd, HA_CHECK_OPT* check_opt) /* Flush any waiting data */ gzflush(share->archive_write, Z_SYNC_FLUSH); - /* - First we create a buffer that we can use for reading rows, and can pass - to get_row(). - */ - if (!(buf= (byte*) my_malloc(table->s->reclength, MYF(MY_WME)))) - rc= HA_ERR_OUT_OF_MEM; - /* Now we will rewind the archive file so that we are positioned at the start of the file. */ - if (!rc) - read_data_header(archive); - - if (!rc) - while (!(rc= get_row(archive, buf))) - count--; - - my_free((char*)buf, MYF(0)); + read_data_header(archive); + while (!(rc= get_row(archive, table->record[0]))) + count--; thd->proc_info= old_proc_info; diff --git a/sql/ha_federated.cc b/sql/ha_federated.cc index dd4dd725be4..3cf9c2a8b99 100644 --- a/sql/ha_federated.cc +++ b/sql/ha_federated.cc @@ -348,6 +348,11 @@ pthread_mutex_t federated_mutex; // This is the mutex we use to // init the hash static int federated_init= FALSE; // Variable for checking the // init state of hash +static char ident_quote_char= '`'; // Character for quoting + // identifiers +static char value_quote_char= '\''; // Character for quoting + // literals +static const int bulk_padding= 64; // bytes "overhead" in packet /* Federated storage engine handlerton */ @@ -440,6 +445,58 @@ bool federated_db_end() return FALSE; } + +/** + @brief Append identifiers to the string. + + @param[in,out] string The target string. + @param[in] name Identifier name + @param[in] length Length of identifier name in bytes + @param[in] quote_char Quote char to use for quoting identifier. + + @return Operation Status + @retval FALSE OK + @retval TRUE There was an error appending to the string. + + @note This function is based upon the append_identifier() function + in sql_show.cc except that quoting always occurs. +*/ + +static bool append_ident(String *string, const char *name, uint length, + const char quote_char) +{ + bool result; + uint clen; + const char *name_end; + DBUG_ENTER("append_ident"); + + if (quote_char) + { + string->reserve(length * 2 + 2); + if ((result= string->append("e_char, 1, system_charset_info))) + goto err; + + for (name_end= name+length; name < name_end; name+= clen) + { + uchar c= *(uchar *) name; + if (!(clen= my_mbcharlen(system_charset_info, c))) + clen= 1; + if (clen == 1 && c == (uchar) quote_char && + (result= string->append("e_char, 1, system_charset_info))) + goto err; + if ((result= string->append(name, clen, string->charset()))) + goto err; + } + result= string->append("e_char, 1, system_charset_info); + } + else + result= string->append(name, length, system_charset_info); + +err: + DBUG_RETURN(result); +} + + /* Check (in create) whether the tables exists, and that it can be connected to @@ -458,7 +515,6 @@ bool federated_db_end() static int check_foreign_data_source(FEDERATED_SHARE *share, bool table_create_flag) { - char escaped_table_name[NAME_LEN*2]; char query_buffer[FEDERATED_QUERY_BUFFER_SIZE]; char error_buffer[FEDERATED_QUERY_BUFFER_SIZE]; uint error_code; @@ -499,7 +555,6 @@ static int check_foreign_data_source(FEDERATED_SHARE *share, } else { - int escaped_table_name_length= 0; /* Since we do not support transactions at this version, we can let the client API silently reconnect. For future versions, we will need more @@ -517,14 +572,8 @@ static int check_foreign_data_source(FEDERATED_SHARE *share, query.append(FEDERATED_SELECT); query.append(FEDERATED_STAR); query.append(FEDERATED_FROM); - query.append(FEDERATED_BTICK); - escaped_table_name_length= - escape_string_for_mysql(&my_charset_bin, (char*)escaped_table_name, - sizeof(escaped_table_name), - share->table_name, - share->table_name_length); - query.append(escaped_table_name, escaped_table_name_length); - query.append(FEDERATED_BTICK); + append_ident(&query, share->table_name, share->table_name_length, + ident_quote_char); query.append(FEDERATED_WHERE); query.append(FEDERATED_FALSE); @@ -725,7 +774,9 @@ error: ha_federated::ha_federated(TABLE *table_arg) :handler(&federated_hton, table_arg), mysql(0), stored_result(0) -{} +{ + bzero(&bulk_insert, sizeof(bulk_insert)); +} /* @@ -784,9 +835,8 @@ uint ha_federated::convert_row_to_internal_format(byte *record, static bool emit_key_part_name(String *to, KEY_PART_INFO *part) { DBUG_ENTER("emit_key_part_name"); - if (to->append(FEDERATED_BTICK) || - to->append(part->field->field_name) || - to->append(FEDERATED_BTICK)) + if (append_ident(to, part->field->field_name, + strlen(part->field->field_name), ident_quote_char)) DBUG_RETURN(1); // Out of memory DBUG_RETURN(0); } @@ -1309,31 +1359,28 @@ static FEDERATED_SHARE *get_share(const char *table_name, TABLE *table) query.append(FEDERATED_SELECT); for (field= table->field; *field; field++) { - query.append(FEDERATED_BTICK); - query.append((*field)->field_name); - query.append(FEDERATED_BTICK); + append_ident(&query, (*field)->field_name, + strlen((*field)->field_name), ident_quote_char); query.append(FEDERATED_COMMA); } query.length(query.length()- strlen(FEDERATED_COMMA)); query.append(FEDERATED_FROM); - query.append(FEDERATED_BTICK); + + tmp_share.table_name_length= strlen(tmp_share.table_name); + append_ident(&query, tmp_share.table_name, + tmp_share.table_name_length, ident_quote_char); if (!(share= (FEDERATED_SHARE *) my_multi_malloc(MYF(MY_WME), &share, sizeof(*share), - &select_query, - query.length()+table->s->connect_string.length+1, + &select_query, query.length()+1, NullS))) goto error; memcpy(share, &tmp_share, sizeof(tmp_share)); + memcpy(select_query, query.ptr(), query.length()+1); - share->table_name_length= strlen(share->table_name); - /* TODO: share->table_name to LEX_STRING object */ - query.append(share->table_name, share->table_name_length); - query.append(FEDERATED_BTICK); share->select_query= select_query; - strmov(share->select_query, query.ptr()); share->use_count= 0; DBUG_PRINT("info", ("share->select_query %s", share->select_query)); @@ -1467,6 +1514,8 @@ int ha_federated::open(const char *name, int mode, uint test_if_locked) table->s->reclength); DBUG_PRINT("info", ("ref_length: %u", ref_length)); + reset(); + DBUG_RETURN(0); } @@ -1538,6 +1587,83 @@ inline uint field_in_record_is_null(TABLE *table, DBUG_RETURN(0); } + +/** + @brief Construct the INSERT statement. + + @details This method will construct the INSERT statement and appends it to + the supplied query string buffer. + + @return + @retval FALSE No error + @retval TRUE Failure +*/ + +bool ha_federated::append_stmt_insert(String *query) +{ + char insert_buffer[FEDERATED_QUERY_BUFFER_SIZE]; + Field **field; + uint tmp_length; + + /* The main insert query string */ + String insert_string(insert_buffer, sizeof(insert_buffer), &my_charset_bin); + DBUG_ENTER("ha_federated::append_stmt_insert"); + + insert_string.length(0); + + if (replace_duplicates) + insert_string.append(STRING_WITH_LEN("REPLACE INTO ")); + else if (ignore_duplicates && !insert_dup_update) + insert_string.append(STRING_WITH_LEN("INSERT IGNORE INTO ")); + else + insert_string.append(STRING_WITH_LEN("INSERT INTO ")); + append_ident(&insert_string, share->table_name, share->table_name_length, + ident_quote_char); + insert_string.append(FEDERATED_OPENPAREN); + tmp_length= insert_string.length() - strlen(FEDERATED_COMMA); + + /* + loop through the field pointer array, add any fields to both the values + list and the fields list that match the current query id + */ + for (field= table->field; *field; field++) + { + /* append the field name */ + append_ident(&insert_string, (*field)->field_name, + strlen((*field)->field_name), ident_quote_char); + + /* append commas between both fields and fieldnames */ + /* + unfortunately, we can't use the logic + if *(fields + 1) to make the following + appends conditional because we may not append + if the next field doesn't match the condition: + (((*field)->query_id && (*field)->query_id == current_query_id) + */ + insert_string.append(FEDERATED_COMMA); + } + + /* + remove trailing comma + */ + insert_string.length(insert_string.length() - strlen(FEDERATED_COMMA)); + + /* + if there were no fields, we don't want to add a closing paren + AND, we don't want to chop off the last char '(' + insert will be "INSERT INTO t1 VALUES ();" + */ + if (insert_string.length() > tmp_length) + { + insert_string.append(FEDERATED_CLOSEPAREN); + } + + insert_string.append(FEDERATED_VALUES); + + DBUG_RETURN(query->append(insert_string)); +} + + /* write_row() inserts a row. No extra() hint is given currently if a bulk load is happeneding. buf() is a byte array of data. You can use the field @@ -1554,13 +1680,14 @@ inline uint field_in_record_is_null(TABLE *table, int ha_federated::write_row(byte *buf) { - char insert_buffer[FEDERATED_QUERY_BUFFER_SIZE]; char values_buffer[FEDERATED_QUERY_BUFFER_SIZE]; char insert_field_value_buffer[STRING_BUFFER_USUAL_SIZE]; Field **field; + uint tmp_length; + int error= 0; + bool use_bulk_insert; + bool auto_increment_update_required= (table->next_number_field != NULL); - /* The main insert query string */ - String insert_string(insert_buffer, sizeof(insert_buffer), &my_charset_bin); /* The string containing the values to be added to the insert */ String values_string(values_buffer, sizeof(values_buffer), &my_charset_bin); /* The actual value of the field, to be added to the values_string */ @@ -1568,7 +1695,6 @@ int ha_federated::write_row(byte *buf) sizeof(insert_field_value_buffer), &my_charset_bin); values_string.length(0); - insert_string.length(0); insert_field_value_string.length(0); DBUG_ENTER("ha_federated::write_row"); @@ -1578,15 +1704,19 @@ int ha_federated::write_row(byte *buf) /* start both our field and field values strings + We must disable multi-row insert for "INSERT...ON DUPLICATE KEY UPDATE" + Ignore duplicates is always true when insert_dup_update is true. + When replace_duplicates == TRUE, we can safely enable multi-row insert. + When performing multi-row insert, we only collect the columns values for + the row. The start of the statement is only created when the first + row is copied in to the bulk_insert string. */ - insert_string.append(FEDERATED_INSERT); - insert_string.append(FEDERATED_BTICK); - insert_string.append(share->table_name, share->table_name_length); - insert_string.append(FEDERATED_BTICK); - insert_string.append(FEDERATED_OPENPAREN); + if (!(use_bulk_insert= bulk_insert.str && + (!insert_dup_update || replace_duplicates))) + append_stmt_insert(&values_string); - values_string.append(FEDERATED_VALUES); values_string.append(FEDERATED_OPENPAREN); + tmp_length= values_string.length(); /* loop through the field pointer array, add any fields to both the values @@ -1599,14 +1729,12 @@ int ha_federated::write_row(byte *buf) else { (*field)->val_str(&insert_field_value_string); - values_string.append('\''); + values_string.append(value_quote_char); insert_field_value_string.print(&values_string); - values_string.append('\''); + values_string.append(value_quote_char); insert_field_value_string.length(0); } - /* append the field name */ - insert_string.append((*field)->field_name); /* append the value */ values_string.append(insert_field_value_string); @@ -1620,32 +1748,61 @@ int ha_federated::write_row(byte *buf) if the next field doesn't match the condition: (((*field)->query_id && (*field)->query_id == current_query_id) */ - insert_string.append(FEDERATED_COMMA); values_string.append(FEDERATED_COMMA); } - /* - remove trailing comma - */ - insert_string.length(insert_string.length() - strlen(FEDERATED_COMMA)); /* if there were no fields, we don't want to add a closing paren AND, we don't want to chop off the last char '(' insert will be "INSERT INTO t1 VALUES ();" */ - if (table->s->fields) + if (values_string.length() > tmp_length) { /* chops off leading commas */ values_string.length(values_string.length() - strlen(FEDERATED_COMMA)); - insert_string.append(FEDERATED_CLOSEPAREN); } /* we always want to append this, even if there aren't any fields */ values_string.append(FEDERATED_CLOSEPAREN); - /* add the values */ - insert_string.append(values_string); + if (use_bulk_insert) + { + /* + Send the current bulk insert out if appending the current row would + cause the statement to overflow the packet size, otherwise set + auto_increment_update_required to FALSE as no query was executed. + */ + if (bulk_insert.length + values_string.length() + bulk_padding > + mysql->net.max_packet_size && bulk_insert.length) + { + error= mysql_real_query(mysql, bulk_insert.str, bulk_insert.length); + bulk_insert.length= 0; + } + else + auto_increment_update_required= FALSE; + + if (bulk_insert.length == 0) + { + char insert_buffer[FEDERATED_QUERY_BUFFER_SIZE]; + String insert_string(insert_buffer, sizeof(insert_buffer), + &my_charset_bin); + insert_string.length(0); + append_stmt_insert(&insert_string); + dynstr_append_mem(&bulk_insert, insert_string.ptr(), + insert_string.length()); + } + else + dynstr_append_mem(&bulk_insert, ",", 1); - if (mysql_real_query(mysql, insert_string.ptr(), insert_string.length())) + dynstr_append_mem(&bulk_insert, values_string.ptr(), + values_string.length()); + } + else + { + error= mysql_real_query(mysql, values_string.ptr(), + values_string.length()); + } + + if (error) { DBUG_RETURN(stash_remote_error()); } @@ -1653,12 +1810,79 @@ int ha_federated::write_row(byte *buf) If the table we've just written a record to contains an auto_increment field, then store the last_insert_id() value from the foreign server */ - if (table->next_number_field) + if (auto_increment_update_required) update_auto_increment(); DBUG_RETURN(0); } + +/** + @brief Prepares the storage engine for bulk inserts. + + @param[in] rows estimated number of rows in bulk insert + or 0 if unknown. + + @details Initializes memory structures required for bulk insert. +*/ + +void ha_federated::start_bulk_insert(ha_rows rows) +{ + uint page_size; + DBUG_ENTER("ha_federated::start_bulk_insert"); + + dynstr_free(&bulk_insert); + + /** + We don't bother with bulk-insert semantics when the estimated rows == 1 + The rows value will be 0 if the server does not know how many rows + would be inserted. This can occur when performing INSERT...SELECT + */ + + if (rows == 1) + DBUG_VOID_RETURN; + + page_size= (uint) my_getpagesize(); + + if (init_dynamic_string(&bulk_insert, NULL, page_size, page_size)) + DBUG_VOID_RETURN; + + bulk_insert.length= 0; + DBUG_VOID_RETURN; +} + + +/** + @brief End bulk insert. + + @details This method will send any remaining rows to the remote server. + Finally, it will deinitialize the bulk insert data structure. + + @return Operation status + @retval 0 No error + @retval != 0 Error occured at remote server. Also sets my_errno. +*/ + +int ha_federated::end_bulk_insert() +{ + int error= 0; + DBUG_ENTER("ha_federated::end_bulk_insert"); + + if (bulk_insert.str && bulk_insert.length) + { + if (mysql_real_query(mysql, bulk_insert.str, bulk_insert.length)) + error= stash_remote_error(); + else + if (table->next_number_field) + update_auto_increment(); + } + + dynstr_free(&bulk_insert); + + DBUG_RETURN(my_errno= error); +} + + /* ha_federated::update_auto_increment @@ -1688,9 +1912,8 @@ int ha_federated::optimize(THD* thd, HA_CHECK_OPT* check_opt) query.set_charset(system_charset_info); query.append(FEDERATED_OPTIMIZE); - query.append(FEDERATED_BTICK); - query.append(share->table_name, share->table_name_length); - query.append(FEDERATED_BTICK); + append_ident(&query, share->table_name, share->table_name_length, + ident_quote_char); if (mysql_real_query(mysql, query.ptr(), query.length())) { @@ -1711,9 +1934,8 @@ int ha_federated::repair(THD* thd, HA_CHECK_OPT* check_opt) query.set_charset(system_charset_info); query.append(FEDERATED_REPAIR); - query.append(FEDERATED_BTICK); - query.append(share->table_name, share->table_name_length); - query.append(FEDERATED_BTICK); + append_ident(&query, share->table_name, share->table_name_length, + ident_quote_char); if (check_opt->flags & T_QUICK) query.append(FEDERATED_QUICK); if (check_opt->flags & T_EXTEND) @@ -1788,10 +2010,12 @@ int ha_federated::update_row(const byte *old_data, byte *new_data) update_string.length(0); where_string.length(0); - update_string.append(FEDERATED_UPDATE); - update_string.append(FEDERATED_BTICK); - update_string.append(share->table_name); - update_string.append(FEDERATED_BTICK); + if (ignore_duplicates) + update_string.append(STRING_WITH_LEN("UPDATE IGNORE ")); + else + update_string.append(STRING_WITH_LEN("UPDATE ")); + append_ident(&update_string, share->table_name, + share->table_name_length, ident_quote_char); update_string.append(FEDERATED_SET); /* @@ -1806,8 +2030,11 @@ int ha_federated::update_row(const byte *old_data, byte *new_data) for (Field **field= table->field; *field; field++) { - where_string.append((*field)->field_name); - update_string.append((*field)->field_name); + uint field_name_length= strlen((*field)->field_name); + append_ident(&where_string, (*field)->field_name, field_name_length, + ident_quote_char); + append_ident(&update_string, (*field)->field_name, field_name_length, + ident_quote_char); update_string.append(FEDERATED_EQ); if ((*field)->is_null()) @@ -1816,9 +2043,9 @@ int ha_federated::update_row(const byte *old_data, byte *new_data) { /* otherwise = */ (*field)->val_str(&field_value); - update_string.append('\''); + update_string.append(value_quote_char); field_value.print(&update_string); - update_string.append('\''); + update_string.append(value_quote_char); field_value.length(0); } @@ -1829,9 +2056,9 @@ int ha_federated::update_row(const byte *old_data, byte *new_data) where_string.append(FEDERATED_EQ); (*field)->val_str(&field_value, (char*) (old_data + (*field)->offset())); - where_string.append('\''); + where_string.append(value_quote_char); field_value.print(&where_string); - where_string.append('\''); + where_string.append(value_quote_char); field_value.length(0); } @@ -1888,16 +2115,16 @@ int ha_federated::delete_row(const byte *buf) delete_string.length(0); delete_string.append(FEDERATED_DELETE); delete_string.append(FEDERATED_FROM); - delete_string.append(FEDERATED_BTICK); - delete_string.append(share->table_name); - delete_string.append(FEDERATED_BTICK); + append_ident(&delete_string, share->table_name, + share->table_name_length, ident_quote_char); delete_string.append(FEDERATED_WHERE); for (Field **field= table->field; *field; field++) { Field *cur_field= *field; data_string.length(0); - delete_string.append(cur_field->field_name); + append_ident(&delete_string, (*field)->field_name, + strlen((*field)->field_name), ident_quote_char); if (cur_field->is_null()) { @@ -1907,9 +2134,9 @@ int ha_federated::delete_row(const byte *buf) { delete_string.append(FEDERATED_EQ); cur_field->val_str(&data_string); - delete_string.append('\''); + delete_string.append(value_quote_char); data_string.print(&delete_string); - delete_string.append('\''); + delete_string.append(value_quote_char); } delete_string.append(FEDERATED_AND); @@ -2397,7 +2624,6 @@ int ha_federated::info(uint flag) { char error_buffer[FEDERATED_QUERY_BUFFER_SIZE]; char status_buf[FEDERATED_QUERY_BUFFER_SIZE]; - char escaped_table_name[FEDERATED_QUERY_BUFFER_SIZE]; int error; uint error_code; MYSQL_RES *result= 0; @@ -2411,14 +2637,8 @@ int ha_federated::info(uint flag) { status_query_string.length(0); status_query_string.append(FEDERATED_INFO); - status_query_string.append(FEDERATED_SQUOTE); - - escape_string_for_mysql(&my_charset_bin, (char *)escaped_table_name, - sizeof(escaped_table_name), - share->table_name, - share->table_name_length); - status_query_string.append(escaped_table_name); - status_query_string.append(FEDERATED_SQUOTE); + append_ident(&status_query_string, share->table_name, + share->table_name_length, value_quote_char); if (mysql_real_query(mysql, status_query_string.ptr(), status_query_string.length())) @@ -2484,6 +2704,51 @@ error: } +/** + @brief Handles extra signals from MySQL server + + @param[in] operation Hint for storage engine + + @return Operation Status + @retval 0 OK + */ +int ha_federated::extra(ha_extra_function operation) +{ + DBUG_ENTER("ha_federated::extra"); + switch (operation) { + case HA_EXTRA_IGNORE_DUP_KEY: + ignore_duplicates= TRUE; + break; + case HA_EXTRA_NO_IGNORE_DUP_KEY: + insert_dup_update= FALSE; + ignore_duplicates= FALSE; + break; + case HA_EXTRA_WRITE_CAN_REPLACE: + replace_duplicates= TRUE; + break; + case HA_EXTRA_WRITE_CANNOT_REPLACE: + /* + We use this flag to ensure that we do not create an "INSERT IGNORE" + statement when inserting new rows into the remote table. + */ + replace_duplicates= FALSE; + break; + case HA_EXTRA_INSERT_WITH_UPDATE: + insert_dup_update= TRUE; + break; + case HA_EXTRA_RESET: + insert_dup_update= FALSE; + ignore_duplicates= FALSE; + replace_duplicates= FALSE; + break; + default: + /* do nothing */ + DBUG_PRINT("info",("unhandled operation: %d", (uint) operation)); + } + DBUG_RETURN(0); +} + + /* Used to delete all rows in a table. Both for cases of truncate and for cases where the optimizer realizes that all rows will be @@ -2506,9 +2771,8 @@ int ha_federated::delete_all_rows() query.set_charset(system_charset_info); query.append(FEDERATED_TRUNCATE); - query.append(FEDERATED_BTICK); - query.append(share->table_name); - query.append(FEDERATED_BTICK); + append_ident(&query, share->table_name, share->table_name_length, + ident_quote_char); /* TRUNCATE won't return anything in mysql_affected_rows @@ -2616,6 +2880,9 @@ int ha_federated::stash_remote_error() DBUG_ENTER("ha_federated::stash_remote_error()"); remote_error_number= mysql_errno(mysql); strmake(remote_error_buf, mysql_error(mysql), sizeof(remote_error_buf)-1); + if (remote_error_number == ER_DUP_ENTRY || + remote_error_number == ER_DUP_KEY) + DBUG_RETURN(HA_ERR_FOUND_DUPP_KEY); DBUG_RETURN(HA_FEDERATED_ERROR_WITH_REMOTE_SYSTEM); } diff --git a/sql/ha_federated.h b/sql/ha_federated.h index 09c934cb493..b5e1c217eb5 100644 --- a/sql/ha_federated.h +++ b/sql/ha_federated.h @@ -157,6 +157,9 @@ class ha_federated: public handler MYSQL_ROW_OFFSET current_position; // Current position used by ::position() int remote_error_number; char remote_error_buf[FEDERATED_QUERY_BUFFER_SIZE]; + bool ignore_duplicates, replace_duplicates; + bool insert_dup_update; + DYNAMIC_STRING bulk_insert; private: /* @@ -171,6 +174,14 @@ private: bool records_in_range); int stash_remote_error(); + bool append_stmt_insert(String *query); + + int read_next(byte *buf, MYSQL_RES *result); + int index_read_idx_with_result_set(byte *buf, uint index, + const byte *key, + uint key_len, + ha_rkey_function find_flag, + MYSQL_RES **result); public: ha_federated(TABLE *table_arg); ~ha_federated() @@ -256,6 +267,8 @@ public: int open(const char *name, int mode, uint test_if_locked); // required int close(void); // required + void start_bulk_insert(ha_rows rows); + int end_bulk_insert(); int write_row(byte *buf); int update_row(const byte *old_data, byte *new_data); int delete_row(const byte *buf); @@ -284,6 +297,7 @@ public: int rnd_pos(byte *buf, byte *pos); //required void position(const byte *record); //required int info(uint); //required + int extra(ha_extra_function operation); void update_auto_increment(void); int repair(THD* thd, HA_CHECK_OPT* check_opt); @@ -298,14 +312,7 @@ public: THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to, enum thr_lock_type lock_type); //required - virtual bool get_error_message(int error, String *buf); - - int read_next(byte *buf, MYSQL_RES *result); - int index_read_idx_with_result_set(byte *buf, uint index, - const byte *key, - uint key_len, - ha_rkey_function find_flag, - MYSQL_RES **result); + bool get_error_message(int error, String *buf); }; bool federated_db_init(void); diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index 455c0968050..b03dc9bb986 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -15,7 +15,7 @@ /* This file defines the InnoDB handler: the interface between MySQL and InnoDB NOTE: You can only use noninlined InnoDB functions in this file, because we -have disables the InnoDB inlining in this file. */ +have disabled the InnoDB inlining in this file. */ /* TODO list for the InnoDB handler in 5.0: - Remove the flag trx->active_trans and look at the InnoDB @@ -504,7 +504,7 @@ convert_error_code_to_mysql( } else if (error == (int) DB_TABLE_NOT_FOUND) { - return(HA_ERR_KEY_NOT_FOUND); + return(HA_ERR_NO_SUCH_TABLE); } else if (error == (int) DB_TOO_BIG_RECORD) { @@ -2313,8 +2313,15 @@ ha_innobase::close(void) /*====================*/ /* out: 0 */ { + THD* thd; + DBUG_ENTER("ha_innobase::close"); + thd = current_thd; // avoid calling current_thd twice, it may be slow + if (thd != NULL) { + innobase_release_temporary_latches(thd); + } + row_prebuilt_free((row_prebuilt_t*) innobase_prebuilt); my_free((gptr) upd_buff, MYF(0)); @@ -5305,7 +5312,12 @@ ha_innobase::info( if (srv_force_recovery >= SRV_FORCE_NO_IBUF_MERGE) { - DBUG_RETURN(HA_ERR_CRASHED); + /* We return success (0) instead of HA_ERR_CRASHED, + because we want MySQL to process this query and not + stop, like it would do if it received the error code + HA_ERR_CRASHED. */ + + DBUG_RETURN(0); } /* We do not know if MySQL can call this function before calling @@ -6150,6 +6162,12 @@ ha_innobase::external_lock( trx->n_mysql_tables_in_use--; prebuilt->mysql_has_locked = FALSE; + /* Release a possible FIFO ticket and search latch. Since we + may reserve the kernel mutex, we have to release the search + system latch first to obey the latching order. */ + + innobase_release_stat_resources(trx); + /* If the MySQL lock count drops to zero we know that the current SQL statement has ended */ @@ -6158,12 +6176,6 @@ ha_innobase::external_lock( trx->mysql_n_tables_locked = 0; prebuilt->used_in_HANDLER = FALSE; - /* Release a possible FIFO ticket and search latch. Since we - may reserve the kernel mutex, we have to release the search - system latch first to obey the latching order. */ - - innobase_release_stat_resources(trx); - if (!(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))) { if (trx->active_trans != 0) { innobase_commit(thd, TRUE); @@ -6593,8 +6605,15 @@ ha_innobase::store_lock( TL_IGNORE */ { row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt; + trx_t* trx; - /* NOTE: MySQL can call this function with lock 'type' TL_IGNORE! + /* Note that trx in this function is NOT necessarily prebuilt->trx + because we call update_thd() later, in ::external_lock()! Failure to + understand this caused a serious memory corruption bug in 5.1.11. */ + + trx = check_trx_exists(thd); + + /* NOTE: MySQL can call this function with lock 'type' TL_IGNORE! Be careful to ignore TL_IGNORE if we are going to do something with only 'real' locks! */ @@ -6624,7 +6643,7 @@ ha_innobase::store_lock( used. */ if (srv_locks_unsafe_for_binlog && - prebuilt->trx->isolation_level != TRX_ISO_SERIALIZABLE && + trx->isolation_level != TRX_ISO_SERIALIZABLE && (lock_type == TL_READ || lock_type == TL_READ_NO_INSERT) && (thd->lex->sql_command == SQLCOM_INSERT_SELECT || thd->lex->sql_command == SQLCOM_UPDATE || diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc index 9a397ffbbac..5e953092436 100644 --- a/sql/ha_myisam.cc +++ b/sql/ha_myisam.cc @@ -109,6 +109,14 @@ static void mi_check_print_msg(MI_CHECK *param, const char* msg_type, } length=(uint) (strxmov(name, param->db_name,".",param->table_name,NullS) - name); + /* + TODO: switch from protocol to push_warning here. The main reason we didn't + it yet is parallel repair. Due to following trace: + mi_check_print_msg/push_warning/sql_alloc/my_pthread_getspecific_ptr. + + Also we likely need to lock mutex here (in both cases with protocol and + push_warning). + */ protocol->prepare_for_resend(); protocol->store(name, length, system_charset_info); protocol->store(param->op_name, system_charset_info); @@ -1138,11 +1146,7 @@ int ha_myisam::assign_to_keycache(THD* thd, HA_CHECK_OPT *check_opt) /* We only come here when the user did specify an index map */ key_map kmap; if (get_key_map_from_key_list(&kmap, table, table_list->use_index)) - { - errmsg= thd->net.last_error; - error= HA_ADMIN_FAILED; - goto err; - } + DBUG_RETURN(HA_ADMIN_FAILED); map= kmap.to_ulonglong(); } @@ -1155,7 +1159,6 @@ int ha_myisam::assign_to_keycache(THD* thd, HA_CHECK_OPT *check_opt) error= HA_ADMIN_CORRUPT; } - err: if (error != HA_ADMIN_OK) { /* Send error to user */ @@ -1192,11 +1195,7 @@ int ha_myisam::preload_keys(THD* thd, HA_CHECK_OPT *check_opt) key_map kmap; get_key_map_from_key_list(&kmap, table, table_list->use_index); if (kmap.is_set_all()) - { - errmsg= thd->net.last_error; - error= HA_ADMIN_FAILED; - goto err; - } + DBUG_RETURN(HA_ADMIN_FAILED); if (!kmap.is_clear_all()) map= kmap.to_ulonglong(); } diff --git a/sql/ha_myisammrg.cc b/sql/ha_myisammrg.cc index 1202a733a16..60aa4bd6adc 100644 --- a/sql/ha_myisammrg.cc +++ b/sql/ha_myisammrg.cc @@ -72,6 +72,24 @@ extern int check_definition(MI_KEYDEF *t1_keyinfo, MI_COLUMNDEF *t1_recinfo, uint t1_keys, uint t1_recs, MI_KEYDEF *t2_keyinfo, MI_COLUMNDEF *t2_recinfo, uint t2_keys, uint t2_recs, bool strict); +static void split_file_name(const char *file_name, + LEX_STRING *db, LEX_STRING *name); + + +extern "C" void myrg_print_wrong_table(const char *table_name) +{ + LEX_STRING db, name; + char buf[FN_REFLEN]; + split_file_name(table_name, &db, &name); + memcpy(buf, db.str, db.length); + buf[db.length]= '.'; + memcpy(buf + db.length + 1, name.str, name.length); + buf[db.length + name.length + 1]= 0; + push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_ERROR, + ER_ADMIN_WRONG_MRG_TABLE, ER(ER_ADMIN_WRONG_MRG_TABLE), + buf); +} + const char **ha_myisammrg::bas_ext() const { @@ -121,6 +139,8 @@ int ha_myisammrg::open(const char *name, int mode, uint test_if_locked) { DBUG_PRINT("error",("reclength: %lu mean_rec_length: %lu", table->s->reclength, mean_rec_length)); + if (test_if_locked & HA_OPEN_FOR_REPAIR) + myrg_print_wrong_table(file->open_tables->table->filename); error= HA_ERR_WRONG_MRG_TABLE_DEF; goto err; } @@ -139,12 +159,19 @@ int ha_myisammrg::open(const char *name, int mode, uint test_if_locked) u_table->table->s->base.keys, u_table->table->s->base.fields, false)) { - my_free((gptr) recinfo, MYF(0)); error= HA_ERR_WRONG_MRG_TABLE_DEF; - goto err; + if (test_if_locked & HA_OPEN_FOR_REPAIR) + myrg_print_wrong_table(u_table->table->filename); + else + { + my_free((gptr) recinfo, MYF(0)); + goto err; + } } } my_free((gptr) recinfo, MYF(0)); + if (error == HA_ERR_WRONG_MRG_TABLE_DEF) + goto err; #if !defined(BIG_TABLES) || SIZEOF_OFF_T == 4 /* Merge table has more than 2G rows */ if (table->s->crashed) @@ -597,3 +624,9 @@ void ha_myisammrg::append_create_info(String *packet) } packet->append(')'); } + + +int ha_myisammrg::check(THD* thd, HA_CHECK_OPT* check_opt) +{ + return HA_ADMIN_OK; +} diff --git a/sql/ha_myisammrg.h b/sql/ha_myisammrg.h index 16c734e2682..2ba5b6b551e 100644 --- a/sql/ha_myisammrg.h +++ b/sql/ha_myisammrg.h @@ -81,4 +81,5 @@ class ha_myisammrg: public handler void update_create_info(HA_CREATE_INFO *create_info); void append_create_info(String *packet); MYRG_INFO *myrg_info() { return file; } + int check(THD* thd, HA_CHECK_OPT* check_opt); }; diff --git a/sql/handler.cc b/sql/handler.cc index 37b81b58cfe..f8aec72ec90 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -1343,7 +1343,7 @@ int ha_delete_table(THD *thd, enum db_type table_type, const char *path, strmake(buff, thd->net.last_error, sizeof(buff)-1); thd->query_error= 0; - thd->spcont= 0; + thd->spcont= NULL; thd->lex->current_select= 0; thd->net.last_error[0]= 0; diff --git a/sql/handler.h b/sql/handler.h index 8847d0306fb..2680c9859f6 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -163,6 +163,7 @@ #define HA_LEX_CREATE_TMP_TABLE 1 #define HA_LEX_CREATE_IF_NOT_EXISTS 2 +#define HA_LEX_CREATE_TABLE_LIKE 4 #define HA_OPTION_NO_CHECKSUM (1L << 17) #define HA_OPTION_NO_DELAY_KEY_WRITE (1L << 18) #define HA_MAX_REC_LENGTH 65535 diff --git a/sql/init.cc b/sql/init.cc index ad55a2a8b24..b3b68926683 100644 --- a/sql/init.cc +++ b/sql/init.cc @@ -21,8 +21,6 @@ void unireg_init(ulong options) { - uint i; - double nr; DBUG_ENTER("unireg_init"); MYSYS_PROGRAM_DONT_USE_CURSES(); @@ -39,16 +37,5 @@ void unireg_init(ulong options) VOID(strmov(reg_ext,".frm")); specialflag=SPECIAL_SAME_DB_NAME | options; /* Set options from argv */ - /* Make a tab of powers of 10 */ - for (i=0,nr=1.0; i < array_elements(log_10) ; i++) - { /* It's used by filesort... */ - log_10[i]= nr ; nr*= 10.0; - } - /* Make a tab of powers of 0.1 */ - for (i= 0, nr= 0.1; i < array_elements(log_01); i++) - { - log_01[i]= nr; - nr*= 0.1; - } DBUG_VOID_RETURN; } diff --git a/sql/item.cc b/sql/item.cc index 92ea35072f9..52389eece10 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -1938,10 +1938,11 @@ bool Item_field::val_bool_result() bool Item_field::eq(const Item *item, bool binary_cmp) const { - if (item->type() != FIELD_ITEM) + Item *real_item= ((Item *) item)->real_item(); + if (real_item->type() != FIELD_ITEM) return 0; - Item_field *item_field= (Item_field*) item; + Item_field *item_field= (Item_field*) real_item; if (item_field->field && field) return item_field->field == field; /* @@ -2313,6 +2314,7 @@ default_set_param_func(Item_param *param, Item_param::Item_param(unsigned pos_in_query_arg) : + strict_type(FALSE), state(NO_VALUE), item_result_type(STRING_RESULT), /* Don't pretend to be a literal unless value for this item is set. */ @@ -2507,16 +2509,16 @@ bool Item_param::set_from_user_var(THD *thd, const user_var_entry *entry) if (entry && entry->value) { item_result_type= entry->type; - switch (entry->type) { + if (strict_type && required_result_type != item_result_type) + DBUG_RETURN(1); + switch (item_result_type) { case REAL_RESULT: set_double(*(double*)entry->value); item_type= Item::REAL_ITEM; - item_result_type= REAL_RESULT; break; case INT_RESULT: set_int(*(longlong*)entry->value, MY_INT64_NUM_DECIMAL_DIGITS); item_type= Item::INT_ITEM; - item_result_type= INT_RESULT; break; case STRING_RESULT: { @@ -2538,7 +2540,6 @@ bool Item_param::set_from_user_var(THD *thd, const user_var_entry *entry) charset of connection, so we have to set it later. */ item_type= Item::STRING_ITEM; - item_result_type= STRING_RESULT; if (set_str((const char *)entry->value, entry->length)) DBUG_RETURN(1); @@ -2552,6 +2553,7 @@ bool Item_param::set_from_user_var(THD *thd, const user_var_entry *entry) decimals= ent_value->frac; max_length= my_decimal_precision_to_length(ent_value->precision(), decimals, unsigned_flag); + item_type= Item::DECIMAL_ITEM; break; } default: @@ -4317,7 +4319,9 @@ Field *Item::tmp_table_field_from_field_type(TABLE *table) case MYSQL_TYPE_GEOMETRY: return new Field_geom(max_length, maybe_null, name, table, (Field::geometry_type) - ((Item_geometry_func *)this)->get_geometry_type()); + ((type() == Item::TYPE_HOLDER) ? + ((Item_type_holder *)this)->get_geometry_type() : + ((Item_geometry_func *)this)->get_geometry_type())); } } @@ -5498,6 +5502,21 @@ void Item_ref::make_field(Send_field *field) } +Item *Item_ref::get_tmp_table_item(THD *thd) +{ + if (!result_field) + return (*ref)->get_tmp_table_item(thd); + + Item_field *item= new Item_field(result_field); + if (item) + { + item->table_name= table_name; + item->db_name= db_name; + } + return item; +} + + void Item_ref_null_helper::print(String *str) { str->append(STRING_WITH_LEN("(")); @@ -5624,8 +5643,7 @@ bool Item_outer_ref::fix_fields(THD *thd, Item **reference) DESCRIPTION A view column reference is considered equal to another column reference if the second one is a view column and if both column - references resolve to the same item. It is assumed that both - items are of the same type. + references resolve to the same item. RETURN TRUE Referenced item is equal to given item @@ -5641,8 +5659,6 @@ bool Item_direct_view_ref::eq(const Item *item, bool binary_cmp) const if (item_ref->ref_type() == VIEW_REF) { Item *item_ref_ref= *(item_ref->ref); - DBUG_ASSERT((*ref)->real_item()->type() == - item_ref_ref->real_item()->type()); return ((*ref)->real_item() == item_ref_ref->real_item()); } } @@ -6422,6 +6438,10 @@ Item_type_holder::Item_type_holder(THD *thd, Item *item) if (Field::result_merge_type(fld_type) == INT_RESULT) decimals= 0; prev_decimal_int_part= item->decimal_int_part(); + 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(); } @@ -6575,9 +6595,15 @@ bool Item_type_holder::join_types(THD *thd, Item *item) expansion of the size of the values because of character set conversions. */ - max_length= max(old_max_chars * collation.collation->mbmaxlen, - display_length(item) / item->collation.collation->mbmaxlen * - collation.collation->mbmaxlen); + if (collation.collation != &my_charset_bin) + { + max_length= max(old_max_chars * collation.collation->mbmaxlen, + display_length(item) / + item->collation.collation->mbmaxlen * + collation.collation->mbmaxlen); + } + else + set_if_bigger(max_length, display_length(item)); break; } case REAL_RESULT: diff --git a/sql/item.h b/sql/item.h index 11dce3a7758..26b39e0bd00 100644 --- a/sql/item.h +++ b/sql/item.h @@ -1304,6 +1304,11 @@ 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() + { + DBUG_ASSERT(field_type() == MYSQL_TYPE_GEOMETRY); + return field->get_geometry_type(); + } friend class Item_default_value; friend class Item_insert_value; friend class st_select_lex_unit; @@ -1359,8 +1364,10 @@ class Item_param :public Item char cnvbuf[MAX_FIELD_WIDTH]; String cnvstr; Item *cnvitem; -public: + bool strict_type; + enum Item_result required_result_type; +public: enum enum_item_param_state { NO_VALUE, NULL_VALUE, INT_VALUE, REAL_VALUE, @@ -1488,6 +1495,11 @@ public: Otherwise return FALSE. */ bool eq(const Item *item, bool binary_cmp) const; + void set_strict_type(enum Item_result result_type_arg) + { + strict_type= TRUE; + required_result_type= result_type_arg; + } }; @@ -1752,11 +1764,17 @@ public: enum_field_types field_type() const { return MYSQL_TYPE_DATETIME; } }; +/** + Item_empty_string -- is a utility class to put an item into List + which is then used in protocol.send_fields() when sending SHOW output to + the client. +*/ + class Item_empty_string :public Item_string { public: Item_empty_string(const char *header,uint length, CHARSET_INFO *cs= NULL) : - Item_string("",0, cs ? cs : &my_charset_bin) + Item_string("",0, cs ? cs : &my_charset_utf8_general_ci) { name=(char*) header; max_length= cs ? length * cs->mbmaxlen : length; } void make_field(Send_field *field); }; @@ -1892,11 +1910,7 @@ public: enum_field_types field_type() const { return (*ref)->field_type(); } Field *get_tmp_table_field() { return result_field ? result_field : (*ref)->get_tmp_table_field(); } - Item *get_tmp_table_item(THD *thd) - { - return (result_field ? new Item_field(result_field) : - (*ref)->get_tmp_table_item(thd)); - } + Item *get_tmp_table_item(THD *thd); table_map used_tables() const { return depended_from ? OUTER_REF_TABLE_BIT : (*ref)->used_tables(); @@ -1975,6 +1989,12 @@ public: bool fix_fields(THD *, Item **); bool eq(const Item *item, bool binary_cmp) const; + Item *get_tmp_table_item(THD *thd) + { + Item *item= Item_ref::get_tmp_table_item(thd); + item->name= name; + return item; + } virtual Ref_Type ref_type() { return VIEW_REF; } }; @@ -2563,6 +2583,7 @@ class Item_type_holder: public Item protected: TYPELIB *enum_set_typelib; enum_field_types fld_type; + Field::geometry_type geometry_type; void get_full_info(Item *item); @@ -2582,6 +2603,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; }; }; diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 0de9ef3e9ad..ed0c09f0b32 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -507,7 +507,7 @@ int Arg_comparator::set_compare_func(Item_bool_func2 *item, Item_result type) { if ((*a)->decimals < NOT_FIXED_DEC && (*b)->decimals < NOT_FIXED_DEC) { - precision= 5 * log_01[max((*a)->decimals, (*b)->decimals)]; + precision= 5 / log_10[max((*a)->decimals, (*b)->decimals) + 1]; if (func == &Arg_comparator::compare_real) func= &Arg_comparator::compare_real_fixed; else if (func == &Arg_comparator::compare_e_real) @@ -766,7 +766,12 @@ get_datetime_value(THD *thd, Item ***item_arg, Item **cache_arg, { value= item->val_int(); *is_null= item->null_value; - if (item->field_type() == MYSQL_TYPE_DATE) + /* + Item_date_add_interval may return MYSQL_TYPE_STRING as the result + field type. To detect that the DATE value has been returned we + compare it with 1000000L - any DATE value should be less than it. + */ + if (item->field_type() == MYSQL_TYPE_DATE || value < 100000000L) value*= 1000000L; } else @@ -1750,6 +1755,23 @@ void Item_func_between::fix_length_and_dec() ge_cmp.set_datetime_cmp_func(args, args + 1); le_cmp.set_datetime_cmp_func(args, args + 2); } + else if (args[0]->real_item()->type() == FIELD_ITEM && + thd->lex->sql_command != SQLCOM_CREATE_VIEW && + thd->lex->sql_command != SQLCOM_SHOW_CREATE) + { + Field *field=((Item_field*) (args[0]->real_item()))->field; + if (field->can_be_compared_as_longlong()) + { + /* + The following can't be recoded with || as convert_constant_item + changes the argument + */ + if (convert_constant_item(thd, field,&args[1])) + cmp_type=INT_RESULT; // Works for all types. + if (convert_constant_item(thd, field,&args[2])) + cmp_type=INT_RESULT; // Works for all types. + } + } } diff --git a/sql/item_create.cc b/sql/item_create.cc index c4008d36aae..50db1c37371 100644 --- a/sql/item_create.cc +++ b/sql/item_create.cc @@ -418,6 +418,7 @@ Item *create_func_unhex(Item* a) Item *create_func_uuid(void) { + current_thd->lex->safe_to_cache_query= 0; return new Item_func_uuid(); } @@ -470,6 +471,18 @@ Item *create_func_cast(Item *a, Cast_target cast_type, my_error(ER_M_BIGGER_THAN_D, MYF(0), ""); return 0; } + if (len > DECIMAL_MAX_PRECISION) + { + my_error(ER_TOO_BIG_PRECISION, MYF(0), len, a->name, + DECIMAL_MAX_PRECISION); + return 0; + } + if (dec > DECIMAL_MAX_SCALE) + { + my_error(ER_TOO_BIG_SCALE, MYF(0), dec, a->name, + DECIMAL_MAX_SCALE); + return 0; + } res= new Item_decimal_typecast(a, len, dec); break; case ITEM_CAST_CHAR: diff --git a/sql/item_func.cc b/sql/item_func.cc index af4e96af37b..b256ce4624a 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -996,6 +996,8 @@ longlong Item_func_unsigned::val_int() my_decimal tmp, *dec= args[0]->val_decimal(&tmp); if (!(null_value= args[0]->null_value)) my_decimal2int(E_DEC_FATAL_ERROR, dec, 1, &value); + else + value= 0; return value; } else if (args[0]->cast_to_int_type() != STRING_RESULT || @@ -1521,16 +1523,20 @@ void Item_func_neg::fix_length_and_dec() Use val() to get value as arg_type doesn't mean that item is Item_int or Item_real due to existence of Item_param. */ - if (hybrid_type == INT_RESULT && - args[0]->type() == INT_ITEM && - ((ulonglong) args[0]->val_int() >= (ulonglong) LONGLONG_MIN)) + if (hybrid_type == INT_RESULT && args[0]->const_item()) { - /* - Ensure that result is converted to DECIMAL, as longlong can't hold - the negated number - */ - hybrid_type= DECIMAL_RESULT; - DBUG_PRINT("info", ("Type changed: DECIMAL_RESULT")); + longlong val= args[0]->val_int(); + if ((ulonglong) val >= (ulonglong) LONGLONG_MIN && + ((ulonglong) val != (ulonglong) LONGLONG_MIN || + args[0]->type() != INT_ITEM)) + { + /* + Ensure that result is converted to DECIMAL, as longlong can't hold + the negated number + */ + hybrid_type= DECIMAL_RESULT; + DBUG_PRINT("info", ("Type changed: DECIMAL_RESULT")); + } } unsigned_flag= 0; DBUG_VOID_RETURN; @@ -1955,7 +1961,13 @@ void Item_func_round::fix_length_and_dec() { max_length= args[0]->max_length; decimals= args[0]->decimals; - hybrid_type= REAL_RESULT; + if (args[0]->result_type() == DECIMAL_RESULT) + { + max_length++; + hybrid_type= DECIMAL_RESULT; + } + else + hybrid_type= REAL_RESULT; return; } @@ -2499,7 +2511,6 @@ longlong Item_func_coercibility::val_int() void Item_func_locate::fix_length_and_dec() { - maybe_null= 0; max_length= MY_INT32_NUM_DECIMAL_DIGITS; agg_arg_charsets(cmp_collation, args, 2, MY_COLL_CMP_CONV, 1); } @@ -3447,6 +3458,7 @@ longlong Item_func_get_lock::val_int() THD *thd=current_thd; User_level_lock *ull; int error; + DBUG_ENTER("Item_func_get_lock::val_int"); /* In slave thread no need to get locks, everything is serialized. Anyway @@ -3456,7 +3468,7 @@ longlong Item_func_get_lock::val_int() it's not guaranteed to be same as on master. */ if (thd->slave_thread) - return 1; + DBUG_RETURN(1); pthread_mutex_lock(&LOCK_user_locks); @@ -3464,8 +3476,10 @@ longlong Item_func_get_lock::val_int() { pthread_mutex_unlock(&LOCK_user_locks); null_value=1; - return 0; + DBUG_RETURN(0); } + DBUG_PRINT("info", ("lock %.*s, thd=%ld", res->length(), res->ptr(), + (long) thd->real_id)); null_value=0; if (thd->ull) @@ -3484,14 +3498,17 @@ longlong Item_func_get_lock::val_int() delete ull; pthread_mutex_unlock(&LOCK_user_locks); null_value=1; // Probably out of memory - return 0; + DBUG_RETURN(0); } ull->thread=thd->real_id; + ull->thread_id=thd->thread_id; thd->ull=ull; pthread_mutex_unlock(&LOCK_user_locks); - return 1; // Got new lock + DBUG_PRINT("info", ("made new lock")); + DBUG_RETURN(1); // Got new lock } ull->count++; + DBUG_PRINT("info", ("ull->count=%d", ull->count)); /* Structure is now initialized. Try to get the lock. @@ -3505,9 +3522,13 @@ longlong Item_func_get_lock::val_int() error= 0; while (ull->locked && !thd->killed) { + DBUG_PRINT("info", ("waiting on lock")); error= pthread_cond_timedwait(&ull->cond,&LOCK_user_locks,&abstime); if (error == ETIMEDOUT || error == ETIME) + { + DBUG_PRINT("info", ("lock wait timeout")); break; + } error= 0; } @@ -3531,6 +3552,7 @@ longlong Item_func_get_lock::val_int() ull->thread_id= thd->thread_id; thd->ull=ull; error=0; + DBUG_PRINT("info", ("got the lock")); } pthread_mutex_unlock(&LOCK_user_locks); @@ -3540,7 +3562,7 @@ longlong Item_func_get_lock::val_int() thd->mysys_var->current_cond= 0; pthread_mutex_unlock(&thd->mysys_var->mutex); - return !error ? 1 : 0; + DBUG_RETURN(!error ? 1 : 0); } @@ -3558,11 +3580,14 @@ longlong Item_func_release_lock::val_int() String *res=args[0]->val_str(&value); User_level_lock *ull; longlong result; + THD *thd=current_thd; + DBUG_ENTER("Item_func_release_lock::val_int"); if (!res || !res->length()) { null_value=1; - return 0; + DBUG_RETURN(0); } + DBUG_PRINT("info", ("lock %.*s", res->length(), res->ptr())); null_value=0; result=0; @@ -3575,19 +3600,20 @@ longlong Item_func_release_lock::val_int() } else { -#ifdef EMBEDDED_LIBRARY - if (ull->locked && pthread_equal(current_thd->real_id,ull->thread)) -#else - if (ull->locked && pthread_equal(pthread_self(),ull->thread)) -#endif + DBUG_PRINT("info", ("ull->locked=%d ull->thread=%ld thd=%ld", + (int) ull->locked, + (long)ull->thread, + (long)thd->real_id)); + if (ull->locked && pthread_equal(thd->real_id,ull->thread)) { + DBUG_PRINT("info", ("release lock")); result=1; // Release is ok item_user_lock_release(ull); - current_thd->ull=0; + thd->ull=0; } } pthread_mutex_unlock(&LOCK_user_locks); - return result; + DBUG_RETURN(result); } @@ -4061,8 +4087,8 @@ bool Item_func_set_user_var::check(bool use_result_field) { DBUG_ENTER("Item_func_set_user_var::check"); - if (use_result_field) - DBUG_ASSERT(result_field); + if (use_result_field && !result_field) + use_result_field= FALSE; switch (cached_result_type) { case REAL_RESULT: @@ -4206,6 +4232,40 @@ my_decimal *Item_func_set_user_var::val_decimal(my_decimal *val) } +double Item_func_set_user_var::val_result() +{ + DBUG_ASSERT(fixed == 1); + check(TRUE); + update(); // Store expression + return entry->val_real(&null_value); +} + +longlong Item_func_set_user_var::val_int_result() +{ + DBUG_ASSERT(fixed == 1); + check(TRUE); + update(); // Store expression + return entry->val_int(&null_value); +} + +String *Item_func_set_user_var::str_result(String *str) +{ + DBUG_ASSERT(fixed == 1); + check(TRUE); + update(); // Store expression + return entry->val_str(&null_value, str, decimals); +} + + +my_decimal *Item_func_set_user_var::val_decimal_result(my_decimal *val) +{ + DBUG_ASSERT(fixed == 1); + check(TRUE); + update(); // Store expression + return entry->val_decimal(&null_value, val); +} + + void Item_func_set_user_var::print(String *str) { str->append(STRING_WITH_LEN("(@")); @@ -4288,9 +4348,11 @@ void Item_func_set_user_var::make_field(Send_field *tmp_field) TRUE Error */ -int Item_func_set_user_var::save_in_field(Field *field, bool no_conversions) +int Item_func_set_user_var::save_in_field(Field *field, bool no_conversions, + bool can_use_result_field) { - bool use_result_field= (result_field && result_field != field); + bool use_result_field= (!can_use_result_field ? 0 : + (result_field && result_field != field)); int error; /* Update the value of the user variable */ @@ -5213,10 +5275,11 @@ Item_func_sp::func_name() const { THD *thd= current_thd; /* Calculate length to avoid reallocation of string for sure */ - uint len= ((m_name->m_explicit_name ? m_name->m_db.length : 0 + + uint len= (((m_name->m_explicit_name ? m_name->m_db.length : 0) + m_name->m_name.length)*2 + //characters*quoting 2 + // ` and ` - 1 + // . + (m_name->m_explicit_name ? + 3 : 0) + // '`', '`' and '.' for the db 1 + // end of string ALIGN_SIZE(1)); // to avoid String reallocation String qname((char *)alloc_root(thd->mem_root, len), len, @@ -5347,6 +5410,8 @@ Item_func_sp::execute() { null_value= 1; context->process_error(thd); + if (thd->killed) + thd->send_kill_message(); return TRUE; } diff --git a/sql/item_func.h b/sql/item_func.h index 1cffe9a934e..9a0201cb28b 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -1208,6 +1208,10 @@ public: longlong val_int(); String *val_str(String *str); my_decimal *val_decimal(my_decimal *); + double val_result(); + longlong val_int_result(); + String *str_result(String *str); + my_decimal *val_decimal_result(my_decimal *); bool update_hash(void *ptr, uint length, enum Item_result type, CHARSET_INFO *cs, Derivation dv, bool unsigned_arg); bool send(Protocol *protocol, String *str_arg); @@ -1220,7 +1224,13 @@ public: void print(String *str); void print_as_stmt(String *str); const char *func_name() const { return "set_user_var"; } - int save_in_field(Field *field, bool no_conversions); + int save_in_field(Field *field, bool no_conversions, + bool can_use_result_field); + int save_in_field(Field *field, bool no_conversions) + { + return save_in_field(field, no_conversions, 1); + } + void save_org_in_field(Field *field) { (void)save_in_field(field, 1, 0); } }; diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index f9a0f715985..0c24f14c8fe 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -1145,8 +1145,9 @@ String *Item_func_substr::val_str(String *str) (arg_count == 3 && args[2]->null_value)))) return 0; /* purecov: inspected */ - /* Negative length, will return empty string. */ - if ((arg_count == 3) && (length <= 0) && !args[2]->unsigned_flag) + /* Negative or zero length, will return empty string. */ + if ((arg_count == 3) && (length <= 0) && + (length == 0 || !args[2]->unsigned_flag)) return &my_empty_string; /* Assumes that the maximum length of a String is < INT_MAX32. */ @@ -3334,7 +3335,7 @@ String *Item_func_uuid::val_str(String *str) *--s=_dig_vec_lower[mac[i] >> 4]; } randominit(&uuid_rand, tmp + (ulong) server_start_time, - tmp + thd->status_var.bytes_sent); + tmp + (ulong) thd->status_var.bytes_sent); set_clock_seq_str(); } diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index 48b82e3cde6..0020dd35c61 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -775,6 +775,11 @@ bool Item_in_subselect::val_bool() if (exec()) { reset(); + /* + Must mark the IN predicate as NULL so as to make sure an enclosing NOT + predicate will return FALSE. See the comments in + subselect_uniquesubquery_engine::copy_ref_key for further details. + */ null_value= 1; return 0; } @@ -937,7 +942,8 @@ Item_in_subselect::single_value_transformer(JOIN *join, DBUG_RETURN(RES_ERROR); thd->lex->allow_sum_func= save_allow_sum_func; /* we added aggregate function => we have to change statistic */ - count_field_types(&join->tmp_table_param, join->all_fields, 0); + count_field_types(select_lex, &join->tmp_table_param, join->all_fields, + 0); subs= new Item_singlerow_subselect(select_lex); } @@ -1936,10 +1942,38 @@ int subselect_uniquesubquery_engine::scan_table() DESCRIPTION Copy ref key and check for null parts in it. + Depending on the nullability and conversion problems this function + recognizes and processes the following states : + 1. Partial match on top level. This means IN has a value of FALSE + regardless of the data in the subquery table. + Detected by finding a NULL in the left IN operand of a top level + expression. + We may actually skip reading the subquery, so return TRUE to skip + the table scan in subselect_uniquesubquery_engine::exec and make + the value of the IN predicate a NULL (that is equal to FALSE on + top level). + 2. No exact match when IN is nested inside another predicate. + Detected by finding a NULL in the left IN operand when IN is not + a top level predicate. + We cannot have an exact match. But we must proceed further with a + table scan to find out if it's a partial match (and IN has a value + of NULL) or no match (and IN has a value of FALSE). + So we return FALSE to continue with the scan and see if there are + any record that would constitute a partial match (as we cannot + determine that from the index). + 3. Error converting the left IN operand to the column type of the + right IN operand. This counts as no match (and IN has the value of + FALSE). We mark the subquery table cursor as having no more rows + (to ensure that the processing that follows will not find a match) + and return FALSE, so IN is not treated as returning NULL. + RETURN - FALSE - ok, index lookup key without keys copied. - TRUE - an error occured while copying the key + FALSE - The value of the IN predicate is not known. Proceed to find the + value of the IN predicate using the determined values of + null_keypart and table->status. + TRUE - IN predicate has a value of NULL. Stop the processing right there + and return NULL to the outer predicates. */ bool subselect_uniquesubquery_engine::copy_ref_key() @@ -1959,13 +1993,37 @@ bool subselect_uniquesubquery_engine::copy_ref_key() function. */ null_keypart= (*copy)->null_key; - bool top_level= ((Item_in_subselect *) item)->is_top_level_item(); - if (null_keypart && !top_level) - break; - if ((tab->ref.key_err) & 1 || (null_keypart && top_level)) + if (null_keypart) { + bool top_level= ((Item_in_subselect *) item)->is_top_level_item(); + if (top_level) + { + /* Partial match on top level */ + DBUG_RETURN(1); + } + else + { + /* No exact match when IN is nested inside another predicate */ + break; + } + } + + /* + Check if the error is equal to STORE_KEY_FATAL. This is not expressed + using the store_key::store_key_result enum because ref.key_err is a + boolean and we want to detect both TRUE and STORE_KEY_FATAL from the + space of the union of the values of [TRUE, FALSE] and + store_key::store_key_result. + TODO: fix the variable an return types. + */ + if (tab->ref.key_err & 1) + { + /* + Error converting the left IN operand to the column type of the right + IN operand. + */ tab->table->status= STATUS_NOT_FOUND; - DBUG_RETURN(1); + break; } } DBUG_RETURN(0); @@ -2008,10 +2066,20 @@ int subselect_uniquesubquery_engine::exec() int error; TABLE *table= tab->table; empty_result_set= TRUE; + table->status= 0; /* TODO: change to use of 'full_scan' here? */ 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_sum.cc b/sql/item_sum.cc index d6b31d43389..133f00039b0 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -432,7 +432,7 @@ Field *Item_sum::create_tmp_field(bool group, TABLE *table, 2-byte lenght. */ if (max_length/collation.collation->mbmaxlen > 255 && - convert_blob_length < UINT_MAX16 && convert_blob_length) + convert_blob_length <= Field_varstring::MAX_SIZE && convert_blob_length) return new Field_varstring(convert_blob_length, maybe_null, name, table, collation.collation); @@ -2461,7 +2461,7 @@ bool Item_sum_count_distinct::setup(THD *thd) } if (always_null) return FALSE; - count_field_types(tmp_table_param,list,0); + count_field_types(select_lex, tmp_table_param, list, 0); tmp_table_param->force_copy_fields= force_copy_fields; DBUG_ASSERT(table == 0); if (!(table= create_tmp_table(thd, tmp_table_param, list, (ORDER*) 0, 1, @@ -3209,6 +3209,27 @@ Item_func_group_concat::fix_fields(THD *thd, Item **ref) null_value= 1; max_length= thd->variables.group_concat_max_len; + uint32 offset; + if (separator->needs_conversion(separator->length(), separator->charset(), + collation.collation, &offset)) + { + uint32 buflen= collation.collation->mbmaxlen * separator->length(); + uint errors, conv_length; + char *buf; + String *new_separator; + + if (!(buf= thd->stmt_arena->alloc(buflen)) || + !(new_separator= new(thd->stmt_arena->mem_root) + String(buf, buflen, collation.collation))) + return TRUE; + + conv_length= copy_and_convert(buf, buflen, collation.collation, + separator->ptr(), separator->length(), + separator->charset(), &errors); + new_separator->length(conv_length); + separator= new_separator; + } + if (check_sum_func(thd, ref)) return TRUE; @@ -3265,18 +3286,24 @@ bool Item_func_group_concat::setup(THD *thd) setup_order(thd, args, context->table_list, list, all_fields, *order)) DBUG_RETURN(TRUE); - count_field_types(tmp_table_param,all_fields,0); + count_field_types(select_lex, tmp_table_param, all_fields, 0); tmp_table_param->force_copy_fields= force_copy_fields; DBUG_ASSERT(table == 0); + /* + Currently we have to force conversion of BLOB values to VARCHAR's + if we are to store them in TREE objects used for ORDER BY and + DISTINCT. This leads to truncation if the BLOB's size exceeds + Field_varstring::MAX_SIZE. + */ + if (arg_count_order > 0 || distinct) + set_if_smaller(tmp_table_param->convert_blob_length, + Field_varstring::MAX_SIZE); /* We have to create a temporary table to get descriptions of fields (types, sizes and so on). Note that in the table, we first have the ORDER BY fields, then the field list. - - We need to set set_sum_field in true for storing value of blob in buffer - of a record instead of a pointer of one. */ if (!(table= create_tmp_table(thd, tmp_table_param, all_fields, (ORDER*) 0, 0, TRUE, diff --git a/sql/item_sum.h b/sql/item_sum.h index 66c73e1d416..d18454cc3b8 100644 --- a/sql/item_sum.h +++ b/sql/item_sum.h @@ -966,8 +966,15 @@ public: bool fix_fields(THD *thd, Item **ref) { DBUG_ASSERT(fixed == 0); + + if (init_sum_func_check(thd)) + return TRUE; + fixed= 1; - return udf.fix_fields(thd, this, this->arg_count, this->args); + if (udf.fix_fields(thd, this, this->arg_count, this->args)) + return TRUE; + + return check_sum_func(thd, ref); } enum Sumfunctype sum_func () const { return UDF_SUM_FUNC; } virtual bool have_field_update(void) const { return 0; } diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index f5895369a55..9795ec5f413 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -51,7 +51,7 @@ static bool make_datetime(date_time_format_types format, MYSQL_TIME *ltime, { char *buff; CHARSET_INFO *cs= &my_charset_bin; - uint length= 30; + uint length= MAX_DATE_STRING_REP_LENGTH; if (str->alloc(length)) return 1; @@ -1400,7 +1400,7 @@ String *Item_date::val_str(String *str) MYSQL_TIME ltime; if (get_date(<ime, TIME_FUZZY_DATE)) return (String *) 0; - if (str->alloc(11)) + if (str->alloc(MAX_DATE_STRING_REP_LENGTH)) { null_value= 1; return (String *) 0; @@ -1449,7 +1449,7 @@ void Item_func_curdate::fix_length_and_dec() String *Item_func_curdate::val_str(String *str) { DBUG_ASSERT(fixed == 1); - if (str->alloc(11)) + if (str->alloc(MAX_DATE_STRING_REP_LENGTH)) { null_value= 1; return (String *) 0; @@ -1678,7 +1678,8 @@ String *Item_func_sec_to_time::val_str(String *str) MYSQL_TIME ltime; longlong arg_val= args[0]->val_int(); - if ((null_value=args[0]->null_value) || str->alloc(19)) + if ((null_value=args[0]->null_value) || + str->alloc(MAX_DATE_STRING_REP_LENGTH)) { null_value= 1; return (String*) 0; @@ -1863,6 +1864,10 @@ String *Item_func_date_format::val_str(String *str) size=max_length; else size=format_length(format); + + if (size < MAX_DATE_STRING_REP_LENGTH) + size= MAX_DATE_STRING_REP_LENGTH; + if (format == str) str= &value; // Save result here if (str->alloc(size)) @@ -1906,13 +1911,14 @@ String *Item_func_from_unixtime::val_str(String *str) if (get_date(&time_tmp, 0)) return 0; - if (str->alloc(20*MY_CHARSET_BIN_MB_MAXLEN)) + if (str->alloc(MAX_DATE_STRING_REP_LENGTH)) { null_value= 1; return 0; } make_datetime((DATE_TIME_FORMAT *) 0, &time_tmp, str); + return str; } @@ -1974,14 +1980,15 @@ String *Item_func_convert_tz::val_str(String *str) if (get_date(&time_tmp, 0)) return 0; - - if (str->alloc(20*MY_CHARSET_BIN_MB_MAXLEN)) + + if (str->alloc(MAX_DATE_STRING_REP_LENGTH)) { null_value= 1; return 0; } - + make_datetime((DATE_TIME_FORMAT *) 0, &time_tmp, str); + return str; } @@ -2180,27 +2187,6 @@ bool Item_date_add_interval::get_date(MYSQL_TIME *ltime, uint fuzzy_date) default: goto null_date; } - - /* Adjust cached_field_type according to the detected type. */ - if (cached_field_type == MYSQL_TYPE_STRING) - { - switch (ltime->time_type) - { - case MYSQL_TIMESTAMP_DATE: - cached_field_type= MYSQL_TYPE_DATE; - break; - case MYSQL_TIMESTAMP_DATETIME: - cached_field_type= MYSQL_TYPE_DATETIME; - break; - case MYSQL_TIMESTAMP_TIME: - cached_field_type= MYSQL_TYPE_TIME; - break; - default: - /* Shouldn't get here. */ - DBUG_ASSERT(0); - break; - } - } return 0; // Ok invalid_date: @@ -2582,6 +2568,7 @@ String *Item_datetime_typecast::val_str(String *str) { DBUG_ASSERT(fixed == 1); MYSQL_TIME ltime; + if (!get_arg0_date(<ime, TIME_FUZZY_DATE) && !make_datetime(ltime.second_part ? DATE_TIME_MICROSECOND : DATE_TIME, <ime, str)) @@ -2660,7 +2647,8 @@ String *Item_date_typecast::val_str(String *str) DBUG_ASSERT(fixed == 1); MYSQL_TIME ltime; - if (!get_arg0_date(<ime, TIME_FUZZY_DATE) && !str->alloc(11)) + if (!get_arg0_date(<ime, TIME_FUZZY_DATE) && + !str->alloc(MAX_DATE_STRING_REP_LENGTH)) { make_date((DATE_TIME_FORMAT *) 0, <ime, str); return str; @@ -2713,7 +2701,7 @@ String *Item_func_makedate::val_str(String *str) { null_value=0; get_date_from_daynr(days,&l_time.year,&l_time.month,&l_time.day); - if (str->alloc(11)) + if (str->alloc(MAX_DATE_STRING_REP_LENGTH)) goto err; make_date((DATE_TIME_FORMAT *) 0, &l_time, str); return str; @@ -2849,6 +2837,7 @@ String *Item_func_add_time::val_str(String *str) days= (long)(seconds/86400L); calc_time_from_sec(&l_time3, (long)(seconds%86400L), microseconds); + if (!is_time) { get_date_from_daynr(days,&l_time3.year,&l_time3.month,&l_time3.day); @@ -2964,7 +2953,7 @@ String *Item_func_maketime::val_str(String *str) args[2]->null_value || minute < 0 || minute > 59 || second < 0 || second > 59 || - str->alloc(19)))) + str->alloc(MAX_DATE_STRING_REP_LENGTH)))) return 0; bzero((char *)<ime, sizeof(ltime)); diff --git a/sql/lock.cc b/sql/lock.cc index 9298b33b4d2..93358e56701 100644 --- a/sql/lock.cc +++ b/sql/lock.cc @@ -178,6 +178,13 @@ MYSQL_LOCK *mysql_lock_tables(THD *thd, TABLE **tables, uint count, } else if (rc == 1) /* aborted */ { + /* + reset_lock_data is required here. If thr_multi_lock fails it + resets lock type for tables, which were locked before (and + including) one that caused error. Lock type for other tables + preserved. + */ + reset_lock_data(sql_lock); thd->some_tables_deleted=1; // Try again sql_lock->lock_count= 0; // Locks are already freed } diff --git a/sql/log.cc b/sql/log.cc index 818828f9557..744d2a3ca65 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -85,7 +85,7 @@ bool binlog_init() static int binlog_close_connection(THD *thd) { IO_CACHE *trans_log= (IO_CACHE*)thd->ha_data[binlog_hton.slot]; - DBUG_ASSERT(mysql_bin_log.is_open() && !my_b_tell(trans_log)); + DBUG_ASSERT(!my_b_tell(trans_log)); close_cached_file(trans_log); my_free((gptr)trans_log, MYF(0)); return 0; @@ -126,7 +126,7 @@ static int binlog_commit(THD *thd, bool all) { IO_CACHE *trans_log= (IO_CACHE*)thd->ha_data[binlog_hton.slot]; DBUG_ENTER("binlog_commit"); - DBUG_ASSERT(mysql_bin_log.is_open() && + DBUG_ASSERT( (all || !(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)))); if (my_b_tell(trans_log) == 0) @@ -134,7 +134,7 @@ static int binlog_commit(THD *thd, bool all) // we're here because trans_log was flushed in MYSQL_LOG::log_xid() DBUG_RETURN(0); } - if (all) + if (all) { Query_log_event qev(thd, STRING_WITH_LEN("COMMIT"), TRUE, FALSE); qev.error_code= 0; // see comment in MYSQL_LOG::write(THD, IO_CACHE) @@ -155,7 +155,7 @@ static int binlog_rollback(THD *thd, bool all) unnecessary, doing extra work. The cause should be found and eliminated */ DBUG_ASSERT(all || !(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))); - DBUG_ASSERT(mysql_bin_log.is_open() && my_b_tell(trans_log)); + DBUG_ASSERT(my_b_tell(trans_log)); /* Update the binary log with a BEGIN/ROLLBACK block if we have cached some queries and we updated some non-transactional @@ -198,7 +198,7 @@ static int binlog_savepoint_set(THD *thd, void *sv) { IO_CACHE *trans_log= (IO_CACHE*)thd->ha_data[binlog_hton.slot]; DBUG_ENTER("binlog_savepoint_set"); - DBUG_ASSERT(mysql_bin_log.is_open() && my_b_tell(trans_log)); + DBUG_ASSERT(my_b_tell(trans_log)); *(my_off_t *)sv= my_b_tell(trans_log); /* Write it to the binary log */ @@ -210,7 +210,7 @@ static int binlog_savepoint_rollback(THD *thd, void *sv) { IO_CACHE *trans_log= (IO_CACHE*)thd->ha_data[binlog_hton.slot]; DBUG_ENTER("binlog_savepoint_rollback"); - DBUG_ASSERT(mysql_bin_log.is_open() && my_b_tell(trans_log)); + DBUG_ASSERT(my_b_tell(trans_log)); /* Write ROLLBACK TO SAVEPOINT to the binlog cache if we have updated some @@ -1835,7 +1835,8 @@ bool MYSQL_LOG::write(THD *thd, IO_CACHE *cache, Log_event *commit_event) if (likely(is_open())) // Should always be true { - uint length; + uint length, group, carry, hdr_offs, val; + byte header[LOG_EVENT_HEADER_LEN]; /* Log "BEGIN" at the beginning of the transaction. @@ -1867,17 +1868,122 @@ bool MYSQL_LOG::write(THD *thd, IO_CACHE *cache, Log_event *commit_event) /* Read from the file used to cache the queries .*/ if (reinit_io_cache(cache, READ_CACHE, 0, 0, 0)) goto err; - length=my_b_bytes_in_cache(cache); + + length= my_b_bytes_in_cache(cache); DBUG_EXECUTE_IF("half_binlogged_transaction", length-=100;); + + /* + The events in the buffer have incorrect end_log_pos data + (relative to beginning of group rather than absolute), + so we'll recalculate them in situ so the binlog is always + correct, even in the middle of a group. This is possible + because we now know the start position of the group (the + offset of this cache in the log, if you will); all we need + to do is to find all event-headers, and add the position of + the group to the end_log_pos of each event. This is pretty + straight forward, except that we read the cache in segments, + so an event-header might end up on the cache-border and get + split. + */ + + group= (uint)my_b_tell(&log_file); + hdr_offs= carry= 0; + do { + + /* + if we only got a partial header in the last iteration, + get the other half now and process a full header. + */ + if (unlikely(carry > 0)) + { + DBUG_ASSERT(carry < LOG_EVENT_HEADER_LEN); + + /* assemble both halves */ + memcpy(&header[carry], (char *)cache->read_pos, LOG_EVENT_HEADER_LEN - carry); + + /* fix end_log_pos */ + val= uint4korr(&header[LOG_POS_OFFSET]) + group; + int4store(&header[LOG_POS_OFFSET], val); + + /* write the first half of the split header */ + if (my_b_write(&log_file, header, carry)) + goto err; + + /* + copy fixed second half of header to cache so the correct + version will be written later. + */ + memcpy((char *)cache->read_pos, &header[carry], LOG_EVENT_HEADER_LEN - carry); + + /* next event header at ... */ + hdr_offs = uint4korr(&header[EVENT_LEN_OFFSET]) - carry; + + carry= 0; + } + + /* if there is anything to write, process it. */ + + if (likely(length > 0)) + { + /* + process all event-headers in this (partial) cache. + if next header is beyond current read-buffer, + we'll get it later (though not necessarily in the + very next iteration, just "eventually"). + */ + + while (hdr_offs < length) + { + /* + partial header only? save what we can get, process once + we get the rest. + */ + + if (hdr_offs + LOG_EVENT_HEADER_LEN > length) + { + carry= length - hdr_offs; + memcpy(header, (char *)cache->read_pos + hdr_offs, carry); + length= hdr_offs; + } + else + { + /* we've got a full event-header, and it came in one piece */ + + uchar *log_pos= (uchar *)cache->read_pos + hdr_offs + LOG_POS_OFFSET; + + /* fix end_log_pos */ + val= uint4korr(log_pos) + group; + int4store(log_pos, val); + + /* next event header at ... */ + log_pos= (uchar *)cache->read_pos + hdr_offs + EVENT_LEN_OFFSET; + hdr_offs += uint4korr(log_pos); + + } + } + + /* + Adjust hdr_offs. Note that it may still point beyond the segment + read in the next iteration; if the current event is very long, + it may take a couple of read-iterations (and subsequent adjustments + of hdr_offs) for it to point into the then-current segment. + If we have a split header (!carry), hdr_offs will be set at the + beginning of the next iteration, overwriting the value we set here: + */ + hdr_offs -= length; + } + /* Write data to the binary log file */ if (my_b_write(&log_file, cache->read_pos, length)) - goto err; + goto err; cache->read_pos=cache->read_end; // Mark buffer used up DBUG_EXECUTE_IF("half_binlogged_transaction", goto DBUG_skip_commit;); } while ((length=my_b_fill(cache))); + DBUG_ASSERT(carry == 0); + if (commit_event->write(&log_file)) goto err; #ifndef DBUG_OFF diff --git a/sql/log_event.cc b/sql/log_event.cc index 173ca6232ee..c37df31ae00 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -1001,11 +1001,15 @@ void Log_event::print_header(FILE* file, PRINT_EVENT_INFO* print_event_info) } *c= '\0'; - /* Non-full last line */ if (hex_string[0]) + { + /* Non-full last line */ fprintf(file, "# %8.8lx %-48.48s |%s|\n# ", (unsigned long) (hexdump_from + (i & 0xfffffff0)), hex_string, char_string); + } + else + fprintf(file, "# "); } } @@ -1279,20 +1283,31 @@ Query_log_event::Query_log_event() /* - Query_log_event::Query_log_event() + SYNOPSIS + Query_log_event::Query_log_event() + thd - thread handle + query_arg - array of char representing the query + query_length - size of the `query_arg' array + using_trans - there is a modified transactional table + suppress_use - suppress the generation of 'USE' statements + killed_status_arg - an optional with default to THD::KILLED_NO_VALUE + if the value is different from the default, the arg + is set to the current thd->killed value. + A caller might need to masquerade thd->killed with + THD::NOT_KILLED. + DESCRIPTION + Creates an event for binlogging + The value for local `killed_status' can be supplied by caller. */ Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg, ulong query_length, bool using_trans, - bool suppress_use) + bool suppress_use, THD::killed_state killed_status_arg) :Log_event(thd_arg, ((thd_arg->tmp_table_used ? LOG_EVENT_THREAD_SPECIFIC_F : 0) | (suppress_use ? LOG_EVENT_SUPPRESS_USE_F : 0)), using_trans), data_buf(0), query(query_arg), catalog(thd_arg->catalog), db(thd_arg->db), q_len((uint32) query_length), - error_code((thd_arg->killed != THD::NOT_KILLED) ? - ((thd_arg->system_thread & SYSTEM_THREAD_DELAYED_INSERT) ? - 0 : thd->killed_errno()) : thd_arg->net.last_errno), thread_id(thd_arg->thread_id), /* save the original thread id; we already know the server id */ slave_proxy_id(thd_arg->variables.pseudo_thread_id), @@ -1304,6 +1319,14 @@ Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg, charset_database_number(0) { time_t end_time; + + if (killed_status_arg == THD::KILLED_NO_VALUE) + killed_status_arg= thd_arg->killed; + error_code= + (killed_status_arg == THD::NOT_KILLED) ? thd_arg->net.last_errno : + ((thd_arg->system_thread & SYSTEM_THREAD_DELAYED_INSERT) ? 0 : + thd->killed_errno()); + time(&end_time); exec_time = (ulong) (end_time - thd->start_time); catalog_len = (catalog) ? (uint32) strlen(catalog) : 0; @@ -1945,6 +1968,7 @@ Default database: '%s'. Query: '%s'", { DBUG_PRINT("info",("error ignored")); clear_all_errors(thd, rli); + thd->killed= THD::NOT_KILLED; } /* Other cases: mostly we expected no error and get one. @@ -3378,6 +3402,8 @@ int Rotate_log_event::exec_event(struct st_relay_log_info* rli) memcpy(rli->group_master_log_name, new_log_ident, ident_len+1); rli->notify_group_master_log_name_update(); rli->group_master_log_pos= pos; + strmake(rli->group_relay_log_name, rli->event_relay_log_name, + sizeof(rli->group_relay_log_name) - 1); rli->group_relay_log_pos= rli->event_relay_log_pos; DBUG_PRINT("info", ("group_master_log_name: '%s' group_master_log_pos:\ %lu", diff --git a/sql/log_event.h b/sql/log_event.h index a1e7adb6487..04aac5d08fc 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -804,7 +804,8 @@ public: #ifndef MYSQL_CLIENT Query_log_event(THD* thd_arg, const char* query_arg, ulong query_length, - bool using_trans, bool suppress_use); + bool using_trans, bool suppress_use, + THD::killed_state killed_err_arg= THD::KILLED_NO_VALUE); const char* get_db() { return db; } #ifdef HAVE_REPLICATION void pack_info(Protocol* protocol); diff --git a/sql/my_decimal.h b/sql/my_decimal.h index 2de8b9add11..c661579ea66 100644 --- a/sql/my_decimal.h +++ b/sql/my_decimal.h @@ -36,13 +36,17 @@ C_MODE_END /* maximum length of buffer in our big digits (uint32) */ #define DECIMAL_BUFF_LENGTH 9 + +/* the number of digits that my_decimal can possibly contain */ +#define DECIMAL_MAX_POSSIBLE_PRECISION (DECIMAL_BUFF_LENGTH * 9) + /* maximum guaranteed precision of number in decimal digits (number of our digits * number of decimal digits in one our big digit - number of decimal - digits in one our big digit decreased on 1 (because we always put decimal + digits in one our big digit decreased by 1 (because we always put decimal point on the border of our big digits)) */ -#define DECIMAL_MAX_PRECISION ((DECIMAL_BUFF_LENGTH * 9) - 8*2) +#define DECIMAL_MAX_PRECISION (DECIMAL_MAX_POSSIBLE_PRECISION - 8*2) #define DECIMAL_MAX_SCALE 30 #define DECIMAL_NOT_SPECIFIED 31 @@ -50,7 +54,7 @@ C_MODE_END maximum length of string representation (number of maximum decimal digits + 1 position for sign + 1 position for decimal point) */ -#define DECIMAL_MAX_STR_LENGTH (DECIMAL_MAX_PRECISION + 2) +#define DECIMAL_MAX_STR_LENGTH (DECIMAL_MAX_POSSIBLE_PRECISION + 2) /* maximum size of packet length */ diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index ea472691760..0aaa1744fe1 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -89,9 +89,6 @@ void kill_one_thread(THD *thd, ulong id, bool only_kill_query); bool net_request_file(NET* net, const char* fname); char* query_table_status(THD *thd,const char *db,const char *table_name); -void net_set_write_timeout(NET *net, uint timeout); -void net_set_read_timeout(NET *net, uint timeout); - #define x_free(A) { my_free((gptr) (A),MYF(MY_WME | MY_FAE | MY_ALLOW_ZERO_PTR)); } #define safeFree(x) { if(x) { my_free((gptr) x,MYF(0)); x = NULL; } } #define PREV_BITS(type,A) ((type) (((type) 1 << (A)) -1)) @@ -179,7 +176,7 @@ MY_LOCALE *my_locale_by_number(uint number); #define STACK_MIN_SIZE 12000 // Abort if less stack during eval. #define STACK_MIN_SIZE_FOR_OPEN 1024*80 -#define STACK_BUFF_ALLOC 256 // For stack overrun checks +#define STACK_BUFF_ALLOC 352 // For stack overrun checks #ifndef MYSQLD_NET_RETRY_COUNT #define MYSQLD_NET_RETRY_COUNT 10 // Abort read after this many int. #endif @@ -816,9 +813,8 @@ bool mysql_alter_table(THD *thd, char *new_db, char *new_name, Alter_info *alter_info, uint order_num, ORDER *order, bool ignore); bool mysql_recreate_table(THD *thd, TABLE_LIST *table_list); -bool mysql_create_like_table(THD *thd, TABLE_LIST *table, - HA_CREATE_INFO *create_info, - Table_ident *src_table); +bool mysql_create_like_table(THD *thd, TABLE_LIST *table, TABLE_LIST *src_table, + HA_CREATE_INFO *create_info); bool mysql_rename_table(enum db_type base, const char *old_db, const char * old_name, @@ -1272,8 +1268,6 @@ extern char language[FN_REFLEN], reg_ext[FN_EXTLEN]; extern char glob_hostname[FN_REFLEN], mysql_home[FN_REFLEN]; extern char pidfile_name[FN_REFLEN], system_time_zone[30], *opt_init_file; extern char log_error_file[FN_REFLEN], *opt_tc_log_file; -extern double log_10[32]; -extern double log_01[32]; extern ulonglong log_10_int[20]; extern ulonglong keybuff_size; extern ulonglong thd_startup_options; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 051bad5b310..61980fa1887 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -32,6 +32,9 @@ #ifdef HAVE_NDBCLUSTER_DB #include "ha_ndbcluster.h" #endif +#ifdef HAVE_SYS_PRCTL_H +#include +#endif #ifdef HAVE_INNOBASE_DB #define OPT_INNODB_DEFAULT 1 @@ -346,7 +349,15 @@ bool opt_endinfo, using_udf_functions; my_bool locked_in_memory; bool opt_using_transactions, using_update_log; bool volatile abort_loop; -bool volatile shutdown_in_progress, grant_option; +bool volatile shutdown_in_progress; +/** + @brief 'grant_option' is used to indicate if privileges needs + to be checked, in which case the lock, LOCK_grant, is used + to protect access to the grant table. + @note This flag is dropped in 5.1 + @see grant_init() + */ +bool volatile grant_option; my_bool opt_skip_slave_start = 0; // If set, slave is not autostarted my_bool opt_reckless_slave = 0; @@ -434,8 +445,6 @@ ulong slow_launch_threads = 0, sync_binlog_period; ulong expire_logs_days = 0; ulong rpl_recovery_rank=0; -double log_10[32]; /* 10 potences */ -double log_01[32]; time_t server_start_time; char mysql_home[FN_REFLEN], pidfile_name[FN_REFLEN], system_time_zone[30]; @@ -1365,6 +1374,15 @@ static struct passwd *check_user(const char *user) err: sql_print_error("Fatal error: Can't change to run as user '%s' ; Please check that the user exists!\n",user); unireg_abort(1); + +#ifdef PR_SET_DUMPABLE + if (test_flags & TEST_CORE_ON_SIGNAL) + { + /* inform kernel that process is dumpable */ + (void) prctl(PR_SET_DUMPABLE, 1); + } +#endif + #endif return NULL; } @@ -2148,6 +2166,16 @@ later when used with nscd), disable LDAP in your nsswitch.conf, or use a\n\ mysqld that is not statically linked.\n"); #endif +#ifdef HAVE_NPTL + if (thd_lib_detected == THD_LIB_LT && !getenv("LD_ASSUME_KERNEL")) + fprintf(stderr,"\n\ +You are running a statically-linked LinuxThreads binary on an NPTL system.\n\ +This can result in crashes on some distributions due to LT/NPTL conflicts.\n\ +You should either build a dynamically-linked binary, or force LinuxThreads\n\ +to be used with the LD_ASSUME_KERNEL environment variable. Please consult\n\ +the documentation for your distribution on how to do that.\n"); +#endif + if (locked_in_memory) { fprintf(stderr, "\n\ @@ -3574,6 +3602,11 @@ we force server id to 2, but this MySQL server will not act as a slave."); freopen(log_error_file,"a+",stderr); FreeConsole(); // Remove window } + else + { + /* Don't show error dialog box when on foreground: it stops the server */ + SetErrorMode(SEM_NOOPENFILEERRORBOX | SEM_FAILCRITICALERRORS); + } #endif /* @@ -4387,7 +4420,7 @@ pthread_handler_t handle_connections_shared_memory(void *arg) HANDLE event_connect_answer= 0; ulong smem_buffer_length= shared_memory_buffer_length + 4; ulong connect_number= 1; - char tmp[63]; + char *tmp= NULL; char *suffix_pos; char connect_number_char[22], *p; const char *errmsg= 0; @@ -4396,6 +4429,12 @@ pthread_handler_t handle_connections_shared_memory(void *arg) DBUG_ENTER("handle_connections_shared_memorys"); DBUG_PRINT("general",("Waiting for allocated shared memory.")); + /* + get enough space base-name + '_' + longest suffix we might ever send + */ + if (!(tmp= (char *)my_malloc(strlen(shared_memory_base_name) + 32L, MYF(MY_FAE)))) + goto error; + if (my_security_attr_create(&sa_event, &errmsg, GENERIC_ALL, SYNCHRONIZE | EVENT_MODIFY_STATE)) goto error; @@ -4583,6 +4622,9 @@ errorconn: /* End shared memory handling */ error: + if (tmp) + my_free(tmp, MYF(0)); + if (errmsg) { char buff[180]; @@ -5806,7 +5848,7 @@ log and this option does nothing anymore.", (gptr*) &dflt_key_cache_var.param_block_size, (gptr*) 0, 0, (GET_ULONG | GET_ASK_ADDR), REQUIRED_ARG, - KEY_CACHE_BLOCK_SIZE , 512, 1024*16, MALLOC_OVERHEAD, 512, 0}, + KEY_CACHE_BLOCK_SIZE, 512, 1024 * 16, 0, 512, 0}, {"key_cache_division_limit", OPT_KEY_CACHE_DIVISION_LIMIT, "The minimum percentage of warm blocks in key cache", (gptr*) &dflt_key_cache_var.param_division_limit, @@ -6177,8 +6219,8 @@ struct show_var_st status_vars[]= { {"Aborted_connects", (char*) &aborted_connects, SHOW_LONG}, {"Binlog_cache_disk_use", (char*) &binlog_cache_disk_use, SHOW_LONG}, {"Binlog_cache_use", (char*) &binlog_cache_use, SHOW_LONG}, - {"Bytes_received", (char*) offsetof(STATUS_VAR, bytes_received), SHOW_LONG_STATUS}, - {"Bytes_sent", (char*) offsetof(STATUS_VAR, bytes_sent), SHOW_LONG_STATUS}, + {"Bytes_received", (char*) offsetof(STATUS_VAR, bytes_received), SHOW_LONGLONG_STATUS}, + {"Bytes_sent", (char*) offsetof(STATUS_VAR, bytes_sent), SHOW_LONGLONG_STATUS}, {"Com_admin_commands", (char*) offsetof(STATUS_VAR, com_other), SHOW_LONG_STATUS}, {"Com_alter_db", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_ALTER_DB]), SHOW_LONG_STATUS}, {"Com_alter_table", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_ALTER_TABLE]), SHOW_LONG_STATUS}, @@ -7419,8 +7461,6 @@ static void get_options(int argc,char **argv) if (opt_short_log_format) opt_specialflag|= SPECIAL_SHORT_LOG_FORMAT; - if (opt_log_queries_not_using_indexes) - opt_specialflag|= SPECIAL_LOG_QUERIES_NOT_USING_INDEXES; if (init_global_datetime_format(MYSQL_TIMESTAMP_DATE, &global_system_variables.date_format) || diff --git a/sql/net_serv.cc b/sql/net_serv.cc index a635d058cd5..017a2eb9ecd 100644 --- a/sql/net_serv.cc +++ b/sql/net_serv.cc @@ -120,13 +120,13 @@ static my_bool net_write_buff(NET *net,const char *packet,ulong len); my_bool my_net_init(NET *net, Vio* vio) { DBUG_ENTER("my_net_init"); + net->vio = vio; my_net_local_init(net); /* Set some limits */ if (!(net->buff=(uchar*) my_malloc((uint32) net->max_packet+ NET_HEADER_SIZE + COMP_HEADER_SIZE, MYF(MY_WME)))) DBUG_RETURN(1); net->buff_end=net->buff+net->max_packet; - net->vio = vio; net->no_send_ok= net->no_send_eof= net->no_send_error= 0; net->error=0; net->return_errno=0; net->return_status=0; net->pkt_nr=net->compress_pkt_nr=0; @@ -609,10 +609,10 @@ net_real_write(NET *net,const char *packet,ulong len) #ifndef NO_ALARM thr_alarm_init(&alarmed); if (net_blocking) - thr_alarm(&alarmed,(uint) net->write_timeout,&alarm_buff); + thr_alarm(&alarmed, net->write_timeout, &alarm_buff); #else alarmed=0; - /* Write timeout is set in net_set_write_timeout */ + /* Write timeout is set in my_net_set_write_timeout */ #endif /* NO_ALARM */ pos=(char*) packet; end=pos+len; @@ -624,7 +624,7 @@ net_real_write(NET *net,const char *packet,ulong len) #if (!defined(__WIN__) && !defined(__EMX__) && !defined(OS2)) if ((interrupted || length==0) && !thr_alarm_in_use(&alarmed)) { - if (!thr_alarm(&alarmed,(uint) net->write_timeout,&alarm_buff)) + if (!thr_alarm(&alarmed, net->write_timeout, &alarm_buff)) { /* Always true for client */ my_bool old_mode; while (vio_blocking(net->vio, TRUE, &old_mode) < 0) @@ -805,7 +805,7 @@ my_real_read(NET *net, ulong *complen) if (net_blocking) thr_alarm(&alarmed,net->read_timeout,&alarm_buff); #else - /* Read timeout is set in net_set_read_timeout */ + /* Read timeout is set in my_net_set_read_timeout */ #endif /* NO_ALARM */ pos = net->buff + net->where_b; /* net->packet -4 */ @@ -1117,25 +1117,27 @@ my_net_read(NET *net) } -void net_set_read_timeout(NET *net, uint timeout) +void my_net_set_read_timeout(NET *net, uint timeout) { - DBUG_ENTER("net_set_read_timeout"); + DBUG_ENTER("my_net_set_read_timeout"); DBUG_PRINT("enter", ("timeout: %d", timeout)); net->read_timeout= timeout; #ifdef NO_ALARM - vio_timeout(net->vio, 0, timeout); + if (net->vio) + vio_timeout(net->vio, 0, timeout); #endif DBUG_VOID_RETURN; } -void net_set_write_timeout(NET *net, uint timeout) +void my_net_set_write_timeout(NET *net, uint timeout) { - DBUG_ENTER("net_set_write_timeout"); + DBUG_ENTER("my_net_set_write_timeout"); DBUG_PRINT("enter", ("timeout: %d", timeout)); net->write_timeout= timeout; #ifdef NO_ALARM - vio_timeout(net->vio, 1, timeout); + if (net->vio) + vio_timeout(net->vio, 1, timeout); #endif DBUG_VOID_RETURN; } diff --git a/sql/set_var.cc b/sql/set_var.cc index 8808327ce0a..09cdc34f803 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -1226,7 +1226,11 @@ static void sys_default_ftb_syntax(THD *thd, enum_var_type type) static void fix_low_priority_updates(THD *thd, enum_var_type type) { - if (type != OPT_GLOBAL) + if (type == OPT_GLOBAL) + thr_upgraded_concurrent_insert_lock= + (global_system_variables.low_priority_updates ? + TL_WRITE_LOW_PRIORITY : TL_WRITE); + else thd->update_lock_default= (thd->variables.low_priority_updates ? TL_WRITE_LOW_PRIORITY : TL_WRITE); } @@ -1291,14 +1295,14 @@ static int check_completion_type(THD *thd, set_var *var) static void fix_net_read_timeout(THD *thd, enum_var_type type) { if (type != OPT_GLOBAL) - net_set_read_timeout(&thd->net, thd->variables.net_read_timeout); + my_net_set_read_timeout(&thd->net, thd->variables.net_read_timeout); } static void fix_net_write_timeout(THD *thd, enum_var_type type) { if (type != OPT_GLOBAL) - net_set_write_timeout(&thd->net, thd->variables.net_write_timeout); + my_net_set_write_timeout(&thd->net, thd->variables.net_write_timeout); } static void fix_net_retry_count(THD *thd, enum_var_type type) diff --git a/sql/share/errmsg.txt b/sql/share/errmsg.txt index 1230287656e..a52ffa8216c 100644 --- a/sql/share/errmsg.txt +++ b/sql/share/errmsg.txt @@ -5633,4 +5633,5 @@ ER_WRONG_STRING_LENGTH eng "String '%-.70s' is too long for %s (should be no longer than %d)" ER_NON_INSERTABLE_TABLE eng "The target table %-.100s of the %s is not insertable-into" - +ER_ADMIN_WRONG_MRG_TABLE + eng "Table '%-.64s' is differently defined or of non-MyISAM type or doesn't exist" diff --git a/sql/slave.cc b/sql/slave.cc index 84f409d7f34..c1b0d655bea 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -26,6 +26,7 @@ #include #include #include +#include #define MAX_SLAVE_RETRY_PAUSE 5 bool use_slave_mask = 0; @@ -3611,22 +3612,25 @@ after reconnect"); if (event_len == packet_error) { - uint mysql_error_number= mysql_errno(mysql); - if (mysql_error_number == CR_NET_PACKET_TOO_LARGE) - { - sql_print_error("\ + uint mysql_error_number= mysql_errno(mysql); + switch (mysql_error_number) { + case CR_NET_PACKET_TOO_LARGE: + sql_print_error("\ Log entry on master is longer than max_allowed_packet (%ld) on \ slave. If the entry is correct, restart the server with a higher value of \ max_allowed_packet", - thd->variables.max_allowed_packet); - goto err; - } - if (mysql_error_number == ER_MASTER_FATAL_ERROR_READING_BINLOG) - { - sql_print_error(ER(mysql_error_number), mysql_error_number, - mysql_error(mysql)); - goto err; - } + thd->variables.max_allowed_packet); + goto err; + case ER_MASTER_FATAL_ERROR_READING_BINLOG: + sql_print_error(ER(mysql_error_number), mysql_error_number, + mysql_error(mysql)); + goto err; + case EE_OUTOFMEMORY: + case ER_OUTOFMEMORY: + sql_print_error("\ +Stopping slave I/O thread due to out-of-memory error from master"); + goto err; + } mi->slave_running= MYSQL_SLAVE_RUN_NOT_CONNECT; thd->proc_info = "Waiting to reconnect after a failed master event read"; #ifdef SIGNAL_WITH_VIO_CLOSE diff --git a/sql/sp.cc b/sql/sp.cc index de786a77275..d28e9138fa8 100644 --- a/sql/sp.cc +++ b/sql/sp.cc @@ -438,10 +438,10 @@ db_load_routine(THD *thd, int type, sp_name *name, sp_head **sphp, Lex_input_stream lip(thd, defstr.c_ptr(), defstr.length()); thd->m_lip= &lip; lex_start(thd); + thd->spcont= NULL; ret= MYSQLparse(thd); } - thd->spcont= 0; if (ret || thd->is_fatal_error || newlex.sphead == NULL) { sp_head *sp= newlex.sphead; diff --git a/sql/sp_head.cc b/sql/sp_head.cc index 835d8bf038f..d939fd20b9b 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -539,7 +539,7 @@ sp_head::init_strings(THD *thd, LEX *lex) Trim "garbage" at the end. This is sometimes needed with the "/ * ! VERSION... * /" wrapper in dump files. */ - endp= skip_rear_comments((char*) m_body_begin, (char*) endp); + endp= skip_rear_comments(thd->charset(), (char*) m_body_begin, (char*) endp); m_body.length= endp - m_body_begin; m_body.str= strmake_root(root, m_body_begin, m_body.length); @@ -1321,6 +1321,9 @@ err_with_cleanup: free_root(&call_mem_root, MYF(0)); thd->spcont= octx; + if (thd->killed) + thd->send_kill_message(); + DBUG_RETURN(err_status); } @@ -2578,7 +2581,7 @@ sp_instr_set::exec_core(THD *thd, uint *nextp) sp_rcontext *spcont= thd->spcont; - thd->spcont= 0; /* Avoid handlers */ + thd->spcont= NULL; /* Avoid handlers */ my_error(ER_OUT_OF_RESOURCES, MYF(0)); spcont->clear_handler(); thd->spcont= spcont; @@ -3313,7 +3316,7 @@ sp_instr_set_case_expr::exec_core(THD *thd, uint *nextp) sp_rcontext *spcont= thd->spcont; - thd->spcont= 0; /* Avoid handlers */ + thd->spcont= NULL; /* Avoid handlers */ my_error(ER_OUT_OF_RESOURCES, MYF(0)); spcont->clear_handler(); thd->spcont= spcont; diff --git a/sql/spatial.cc b/sql/spatial.cc index 939e7d2a3b4..69d0c15748a 100644 --- a/sql/spatial.cc +++ b/sql/spatial.cc @@ -17,7 +17,28 @@ #ifdef HAVE_SPATIAL -#define MAX_DIGITS_IN_DOUBLE 16 +/* + exponential notation : + 1 sign + 1 number before the decimal point + 1 decimal point + 14 number of significant digits (see String::qs_append(double)) + 1 'e' sign + 1 exponent sign + 3 exponent digits + == + 22 + + "f" notation : + 1 optional 0 + 1 sign + 14 number significant digits (see String::qs_append(double) ) + 1 decimal point + == + 17 +*/ + +#define MAX_DIGITS_IN_DOUBLE 22 /***************************** Gis_class_info *******************************/ diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index ebf9385d177..f9bd2c6ba0d 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -978,14 +978,15 @@ bool acl_getroot_no_password(Security_context *sctx, char *user, char *host, */ for (i=0 ; i < acl_users.elements ; i++) { - acl_user= dynamic_element(&acl_users,i,ACL_USER*); - if ((!acl_user->user && !user[0]) || - (acl_user->user && strcmp(user, acl_user->user) == 0)) + ACL_USER *acl_user_tmp= dynamic_element(&acl_users,i,ACL_USER*); + if ((!acl_user_tmp->user && !user[0]) || + (acl_user_tmp->user && strcmp(user, acl_user_tmp->user) == 0)) { - if (compare_hostname(&acl_user->host, host, ip)) + if (compare_hostname(&acl_user_tmp->host, host, ip)) { - res= 0; - break; + acl_user= acl_user_tmp; + res= 0; + break; } } } @@ -2995,7 +2996,7 @@ bool mysql_table_grant(THD *thd, TABLE_LIST *table_list, } } } - grant_option=TRUE; + thd->mem_root= old_root; pthread_mutex_unlock(&acl_cache->lock); @@ -3162,7 +3163,7 @@ bool mysql_routine_grant(THD *thd, TABLE_LIST *table_list, bool is_proc, continue; } } - grant_option=TRUE; + thd->mem_root= old_root; pthread_mutex_unlock(&acl_cache->lock); if (!result && !no_error) @@ -3338,6 +3339,8 @@ my_bool grant_init() delete thd; /* Remember that we don't have a THD */ my_pthread_setspecific_ptr(THR_THD, 0); + /* Set the grant option flag so we will check grants */ + grant_option= TRUE; DBUG_RETURN(return_val); } @@ -3367,7 +3370,6 @@ static my_bool grant_load(TABLE_LIST *tables) THR_MALLOC); DBUG_ENTER("grant_load"); - grant_option = FALSE; (void) hash_init(&column_priv_hash,system_charset_info, 0,0,0, (hash_get_key) get_grant_table, (hash_free_key) free_grant_table,0); @@ -3478,7 +3480,6 @@ static my_bool grant_load(TABLE_LIST *tables) } while (!p_table->file->index_next(p_table->record[0])); } - grant_option= TRUE; return_val=0; // Return ok end_unlock: @@ -3511,7 +3512,6 @@ my_bool grant_reload(THD *thd) { TABLE_LIST tables[3]; HASH old_column_priv_hash, old_proc_priv_hash, old_func_priv_hash; - bool old_grant_option; MEM_ROOT old_mem; my_bool return_val= 1; DBUG_ENTER("grant_reload"); @@ -3541,7 +3541,6 @@ my_bool grant_reload(THD *thd) old_column_priv_hash= column_priv_hash; old_proc_priv_hash= proc_priv_hash; old_func_priv_hash= func_priv_hash; - old_grant_option= grant_option; old_mem= memex; if ((return_val= grant_load(tables))) @@ -3551,7 +3550,6 @@ my_bool grant_reload(THD *thd) column_priv_hash= old_column_priv_hash; /* purecov: deadcode */ proc_priv_hash= old_proc_priv_hash; func_priv_hash= old_func_priv_hash; - grant_option= old_grant_option; /* purecov: deadcode */ memex= old_mem; /* purecov: deadcode */ } else @@ -5380,6 +5378,12 @@ bool mysql_drop_user(THD *thd, List &list) VOID(pthread_mutex_unlock(&acl_cache->lock)); + if (result) + my_error(ER_CANNOT_USER, MYF(0), "DROP USER", wrong_users.c_ptr_safe()); + + DBUG_PRINT("info", ("thd->net.last_errno: %d", thd->net.last_errno)); + DBUG_PRINT("info", ("thd->net.last_error: %s", thd->net.last_error)); + if (mysql_bin_log.is_open()) { Query_log_event qinfo(thd, thd->query, thd->query_length, 0, FALSE); @@ -5388,8 +5392,6 @@ bool mysql_drop_user(THD *thd, List &list) rw_unlock(&LOCK_grant); close_thread_tables(thd); - if (result) - my_error(ER_CANNOT_USER, MYF(0), "DROP USER", wrong_users.c_ptr_safe()); DBUG_RETURN(result); } diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 16a88346bb6..ed006714143 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -1505,6 +1505,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root, HASH_SEARCH_STATE state; DBUG_ENTER("open_table"); + DBUG_ASSERT (table_list->lock_type != TL_WRITE_DEFAULT); /* find a unused table in the open table cache */ if (refresh) *refresh=0; @@ -1669,10 +1670,17 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root, VOID(pthread_mutex_unlock(&LOCK_open)); } } - if ((thd->locked_tables) && (thd->locked_tables->lock_count > 0)) - my_error(ER_TABLE_NOT_LOCKED, MYF(0), alias); - else + /* + No table in the locked tables list. In case of explicit LOCK TABLES + this can happen if a user did not include the able into the list. + In case of pre-locked mode locked tables list is generated automatically, + so we may only end up here if the table did not exist when + locked tables list was created. + */ + if (thd->prelocked_mode == PRELOCKED) my_error(ER_NO_SUCH_TABLE, MYF(0), table_list->db, table_list->alias); + else + my_error(ER_TABLE_NOT_LOCKED, MYF(0), alias); DBUG_RETURN(0); } @@ -2667,6 +2675,12 @@ int open_tables(THD *thd, TABLE_LIST **start, uint *counter, uint flags) for (tables= *start; tables ;tables= tables->next_global) { safe_to_ignore_table= FALSE; // 'FALSE', as per coding style + + if (tables->lock_type == TL_WRITE_DEFAULT) + { + tables->lock_type= thd->update_lock_default; + DBUG_ASSERT (tables->lock_type >= TL_WRITE_ALLOW_WRITE); + } /* Ignore placeholders for derived tables. After derived tables processing, link to created temporary table will be put here. @@ -5167,7 +5181,12 @@ bool setup_tables(THD *thd, Name_resolution_context *context, get_key_map_from_key_list(&map, table, table_list->use_index); if (map.is_set_all()) DBUG_RETURN(1); - table->keys_in_use_for_query=map; + /* + Don't introduce keys in keys_in_use_for_query that weren't there + before. FORCE/USE INDEX should not add keys, it should only remove + all keys except the key(s) specified in the hint. + */ + table->keys_in_use_for_query.intersect(map); } if (table_list->ignore_index) { @@ -5800,7 +5819,7 @@ fill_record(THD *thd, Field **ptr, List &values, bool ignore_errors) table= (*ptr)->table; table->auto_increment_field_not_null= FALSE; } - while ((field = *ptr++)) + while ((field = *ptr++) && !thd->net.report_error) { value=v++; table= field->table; diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 010dc101e0d..036ba217a9b 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -1209,6 +1209,8 @@ select_export::prepare(List &list, SELECT_LEX_UNIT *u) field_sep_char= (exchange->enclosed->length() ? (*exchange->enclosed)[0] : field_term_length ? (*exchange->field_term)[0] : INT_MAX); 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)); line_sep_char= (exchange->line_term->length() ? (*exchange->line_term)[0] : INT_MAX); if (!field_term_length) @@ -1221,6 +1223,11 @@ select_export::prepare(List &list, SELECT_LEX_UNIT *u) } +#define NEED_ESCAPING(x) ((int) (uchar) (x) == escape_char || \ + (int) (uchar) (x) == field_sep_char || \ + (int) (uchar) (x) == line_sep_char || \ + !(x)) + bool select_export::send_data(List &items) { @@ -1278,16 +1285,23 @@ bool select_export::send_data(List &items) used_length=min(res->length(),item->max_length); else used_length=res->length(); - if (result_type == STRING_RESULT && escape_char != -1) + if ((result_type == STRING_RESULT || is_unsafe_field_sep) && + escape_char != -1) { - char *pos,*start,*end; - + char *pos, *start, *end; + CHARSET_INFO *res_charset= res->charset(); + CHARSET_INFO *character_set_client= thd->variables. + character_set_client; + bool check_second_byte= (res_charset == &my_charset_bin) && + character_set_client-> + escape_with_backslash_is_dangerous; + DBUG_ASSERT(character_set_client->mbmaxlen == 2 || + !character_set_client->escape_with_backslash_is_dangerous); for (start=pos=(char*) res->ptr(),end=pos+used_length ; pos != end ; pos++) { #ifdef USE_MB - CHARSET_INFO *res_charset=res->charset(); if (use_mb(res_charset)) { int l; @@ -1298,11 +1312,49 @@ bool select_export::send_data(List &items) } } #endif - if ((int) *pos == escape_char || (int) *pos == field_sep_char || - (int) *pos == line_sep_char || !*pos) - { + + /* + Special case when dumping BINARY/VARBINARY/BLOB values + for the clients with character sets big5, cp932, gbk and sjis, + which can have the escape character (0x5C "\" by default) + as the second byte of a multi-byte sequence. + + If + - pos[0] is a valid multi-byte head (e.g 0xEE) and + - pos[1] is 0x00, which will be escaped as "\0", + + then we'll get "0xEE + 0x5C + 0x30" in the output file. + + If this file is later loaded using this sequence of commands: + + mysql> create table t1 (a varchar(128)) character set big5; + mysql> LOAD DATA INFILE 'dump.txt' INTO TABLE t1; + + then 0x5C will be misinterpreted as the second byte + of a multi-byte character "0xEE + 0x5C", instead of + escape character for 0x00. + + To avoid this confusion, we'll escape the multi-byte + head character too, so the sequence "0xEE + 0x00" will be + dumped as "0x5C + 0xEE + 0x5C + 0x30". + + Note, in the condition below we only check if + mbcharlen is equal to 2, because there are no + character sets with mbmaxlen longer than 2 + and with escape_with_backslash_is_dangerous set. + 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]))) + { char tmp_buff[2]; - tmp_buff[0]= escape_char; + tmp_buff[0]= ((int) *pos == field_sep_char && + is_ambiguous_field_sep) ? + field_sep_char : escape_char; tmp_buff[1]= *pos ? *pos : '0'; if (my_b_write(&cache,(byte*) start,(uint) (pos-start)) || my_b_write(&cache,(byte*) tmp_buff,2)) diff --git a/sql/sql_class.h b/sql/sql_class.h index bef679806d0..a5cbc21684f 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -606,8 +606,8 @@ struct system_variables typedef struct system_status_var { - ulong bytes_received; - ulong bytes_sent; + ulonglong bytes_received; + ulonglong bytes_sent; ulong com_other; ulong com_stat[(uint) SQLCOM_END]; ulong created_tmp_disk_tables; @@ -697,6 +697,13 @@ public: #ifndef DBUG_OFF bool is_backup_arena; /* True if this arena is used for backup. */ #endif + /* + The states relfects three diffrent life cycles for three + different types of statements: + Prepared statement: INITIALIZED -> PREPARED -> EXECUTED. + Stored procedure: INITIALIZED_FOR_SP -> EXECUTED. + Other statements: CONVENTIONAL_EXECUTION never changes. + */ enum enum_state { INITIALIZED= 0, INITIALIZED_FOR_SP= 1, PREPARED= 2, @@ -1397,7 +1404,14 @@ public: DYNAMIC_ARRAY user_var_events; /* For user variables replication */ MEM_ROOT *user_var_events_alloc; /* Allocate above array elements here */ - enum killed_state { NOT_KILLED=0, KILL_BAD_DATA=1, KILL_CONNECTION=ER_SERVER_SHUTDOWN, KILL_QUERY=ER_QUERY_INTERRUPTED }; + enum killed_state + { + NOT_KILLED=0, + KILL_BAD_DATA=1, + KILL_CONNECTION=ER_SERVER_SHUTDOWN, + KILL_QUERY=ER_QUERY_INTERRUPTED, + KILLED_NO_VALUE /* means neither of the states */ + }; killed_state volatile killed; /* scramble - random string sent to client on handshake */ @@ -1670,7 +1684,8 @@ public: void end_statement(); inline int killed_errno() const { - return killed != KILL_BAD_DATA ? killed : 0; + killed_state killed_val; /* to cache the volatile 'killed' */ + return (killed_val= killed) != KILL_BAD_DATA ? killed_val : 0; } inline void send_kill_message() const { @@ -1911,9 +1926,30 @@ public: }; +#define ESCAPE_CHARS "ntrb0ZN" // keep synchronous with READ_INFO::unescape + + +/* + List of all possible characters of a numeric value text representation. +*/ +#define NUMERIC_CHARS ".0123456789e+-" + + class select_export :public select_to_file { uint field_term_length; int field_sep_char,escape_char,line_sep_char; + /* + 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_unsafe_field_sep field is true if a value of the field_sep_char + field is one of the '0'..'9', '+', '-', '.' and 'e' characters + (see the NUMERIC_CHARS constant value). + */ + bool is_unsafe_field_sep; bool fixed_row_size; public: select_export(sql_exchange *ex) :select_to_file(ex) {} @@ -1951,6 +1987,7 @@ class select_insert :public select_result_interceptor { virtual void store_values(List &values); void send_error(uint errcode,const char *err); bool send_eof(); + void abort(); /* not implemented: select_insert is never re-used in prepared statements */ void cleanup(); }; @@ -2283,6 +2320,11 @@ class multi_update :public select_result_interceptor List *fields, *values; List **fields_for_table, **values_for_table; uint table_count; + /* + List of tables referenced in the CHECK OPTION condition of + the updated view excluding the updated table. + */ + List unupdated_check_opt_tables; Copy_field *copy_field; enum enum_duplicates handle_duplicates; bool do_update, trans_safe; diff --git a/sql/sql_client.cc b/sql/sql_client.cc index d6f1183806e..032a2e26e3a 100644 --- a/sql/sql_client.cc +++ b/sql/sql_client.cc @@ -28,8 +28,11 @@ void my_net_local_init(NET *net) { #ifndef EMBEDDED_LIBRARY net->max_packet= (uint) global_system_variables.net_buffer_length; - net->read_timeout= (uint) global_system_variables.net_read_timeout; - net->write_timeout=(uint) global_system_variables.net_write_timeout; + + my_net_set_read_timeout(net, (uint)global_system_variables.net_read_timeout); + my_net_set_write_timeout(net, + (uint)global_system_variables.net_write_timeout); + net->retry_count= (uint) global_system_variables.net_retry_count; net->max_packet_size= max(global_system_variables.net_buffer_length, global_system_variables.max_allowed_packet); diff --git a/sql/sql_error.cc b/sql/sql_error.cc index 61a7581908c..344a0c00db8 100644 --- a/sql/sql_error.cc +++ b/sql/sql_error.cc @@ -126,7 +126,7 @@ MYSQL_ERROR *push_warning(THD *thd, MYSQL_ERROR::enum_warning_level level, sp_rcontext *spcont= thd->spcont; thd->no_warnings_for_error= 1; - thd->spcont= 0; + thd->spcont= NULL; thd->killed= THD::KILL_BAD_DATA; my_message(code, msg, MYF(0)); @@ -205,8 +205,8 @@ void push_warning_printf(THD *thd, MYSQL_ERROR::enum_warning_level level, TRUE Error sending data to client */ -static const char *warning_level_names[]= {"Note", "Warning", "Error", "?"}; -static int warning_level_length[]= { 4, 7, 5, 1 }; +const char *warning_level_names[]= {"Note", "Warning", "Error", "?"}; +int warning_level_length[]= { 4, 7, 5, 1 }; bool mysqld_show_warnings(THD *thd, ulong levels_to_show) { diff --git a/sql/sql_error.h b/sql/sql_error.h index 28d946f14f8..4dbf3ada8f0 100644 --- a/sql/sql_error.h +++ b/sql/sql_error.h @@ -39,3 +39,5 @@ void push_warning_printf(THD *thd, MYSQL_ERROR::enum_warning_level level, uint code, const char *format, ...); void mysql_reset_errors(THD *thd, bool force); bool mysqld_show_warnings(THD *thd, ulong levels_to_show); +extern const char *warning_level_names[]; +extern int warning_level_length[]; diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 5720758128e..73f8c5e4418 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -715,6 +715,8 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list, */ table->file->extra(HA_EXTRA_RETRIEVE_ALL_COLS); } + if (duplic == DUP_UPDATE) + table->file->extra(HA_EXTRA_INSERT_WITH_UPDATE); /* let's *try* to start bulk inserts. It won't necessary start them as values_list.elements should be greater than @@ -870,9 +872,35 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list, if (mysql_bin_log.is_open()) { if (error <= 0) + { + /* + [Guilhem wrote] Temporary errors may have filled + thd->net.last_error/errno. For example if there has + been a disk full error when writing the row, and it was + MyISAM, then thd->net.last_error/errno will be set to + "disk full"... and the my_pwrite() will wait until free + space appears, and so when it finishes then the + write_row() was entirely successful + */ + /* todo: consider removing */ thd->clear_error(); + } + /* bug#22725: + + A query which per-row-loop can not be interrupted with + KILLED, like INSERT, and that does not invoke stored + routines can be binlogged with neglecting the KILLED error. + + If there was no error (error == zero) until after the end of + inserting loop the KILLED flag that appeared later can be + disregarded since previously possible invocation of stored + routines did not result in any error due to the KILLED. In + such case the flag is ignored for constructing binlog event. + */ Query_log_event qinfo(thd, thd->query, thd->query_length, - transactional_table, FALSE); + transactional_table, FALSE, + (error>0) ? thd->killed : THD::NOT_KILLED); + DBUG_ASSERT(thd->killed != THD::KILL_BAD_DATA || error > 0); if (mysql_bin_log.write(&qinfo) && transactional_table) error=1; } @@ -921,20 +949,24 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list, if (values_list.elements == 1 && (!(thd->options & OPTION_WARNINGS) || !thd->cuted_fields)) { - thd->row_count_func= info.copied+info.deleted+info.updated; + thd->row_count_func= info.copied + info.deleted + + ((thd->client_capabilities & CLIENT_FOUND_ROWS) ? + info.touched : info.updated); send_ok(thd, (ulong) thd->row_count_func, id); } else { char buff[160]; + ha_rows updated=((thd->client_capabilities & CLIENT_FOUND_ROWS) ? + info.touched : info.updated); if (ignore) sprintf(buff, ER(ER_INSERT_INFO), (ulong) info.records, (lock_type == TL_WRITE_DELAYED) ? (ulong) 0 : (ulong) (info.records - info.copied), (ulong) thd->cuted_fields); else sprintf(buff, ER(ER_INSERT_INFO), (ulong) info.records, - (ulong) (info.deleted+info.updated), (ulong) thd->cuted_fields); - thd->row_count_func= info.copied+info.deleted+info.updated; + (ulong) (info.deleted + updated), (ulong) thd->cuted_fields); + thd->row_count_func= info.copied + info.deleted + updated; ::send_ok(thd, (ulong) thd->row_count_func, id, buff); } thd->abort_on_warning= 0; @@ -1374,23 +1406,18 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info) goto before_trg_err; table->file->restore_auto_increment(); - if ((error=table->file->update_row(table->record[1],table->record[0]))) - { - if ((error == HA_ERR_FOUND_DUPP_KEY) && info->ignore) - { - goto ok_or_after_trg_err; - } - goto err; - } - - if (table->next_number_field) - table->file->adjust_next_insert_id_after_explicit_value( - table->next_number_field->val_int()); - info->touched++; - if ((table->file->table_flags() & HA_PARTIAL_COLUMN_READ) || compare_record(table, thd->query_id)) { + if ((error=table->file->update_row(table->record[1],table->record[0]))) + { + if ((error == HA_ERR_FOUND_DUPP_KEY) && info->ignore) + { + goto ok_or_after_trg_err; + } + goto err; + } + info->updated++; trg_error= (table->triggers && table->triggers->process_triggers(thd, TRG_EVENT_UPDATE, @@ -1399,6 +1426,11 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info) info->copied++; } + if (table->next_number_field) + table->file->adjust_next_insert_id_after_explicit_value( + table->next_number_field->val_int()); + info->touched++; + goto ok_or_after_trg_err; } else /* DUP_REPLACE */ @@ -2404,6 +2436,8 @@ bool Delayed_insert::handle_inserts(void) table->file->extra(HA_EXTRA_WRITE_CAN_REPLACE); using_opt_replace= 1; } + if (info.handle_duplicates == DUP_UPDATE) + table->file->extra(HA_EXTRA_INSERT_WITH_UPDATE); thd.clear_error(); // reset error for binlog if (write_record(&thd, table, &info)) { @@ -2731,6 +2765,8 @@ select_insert::prepare(List &values, SELECT_LEX_UNIT *u) table->file->extra(HA_EXTRA_WRITE_CAN_REPLACE); table->file->extra(HA_EXTRA_RETRIEVE_ALL_COLS); } + if (info.handle_duplicates == DUP_UPDATE) + table->file->extra(HA_EXTRA_INSERT_WITH_UPDATE); thd->no_trans_update.stmt= FALSE; thd->abort_on_warning= (!info.ignore && (thd->variables.sql_mode & @@ -2862,41 +2898,6 @@ void select_insert::send_error(uint errcode,const char *err) my_message(errcode, err, MYF(0)); - if (!table) - { - /* - This can only happen when using CREATE ... SELECT and the table was not - created becasue of an syntax error - */ - DBUG_VOID_RETURN; - } - if (!thd->prelocked_mode) - table->file->end_bulk_insert(); - /* - If at least one row has been inserted/modified and will stay in the table - (the table doesn't have transactions) (example: we got a duplicate key - error while inserting into a MyISAM table) we must write to the binlog (and - the error code will make the slave stop). - */ - if ((info.copied || info.deleted || info.updated) && - !table->file->has_transactions()) - { - if (last_insert_id) - thd->insert_id(last_insert_id); // For binary log - if (mysql_bin_log.is_open()) - { - Query_log_event qinfo(thd, thd->query, thd->query_length, - table->file->has_transactions(), FALSE); - mysql_bin_log.write(&qinfo); - } - if (!table->s->tmp_table) - thd->no_trans_update.all= TRUE; - } - if (info.copied || info.deleted || info.updated) - { - query_cache_invalidate3(thd, table, 1); - } - ha_rollback_stmt(thd); DBUG_VOID_RETURN; } @@ -2947,11 +2948,56 @@ bool select_insert::send_eof() else sprintf(buff, ER(ER_INSERT_INFO), (ulong) info.records, (ulong) (info.deleted+info.updated), (ulong) thd->cuted_fields); - thd->row_count_func= info.copied+info.deleted+info.updated; + thd->row_count_func= info.copied + info.deleted + + ((thd->client_capabilities & CLIENT_FOUND_ROWS) ? + info.touched : info.updated); ::send_ok(thd, (ulong) thd->row_count_func, last_insert_id, buff); DBUG_RETURN(0); } +void select_insert::abort() +{ + DBUG_ENTER("select_insert::abort"); + + if (!table) + { + /* + This can only happen when using CREATE ... SELECT and the table was not + created becasue of an syntax error + */ + DBUG_VOID_RETURN; + } + if (!thd->prelocked_mode) + table->file->end_bulk_insert(); + /* + If at least one row has been inserted/modified and will stay in the table + (the table doesn't have transactions) (example: we got a duplicate key + error while inserting into a MyISAM table) we must write to the binlog (and + the error code will make the slave stop). + */ + if ((info.copied || info.deleted || info.updated) && + !table->file->has_transactions()) + { + if (last_insert_id) + thd->insert_id(last_insert_id); // For binary log + if (mysql_bin_log.is_open()) + { + Query_log_event qinfo(thd, thd->query, thd->query_length, + table->file->has_transactions(), FALSE); + mysql_bin_log.write(&qinfo); + } + if (!table->s->tmp_table) + thd->no_trans_update.all= TRUE; + } + if (info.copied || info.deleted || info.updated) + { + query_cache_invalidate3(thd, table, 1); + } + ha_rollback_stmt(thd); + + DBUG_VOID_RETURN; + +} /*************************************************************************** CREATE TABLE (SELECT) ... @@ -3186,6 +3232,8 @@ select_create::prepare(List &values, SELECT_LEX_UNIT *u) table->file->extra(HA_EXTRA_WRITE_CAN_REPLACE); table->file->extra(HA_EXTRA_RETRIEVE_ALL_COLS); } + 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); thd->no_trans_update.stmt= FALSE; @@ -3209,13 +3257,7 @@ void select_create::store_values(List &values) void select_create::send_error(uint errcode,const char *err) { - /* - Disable binlog, because we "roll back" partial inserts in ::abort - by removing the table, even for non-transactional tables. - */ - tmp_disable_binlog(thd); select_insert::send_error(errcode, err); - reenable_binlog(thd); } @@ -3240,6 +3282,14 @@ bool select_create::send_eof() void select_create::abort() { + /* + Disable binlog, because we "roll back" partial inserts in ::abort + by removing the table, even for non-transactional tables. + */ + tmp_disable_binlog(thd); + select_insert::abort(); + reenable_binlog(thd); + if (lock) { mysql_unlock_tables(thd, lock); diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 7bcdc499011..cbfba3d4d80 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -1098,6 +1098,7 @@ Alter_info::Alter_info(const Alter_info &rhs, MEM_ROOT *mem_root) SYNOPSIS skip_rear_comments() + cs character set begin pointer to the beginning of statement end pointer to the end of statement @@ -1108,10 +1109,11 @@ Alter_info::Alter_info(const Alter_info &rhs, MEM_ROOT *mem_root) Pointer to the last non-comment symbol of the statement. */ -char *skip_rear_comments(char *begin, char *end) +char *skip_rear_comments(CHARSET_INFO *cs, char *begin, char *end) { - while (begin < end && (end[-1] <= ' ' || end[-1] == '*' || - end[-1] == '/' || end[-1] == ';')) + while (begin < end && (end[-1] == '*' || + end[-1] == '/' || end[-1] == ';' || + my_isspace(cs, end[-1]))) end-= 1; return end; } diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 6c9283126c4..f8405ef14ca 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -1271,4 +1271,4 @@ extern void lex_free(void); extern void lex_start(THD *thd); extern void lex_end(LEX *lex); extern int MYSQLlex(void *arg, void *yythd); -extern char *skip_rear_comments(char *begin, char *end); +extern char *skip_rear_comments(CHARSET_INFO *cs, char *begin, char *end); diff --git a/sql/sql_load.cc b/sql/sql_load.cc index d14e165a788..7b1799baaad 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -414,9 +414,6 @@ bool mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, if (error) { - if (transactional_table) - ha_autocommit_or_rollback(thd,error); - if (read_file_from_client) while (!read_info.next_line()) ; @@ -460,6 +457,9 @@ bool mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, } } #endif /*!EMBEDDED_LIBRARY*/ + if (transactional_table) + ha_autocommit_or_rollback(thd,error); + error= -1; // Error on read goto err; } @@ -847,6 +847,7 @@ continue_loop:; char READ_INFO::unescape(char chr) { + /* keep this switch synchornous with the ESCAPE_CHARS macro */ switch(chr) { case 'n': return '\n'; case 't': return '\t'; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 7e58b36a939..c679135f858 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -75,6 +75,7 @@ static bool check_db_used(THD *thd,TABLE_LIST *tables); static void remove_escape(char *name); static bool append_file_to_dir(THD *thd, const char **filename_ptr, const char *table_name); +static bool check_show_create_table_access(THD *thd, TABLE_LIST *table); const char *any_db="*any*"; // Special symbol for check_access @@ -1008,9 +1009,12 @@ static int check_connection(THD *thd) Old clients send null-terminated string as password; new clients send the size (1 byte) + string (not null-terminated). Hence in case of empty password both send '\0'. + + Cast *passwd to an unsigned char, so that it doesn't extend the sign for + *passwd > 127 and become 2**32-127 after casting to uint. */ uint passwd_len= thd->client_capabilities & CLIENT_SECURE_CONNECTION ? - *passwd++ : strlen(passwd); + (uchar)(*passwd++) : strlen(passwd); db= thd->client_capabilities & CLIENT_CONNECT_WITH_DB ? db + passwd_len + 1 : 0; uint db_len= db ? strlen(db) : 0; @@ -1139,8 +1143,8 @@ pthread_handler_t handle_one_connection(void *arg) net->no_send_error= 0; /* Use "connect_timeout" value during connection phase */ - net_set_read_timeout(net, connect_timeout); - net_set_write_timeout(net, connect_timeout); + my_net_set_read_timeout(net, connect_timeout); + my_net_set_write_timeout(net, connect_timeout); if ((error=check_connection(thd))) { // Wrong permissions @@ -1183,8 +1187,8 @@ pthread_handler_t handle_one_connection(void *arg) } /* Connect completed, set read/write timeouts back to tdefault */ - net_set_read_timeout(net, thd->variables.net_read_timeout); - net_set_write_timeout(net, thd->variables.net_write_timeout); + my_net_set_read_timeout(net, thd->variables.net_read_timeout); + my_net_set_write_timeout(net, thd->variables.net_write_timeout); while (!net->error && net->vio != 0 && !(thd->killed == THD::KILL_CONNECTION)) @@ -1536,7 +1540,7 @@ bool do_command(THD *thd) the client, the connection is closed or "net_wait_timeout" number of seconds has passed */ - net_set_read_timeout(net, thd->variables.net_wait_timeout); + my_net_set_read_timeout(net, thd->variables.net_wait_timeout); thd->clear_error(); // Clear error message @@ -1568,7 +1572,7 @@ bool do_command(THD *thd) } /* Restore read timeout value */ - net_set_read_timeout(net, thd->variables.net_read_timeout); + my_net_set_read_timeout(net, thd->variables.net_read_timeout); /* packet_length contains length of data, as it was stored in packet @@ -1696,11 +1700,14 @@ bool dispatch_command(enum enum_server_command command, THD *thd, Old clients send null-terminated string ('\0' for empty string) for password. New clients send the size (1 byte) + string (not null terminated, so also '\0' for empty string). + + Cast *passwd to an unsigned char, so that it doesn't extend the sign + for *passwd > 127 and become 2**32-127 after casting to uint. */ char db_buff[NAME_LEN+1]; // buffer to store db in utf8 char *db= passwd; uint passwd_len= thd->client_capabilities & CLIENT_SECURE_CONNECTION ? - *passwd++ : strlen(passwd); + (uchar)(*passwd++) : strlen(passwd); db+= passwd_len + 1; #ifndef EMBEDDED_LIBRARY /* Small check for incoming packet */ @@ -2200,7 +2207,7 @@ void log_slow_statement(THD *thd) thd->variables.long_query_time || (thd->server_status & (SERVER_QUERY_NO_INDEX_USED | SERVER_QUERY_NO_GOOD_INDEX_USED)) && - (specialflag & SPECIAL_LOG_QUERIES_NOT_USING_INDEXES) && + opt_log_queries_not_using_indexes && /* == SQLCOM_END unless this is a SHOW command */ thd->lex->orig_sql_command == SQLCOM_END) { @@ -3080,9 +3087,9 @@ mysql_execute_command(THD *thd) else { /* regular create */ - if (lex->name) - res= mysql_create_like_table(thd, create_table, &create_info, - (Table_ident *)lex->name); + if (lex->create_info.options & HA_LEX_CREATE_TABLE_LIKE) + res= mysql_create_like_table(thd, create_table, select_tables, + &create_info); else { res= mysql_create_table(thd, create_table->db, @@ -3319,11 +3326,7 @@ end_with_restore_list: first_table->skip_temporary= 1; if (check_db_used(thd, all_tables) || - check_access(thd, SELECT_ACL | EXTRA_ACL, first_table->db, - &first_table->grant.privilege, 0, 0, - test(first_table->schema_table))) - goto error; - if (grant_option && check_grant(thd, SELECT_ACL, all_tables, 2, UINT_MAX, 0)) + check_show_create_table_access(thd, first_table)) goto error; res= mysqld_show_create(thd, first_table); break; @@ -3834,7 +3837,10 @@ end_with_restore_list: break; case SQLCOM_LOCK_TABLES: unlock_locked_tables(thd); - if (check_db_used(thd, all_tables) || end_active_trans(thd)) + /* we must end the trasaction first, regardless of anything */ + if (end_active_trans(thd)) + goto error; + if (check_db_used(thd, all_tables)) goto error; if (check_table_access(thd, LOCK_TABLES_ACL | SELECT_ACL, all_tables, 0)) goto error; @@ -3852,7 +3858,15 @@ end_with_restore_list: send_ok(thd); } else + { + /* + Need to end the current transaction, so the storage engine (InnoDB) + can free its locks if LOCK TABLES locked some tables before finding + that it can't lock a table in its list + */ + end_active_trans(thd); thd->options&= ~(ulong) (OPTION_TABLE_LOCK); + } thd->in_lock_tables=0; break; case SQLCOM_CREATE_DB: @@ -4879,6 +4893,10 @@ create_sp_error: #endif // ifndef DBUG_OFF case SQLCOM_CREATE_VIEW: { + /* + Note: SQLCOM_CREATE_VIEW also handles 'ALTER VIEW' commands + as specified through the thd->lex->create_view_mode flag. + */ if (end_active_trans(thd)) goto error; @@ -5255,7 +5273,17 @@ check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv, Security_context *sctx= thd->security_ctx; #ifndef NO_EMBEDDED_ACCESS_CHECKS ulong db_access; - bool db_is_pattern= test(want_access & GRANT_ACL); + /* + GRANT command: + In case of database level grant the database name may be a pattern, + in case of table|column level grant the database name can not be a pattern. + We use 'dont_check_global_grants' as a flag to determine + if it's database level grant command + (see SQLCOM_GRANT case, mysql_execute_command() function) and + set db_is_pattern according to 'dont_check_global_grants' value. + */ + bool db_is_pattern= (test(want_access & GRANT_ACL) && + dont_check_global_grants); #endif ulong dummy; DBUG_ENTER("check_access"); @@ -7519,6 +7547,25 @@ bool insert_precheck(THD *thd, TABLE_LIST *tables) } +/** + @brief Check privileges for SHOW CREATE TABLE statement. + + @param thd Thread context + @param table Target table + + @retval TRUE Failure + @retval FALSE Success +*/ + +static bool check_show_create_table_access(THD *thd, TABLE_LIST *table) +{ + return check_access(thd, SELECT_ACL | EXTRA_ACL, table->db, + &table->grant.privilege, 0, 0, + test(table->schema_table)) || + grant_option && check_grant(thd, SELECT_ACL, table, 2, UINT_MAX, 0); +} + + /* CREATE TABLE query pre-check @@ -7583,6 +7630,11 @@ bool create_table_precheck(THD *thd, TABLE_LIST *tables, if (tables && check_table_access(thd, SELECT_ACL, tables,0)) goto err; } + else if (lex->create_info.options & HA_LEX_CREATE_TABLE_LIKE) + { + if (check_show_create_table_access(thd, tables)) + goto err; + } error= FALSE; err: diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 42655608196..567f92b55ba 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -562,6 +562,8 @@ void set_param_date(Item_param *param, uchar **pos, ulong len) static void set_param_str(Item_param *param, uchar **pos, ulong len) { ulong length= get_param_length(pos, len); + if (length > len) + length= len; param->set_str((const char *)*pos, length); *pos+= length; } @@ -731,6 +733,8 @@ static bool insert_params_withlog(Prepared_statement *stmt, uchar *null_array, if (read_pos >= data_end) DBUG_RETURN(1); param->set_param_func(param, &read_pos, data_end - read_pos); + if (param->state == Item_param::NO_VALUE) + DBUG_RETURN(1); } } res= param->query_val_str(&str); @@ -767,6 +771,8 @@ static bool insert_params(Prepared_statement *stmt, uchar *null_array, if (read_pos >= data_end) DBUG_RETURN(1); param->set_param_func(param, &read_pos, data_end - read_pos); + if (param->state == Item_param::NO_VALUE) + DBUG_RETURN(1); } } if (param->convert_str_value(stmt->thd)) @@ -849,6 +855,8 @@ static bool emb_insert_params(Prepared_statement *stmt, String *expanded_query) client_param->length ? *client_param->length : client_param->buffer_length); + if (param->state == Item_param::NO_VALUE) + DBUG_RETURN(1); } } if (param->convert_str_value(thd)) @@ -890,6 +898,8 @@ static bool emb_insert_params_withlog(Prepared_statement *stmt, String *query) client_param->length ? *client_param->length : client_param->buffer_length); + if (param->state == Item_param::NO_VALUE) + DBUG_RETURN(1); } } res= param->query_val_str(&str); @@ -969,6 +979,7 @@ static bool insert_params_from_vars_with_log(Prepared_statement *stmt, String buf; const String *val; uint32 length= 0; + THD *thd= stmt->thd; DBUG_ENTER("insert_params_from_vars"); @@ -979,34 +990,20 @@ static bool insert_params_from_vars_with_log(Prepared_statement *stmt, { Item_param *param= *it; varname= var_it++; - if (get_var_with_binlog(stmt->thd, stmt->lex->sql_command, - *varname, &entry)) - DBUG_RETURN(1); - if (param->set_from_user_var(stmt->thd, entry)) + entry= (user_var_entry *) hash_search(&thd->user_vars, (byte*) varname->str, + varname->length); + /* + We have to call the setup_one_conversion_function() here to set + the parameter's members that might be needed further + (e.g. value.cs_info.character_set_client is used in the query_val_str()). + */ + setup_one_conversion_function(thd, param, param->param_type); + if (param->set_from_user_var(thd, entry)) DBUG_RETURN(1); - /* Insert @'escaped-varname' instead of parameter in the query */ - if (entry) - { - char *start, *ptr; - buf.length(0); - if (buf.reserve(entry->name.length*2+3)) - DBUG_RETURN(1); + val= param->query_val_str(&buf); - start= ptr= buf.c_ptr_quick(); - *ptr++= '@'; - *ptr++= '\''; - ptr+= escape_string_for_mysql(&my_charset_utf8_general_ci, - ptr, 0, entry->name.str, - entry->name.length); - *ptr++= '\''; - buf.length(ptr - start); - val= &buf; - } - else - val= &my_null_string; - - if (param->convert_str_value(stmt->thd)) + if (param->convert_str_value(thd)) DBUG_RETURN(1); /* out of memory */ if (query->replace(param->pos_in_query+length, 1, *val)) @@ -1727,6 +1724,13 @@ static bool check_prepared_statement(Prepared_statement *stmt, res= mysql_test_create_table(stmt); break; + case SQLCOM_CREATE_VIEW: + if (lex->create_view_mode == VIEW_ALTER) + { + my_message(ER_UNSUPPORTED_PS, ER(ER_UNSUPPORTED_PS), MYF(0)); + goto error; + } + break; case SQLCOM_DO: res= mysql_test_do_fields(stmt, tables, lex->insert_list); break; @@ -1769,7 +1773,6 @@ static bool check_prepared_statement(Prepared_statement *stmt, case SQLCOM_ROLLBACK: case SQLCOM_TRUNCATE: case SQLCOM_CALL: - case SQLCOM_CREATE_VIEW: case SQLCOM_DROP_VIEW: case SQLCOM_REPAIR: case SQLCOM_ANALYZE: diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index b451c612398..9cc0ba7c29a 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -94,7 +94,7 @@ static int send_file(THD *thd) the job */ old_timeout= net->read_timeout; - net_set_read_timeout(net, thd->variables.net_wait_timeout); + my_net_set_read_timeout(net, thd->variables.net_wait_timeout); /* We need net_flush here because the client will not know it needs to send @@ -138,7 +138,7 @@ static int send_file(THD *thd) error = 0; err: - net_set_read_timeout(net, old_timeout); + my_net_set_read_timeout(net, old_timeout); if (fd >= 0) (void) my_close(fd, MYF(0)); if (errmsg) @@ -1420,13 +1420,11 @@ err: } if (errmsg) - { my_error(ER_ERROR_WHEN_EXECUTING_COMMAND, MYF(0), "SHOW BINLOG EVENTS", errmsg); - DBUG_RETURN(TRUE); - } + else + send_eof(thd); - send_eof(thd); pthread_mutex_lock(&LOCK_thread_count); thd->current_linfo = 0; pthread_mutex_unlock(&LOCK_thread_count); diff --git a/sql/sql_select.cc b/sql/sql_select.cc index ea59cbbe9f2..9d27ab4bb4e 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -49,15 +49,15 @@ static int sort_keyuse(KEYUSE *a,KEYUSE *b); static void set_position(JOIN *join,uint index,JOIN_TAB *table,KEYUSE *key); static bool create_ref_for_key(JOIN *join, JOIN_TAB *j, KEYUSE *org_keyuse, table_map used_tables); -static void choose_plan(JOIN *join,table_map join_tables); +static bool choose_plan(JOIN *join,table_map join_tables); static void best_access_path(JOIN *join, JOIN_TAB *s, THD *thd, table_map remaining_tables, uint idx, double record_count, double read_time); static void optimize_straight_join(JOIN *join, table_map join_tables); -static void greedy_search(JOIN *join, table_map remaining_tables, +static bool greedy_search(JOIN *join, table_map remaining_tables, uint depth, uint prune_level); -static void best_extension_by_limited_search(JOIN *join, +static bool best_extension_by_limited_search(JOIN *join, table_map remaining_tables, uint idx, double record_count, double read_time, uint depth, @@ -69,7 +69,7 @@ static int join_tab_cmp_straight(const void* ptr1, const void* ptr2); TODO: 'find_best' is here only temporarily until 'greedy_search' is tested and approved. */ -static void find_best(JOIN *join,table_map rest_tables,uint index, +static bool find_best(JOIN *join,table_map rest_tables,uint index, double record_count,double read_time); static uint cache_record_length(JOIN *join,uint index); static double prev_record_reads(JOIN *join,table_map found_ref); @@ -258,11 +258,8 @@ bool handle_select(THD *thd, LEX *lex, select_result *result, thd->net.report_error)); res|= thd->net.report_error; if (unlikely(res)) - { - /* If we had a another error reported earlier then this will be ignored */ - result->send_error(ER_UNKNOWN_ERROR, ER(ER_UNKNOWN_ERROR)); result->abort(); - } + DBUG_RETURN(res); } @@ -614,7 +611,7 @@ JOIN::prepare(Item ***rref_pointer_array, goto err; /* purecov: inspected */ /* Init join struct */ - count_field_types(&tmp_table_param, all_fields, 0); + count_field_types(select_lex, &tmp_table_param, all_fields, 0); ref_pointer_array_size= all_fields.elements*sizeof(Item*); this->group= group_list != 0; unit= unit_arg; @@ -1347,8 +1344,7 @@ JOIN::optimize() there are aggregate functions, because in all these cases we need all result rows. */ - ha_rows tmp_rows_limit= ((order == 0 || skip_sort_order || - test(select_options & OPTION_BUFFER_RESULT)) && + ha_rows tmp_rows_limit= ((order == 0 || skip_sort_order) && !tmp_group && !thd->lex->current_select->with_sum_func) ? select_limit : HA_POS_ERROR; @@ -1770,7 +1766,7 @@ JOIN::exec() if (make_simple_join(curr_join, curr_tmp_table)) DBUG_VOID_RETURN; calc_group_buffer(curr_join, group_list); - count_field_types(&curr_join->tmp_table_param, + count_field_types(select_lex, &curr_join->tmp_table_param, curr_join->tmp_all_fields1, curr_join->select_distinct && !curr_join->group_list); curr_join->tmp_table_param.hidden_field_count= @@ -1890,11 +1886,13 @@ JOIN::exec() if (make_simple_join(curr_join, curr_tmp_table)) DBUG_VOID_RETURN; calc_group_buffer(curr_join, curr_join->group_list); - count_field_types(&curr_join->tmp_table_param, *curr_all_fields, 0); + count_field_types(select_lex, &curr_join->tmp_table_param, + *curr_all_fields, 0); } if (procedure) - count_field_types(&curr_join->tmp_table_param, *curr_all_fields, 0); + count_field_types(select_lex, &curr_join->tmp_table_param, + *curr_all_fields, 0); if (curr_join->group || curr_join->tmp_table_param.sum_func_count || (procedure && (procedure->flags & PROC_GROUP))) @@ -2075,6 +2073,17 @@ JOIN::exec() thd->examined_row_count+= curr_join->examined_rows; DBUG_PRINT("counts", ("thd->examined_row_count: %lu", (ulong) thd->examined_row_count)); + + /* + With EXPLAIN EXTENDED we have to restore original ref_array + for a derived table which is always materialized. + Otherwise we would not be able to print the query correctly. + */ + if (items0 && + (thd->lex->describe & DESCRIBE_EXTENDED) && + select_lex->linkage == DERIVED_TABLE_TYPE) + set_items_ref_array(items0); + DBUG_VOID_RETURN; } @@ -2717,7 +2726,8 @@ make_join_statistics(JOIN *join, TABLE_LIST *tables, COND *conds, if (join->const_tables != join->tables) { optimize_keyuse(join, keyuse_array); - choose_plan(join, all_table_map & ~join->const_table_map); + if (choose_plan(join, all_table_map & ~join->const_table_map)) + DBUG_RETURN(TRUE); } else { @@ -4307,11 +4317,12 @@ best_access_path(JOIN *join, the array 'join->best_positions', and the cost of the plan in 'join->best_read'. - RETURN - None + RETURN VALUES + FALSE ok + TRUE Fatal error */ -static void +static bool choose_plan(JOIN *join, table_map join_tables) { uint search_depth= join->thd->variables.optimizer_search_depth; @@ -4344,14 +4355,16 @@ choose_plan(JOIN *join, table_map join_tables) the greedy version. Will be removed when greedy_search is approved. */ join->best_read= DBL_MAX; - find_best(join, join_tables, join->const_tables, 1.0, 0.0); + if (find_best(join, join_tables, join->const_tables, 1.0, 0.0)) + DBUG_RETURN(TRUE); } else { if (search_depth == 0) /* Automatically determine a reasonable value for 'search_depth' */ search_depth= determine_search_depth(join); - greedy_search(join, join_tables, search_depth, prune_level); + if (greedy_search(join, join_tables, search_depth, prune_level)) + DBUG_RETURN(TRUE); } } @@ -4361,7 +4374,7 @@ choose_plan(JOIN *join, table_map join_tables) */ if (join->thd->lex->orig_sql_command != SQLCOM_SHOW_STATUS) join->thd->status_var.last_query_cost= join->best_read; - DBUG_VOID_RETURN; + DBUG_RETURN(FALSE); } @@ -4589,11 +4602,12 @@ optimize_straight_join(JOIN *join, table_map join_tables) In the future, 'greedy_search' might be extended to support other implementations of 'best_extension', e.g. some simpler quadratic procedure. - RETURN - None + RETURN VALUES + FALSE ok + TRUE Fatal error */ -static void +static bool greedy_search(JOIN *join, table_map remaining_tables, uint search_depth, @@ -4615,8 +4629,9 @@ greedy_search(JOIN *join, do { /* Find the extension of the current QEP with the lowest cost */ join->best_read= DBL_MAX; - best_extension_by_limited_search(join, remaining_tables, idx, record_count, - read_time, search_depth, prune_level); + if (best_extension_by_limited_search(join, remaining_tables, idx, record_count, + read_time, search_depth, prune_level)) + DBUG_RETURN(TRUE); if (size_remain <= search_depth) { @@ -4627,7 +4642,7 @@ greedy_search(JOIN *join, DBUG_EXECUTE("opt", print_plan(join, join->tables, record_count, read_time, read_time, "optimal");); - DBUG_VOID_RETURN; + DBUG_RETURN(FALSE); } /* select the first table in the optimal extension as most promising */ @@ -4772,11 +4787,12 @@ greedy_search(JOIN *join, The parameter 'search_depth' provides control over the recursion depth, and thus the size of the resulting optimal plan. - RETURN - None + RETURN VALUES + FALSE ok + TRUE Fatal error */ -static void +static bool best_extension_by_limited_search(JOIN *join, table_map remaining_tables, uint idx, @@ -4785,11 +4801,11 @@ best_extension_by_limited_search(JOIN *join, uint search_depth, uint prune_level) { + DBUG_ENTER("best_extension_by_limited_search"); + THD *thd= join->thd; if (thd->killed) // Abort - return; - - DBUG_ENTER("best_extension_by_limited_search"); + DBUG_RETURN(TRUE); /* 'join' is a partial plan with lower cost than the best plan so far, @@ -4869,15 +4885,14 @@ best_extension_by_limited_search(JOIN *join, if ( (search_depth > 1) && (remaining_tables & ~real_table_bit) ) { /* Recursively expand the current partial plan */ swap_variables(JOIN_TAB*, join->best_ref[idx], *pos); - best_extension_by_limited_search(join, - remaining_tables & ~real_table_bit, - idx + 1, - current_record_count, - current_read_time, - search_depth - 1, - prune_level); - if (thd->killed) - DBUG_VOID_RETURN; + if (best_extension_by_limited_search(join, + remaining_tables & ~real_table_bit, + idx + 1, + current_record_count, + current_read_time, + search_depth - 1, + prune_level)) + DBUG_RETURN(TRUE); swap_variables(JOIN_TAB*, join->best_ref[idx], *pos); } else @@ -4906,19 +4921,26 @@ best_extension_by_limited_search(JOIN *join, restore_prev_nj_state(s); } } - DBUG_VOID_RETURN; + DBUG_RETURN(FALSE); } /* TODO: this function is here only temporarily until 'greedy_search' is tested and accepted. + + RETURN VALUES + FALSE ok + TRUE Fatal error */ -static void +static bool find_best(JOIN *join,table_map rest_tables,uint idx,double record_count, double read_time) { + DBUG_ENTER("find_best"); THD *thd= join->thd; + if (thd->killed) + DBUG_RETURN(TRUE); if (!rest_tables) { DBUG_PRINT("best",("read_time: %g record_count: %g",read_time, @@ -4935,10 +4957,10 @@ find_best(JOIN *join,table_map rest_tables,uint idx,double record_count, sizeof(POSITION)*idx); join->best_read= read_time - 0.001; } - return; + DBUG_RETURN(FALSE); } if (read_time+record_count/(double) TIME_FOR_COMPARE >= join->best_read) - return; /* Found better before */ + DBUG_RETURN(FALSE); /* Found better before */ JOIN_TAB *s; double best_record_count=DBL_MAX,best_read_time=DBL_MAX; @@ -4971,10 +4993,9 @@ find_best(JOIN *join,table_map rest_tables,uint idx,double record_count, best_read_time=current_read_time; } swap_variables(JOIN_TAB*, join->best_ref[idx], *pos); - find_best(join,rest_tables & ~real_table_bit,idx+1, - current_record_count,current_read_time); - if (thd->killed) - return; + if (find_best(join,rest_tables & ~real_table_bit,idx+1, + current_record_count,current_read_time)) + DBUG_RETURN(TRUE); swap_variables(JOIN_TAB*, join->best_ref[idx], *pos); } restore_prev_nj_state(s); @@ -4982,6 +5003,7 @@ find_best(JOIN *join,table_map rest_tables,uint idx,double record_count, break; // Don't test all combinations } } + DBUG_RETURN(FALSE); } @@ -5666,28 +5688,6 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond) join->const_table_map, (table_map) 0); DBUG_EXECUTE("where",print_where(const_cond,"constants");); - for (JOIN_TAB *tab= join->join_tab+join->const_tables; - tab < join->join_tab+join->tables ; tab++) - { - if (*tab->on_expr_ref) - { - JOIN_TAB *cond_tab= tab->first_inner; - COND *tmp= make_cond_for_table(*tab->on_expr_ref, - join->const_table_map, - ( table_map) 0); - if (!tmp) - continue; - tmp= new Item_func_trig_cond(tmp, &cond_tab->not_null_compl); - if (!tmp) - DBUG_RETURN(1); - tmp->quick_fix_field(); - cond_tab->select_cond= !cond_tab->select_cond ? tmp : - new Item_cond_and(cond_tab->select_cond,tmp); - if (!cond_tab->select_cond) - DBUG_RETURN(1); - cond_tab->select_cond->quick_fix_field(); - } - } if (const_cond && !const_cond->val_int()) { DBUG_PRINT("info",("Found impossible WHERE condition")); @@ -5918,13 +5918,39 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond) } /* - Push down all predicates from on expressions. - Each of these predicated are guarded by a variable + Push down conditions from all on expressions. + Each of these conditions are guarded by a variable that turns if off just before null complemented row for - outer joins is formed. Thus, the predicates from an + outer joins is formed. Thus, the condition from an 'on expression' are guaranteed not to be checked for the null complemented row. */ + + /* First push down constant conditions from on expressions */ + for (JOIN_TAB *join_tab= join->join_tab+join->const_tables; + join_tab < join->join_tab+join->tables ; join_tab++) + { + if (*join_tab->on_expr_ref) + { + JOIN_TAB *cond_tab= join_tab->first_inner; + COND *tmp= make_cond_for_table(*join_tab->on_expr_ref, + join->const_table_map, + (table_map) 0); + if (!tmp) + continue; + tmp= new Item_func_trig_cond(tmp, &cond_tab->not_null_compl); + if (!tmp) + DBUG_RETURN(1); + tmp->quick_fix_field(); + cond_tab->select_cond= !cond_tab->select_cond ? tmp : + new Item_cond_and(cond_tab->select_cond,tmp); + if (!cond_tab->select_cond) + DBUG_RETURN(1); + cond_tab->select_cond->quick_fix_field(); + } + } + + /* Push down non-constant conditions from on expressions */ JOIN_TAB *last_tab= tab; while (first_inner_tab && first_inner_tab->last_inner == last_tab) { @@ -6375,7 +6401,6 @@ void JOIN::cleanup(bool full) for (tab= join_tab, end= tab+tables; tab != end; tab++) tab->cleanup(); table= 0; - tables= 0; } else { @@ -8800,7 +8825,7 @@ Field* create_tmp_field_from_field(THD *thd, Field* org_field, Make sure that the blob fits into a Field_varstring which has 2-byte lenght. */ - if (convert_blob_length && convert_blob_length < UINT_MAX16 && + if (convert_blob_length && convert_blob_length <= Field_varstring::MAX_SIZE && (org_field->flags & BLOB_FLAG)) new_field= new Field_varstring(convert_blob_length, org_field->maybe_null(), @@ -8866,8 +8891,13 @@ static Field *create_tmp_field_from_item(THD *thd, Item *item, TABLE *table, item->name, table, item->decimals, TRUE); break; case INT_RESULT: - /* Select an integer type with the minimal fit precision */ - if (item->max_length > MY_INT32_NUM_DECIMAL_DIGITS) + /* + Select an integer type with the minimal fit precision. + MY_INT32_NUM_DECIMAL_DIGITS is sign inclusive, don't consider the sign. + Values with MY_INT32_NUM_DECIMAL_DIGITS digits may or may not fit into + Field_long : make them Field_longlong. + */ + if (item->max_length >= (MY_INT32_NUM_DECIMAL_DIGITS - 1)) new_field=new Field_longlong(item->max_length, maybe_null, item->name, table, item->unsigned_flag); else @@ -8891,7 +8921,8 @@ static Field *create_tmp_field_from_item(THD *thd, Item *item, TABLE *table, 2-byte lenght. */ else if (item->max_length/item->collation.collation->mbmaxlen > 255 && - convert_blob_length < UINT_MAX16 && convert_blob_length) + convert_blob_length <= Field_varstring::MAX_SIZE && + convert_blob_length) new_field= new Field_varstring(convert_blob_length, maybe_null, item->name, table, item->collation.collation); @@ -9131,7 +9162,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List &fields, bool using_unique_constraint= 0; bool use_packed_rows= 0; bool not_all_columns= !(select_options & TMP_TABLE_ALL_COLUMNS); - char *tmpname,path[FN_REFLEN]; + char *tmpname, *tmppath, path[FN_REFLEN], table_name[NAME_LEN+1]; byte *pos,*group_buff; uchar *null_flags; Field **reg_field, **from_field, **default_field; @@ -9154,12 +9185,12 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List &fields, temp_pool_slot = bitmap_set_next(&temp_pool); if (temp_pool_slot != MY_BIT_NONE) // we got a slot - sprintf(path, "%s_%lx_%i", tmp_file_prefix, - current_pid, temp_pool_slot); + sprintf(table_name, "%s_%lx_%i", tmp_file_prefix, + current_pid, temp_pool_slot); else { /* if we run out of slots or we are not using tempool */ - sprintf(path,"%s%lx_%lx_%x", tmp_file_prefix,current_pid, + sprintf(table_name, "%s%lx_%lx_%x", tmp_file_prefix,current_pid, thd->thread_id, thd->tmp_table++); } @@ -9167,7 +9198,8 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List &fields, No need to change table name to lower case as we are only creating MyISAM or HEAP tables here */ - fn_format(path, path, mysql_tmpdir, "", MY_REPLACE_EXT|MY_UNPACK_FILENAME); + fn_format(path, table_name, mysql_tmpdir, "", + MY_REPLACE_EXT|MY_UNPACK_FILENAME); if (group) { @@ -9212,7 +9244,8 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List &fields, sizeof(*key_part_info)*(param->group_parts+1), ¶m->start_recinfo, sizeof(*param->recinfo)*(field_count*2+4), - &tmpname, (uint) strlen(path)+1, + &tmppath, (uint) strlen(path)+1, + &tmpname, (uint) strlen(table_name)+1, &group_buff, group && ! using_unique_constraint ? param->group_length : 0, NullS)) @@ -9230,7 +9263,8 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List &fields, DBUG_RETURN(NULL); /* purecov: inspected */ } param->items_to_copy= copy_func; - strmov(tmpname,path); + strmov(tmppath, path); + strmov(tmpname, table_name); /* make table according to fields */ bzero((char*) table,sizeof(*table)); @@ -9256,7 +9290,8 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List &fields, table->s= &table->share_not_to_be_used; table->s->blob_field= blob_field; - table->s->table_name= table->s->path= tmpname; + table->s->table_name= tmpname; + table->s->path= tmppath; table->s->db= ""; table->s->blob_ptr_size= mi_portable_sizeof_char_ptr; table->s->tmp_table= NON_TRANSACTIONAL_TMP_TABLE; @@ -10114,7 +10149,9 @@ bool create_myisam_from_heap(THD *thd, TABLE *table, TMP_TABLE_PARAM *param, /* copy all old rows */ while (!table->file->rnd_next(new_table.record[1])) { - if ((write_err=new_table.file->write_row(new_table.record[1]))) + write_err=new_table.file->write_row(new_table.record[1]); + DBUG_EXECUTE_IF("raise_error", write_err= HA_ERR_FOUND_DUPP_KEY ;); + if (write_err) goto err; } /* copy row that filled HEAP table */ @@ -10141,7 +10178,7 @@ bool create_myisam_from_heap(THD *thd, TABLE *table, TMP_TABLE_PARAM *param, err: DBUG_PRINT("error",("Got error: %d",write_err)); - table->file->print_error(error,MYF(0)); // Give table is full error + table->file->print_error(write_err, MYF(0)); (void) table->file->ha_rnd_end(); (void) new_table.file->close(); err1: @@ -10149,6 +10186,7 @@ bool create_myisam_from_heap(THD *thd, TABLE *table, TMP_TABLE_PARAM *param, delete new_table.file; err2: thd->proc_info=save_proc_info; + table->mem_root= new_table.mem_root; DBUG_RETURN(1); } @@ -12246,10 +12284,11 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit, LINT_INIT(ref_key_parts); /* - Check which keys can be used to resolve ORDER BY. - We must not try to use disabled keys. + Keys disabled by ALTER TABLE ... DISABLE KEYS should have already + been taken into account. */ - usable_keys= table->s->keys_in_use; + usable_keys= table->keys_in_use_for_query; + DBUG_ASSERT(usable_keys.is_subset(table->s->keys_in_use)); for (ORDER *tmp_order=order; tmp_order ; tmp_order=tmp_order->next) { @@ -12511,10 +12550,14 @@ create_sort_index(THD *thd, JOIN *join, ORDER *order, /* When there is SQL_BIG_RESULT do not sort using index for GROUP BY, - and thus force sorting on disk. + and thus force sorting on disk unless a group min-max optimization + is going to be used as it is applied now only for one table queries + with covering indexes. */ if ((order != join->group_list || - !(join->select_options & SELECT_BIG_RESULT)) && + !(join->select_options & SELECT_BIG_RESULT) || + select && select->quick && + select->quick->get_type() == QUICK_SELECT_I::QS_TYPE_GROUP_MIN_MAX) && test_if_skip_sort_order(tab,order,select_limit,0)) DBUG_RETURN(0); for (ORDER *ord= join->order; ord; ord= ord->next) @@ -13637,8 +13680,8 @@ next_item: *****************************************************************************/ void -count_field_types(TMP_TABLE_PARAM *param, List &fields, - bool reset_with_sum_func) +count_field_types(SELECT_LEX *select_lex, TMP_TABLE_PARAM *param, + List &fields, bool reset_with_sum_func) { List_iterator li(fields); Item *field; @@ -13656,18 +13699,22 @@ count_field_types(TMP_TABLE_PARAM *param, List &fields, if (! field->const_item()) { Item_sum *sum_item=(Item_sum*) field->real_item(); - if (!sum_item->quick_group) - param->quick_group=0; // UDF SUM function - param->sum_func_count++; - param->func_count++; + if (!sum_item->depended_from() || + sum_item->depended_from() == select_lex) + { + if (!sum_item->quick_group) + param->quick_group=0; // UDF SUM function + param->sum_func_count++; - for (uint i=0 ; i < sum_item->arg_count ; i++) - { - if (sum_item->args[0]->real_item()->type() == Item::FIELD_ITEM) - param->field_count++; - else - param->func_count++; - } + for (uint i=0 ; i < sum_item->arg_count ; i++) + { + if (sum_item->args[0]->real_item()->type() == Item::FIELD_ITEM) + param->field_count++; + else + param->func_count++; + } + } + param->func_count++; } } else @@ -14129,7 +14176,9 @@ bool JOIN::make_sum_func_list(List &field_list, List &send_fields, func= sum_funcs; while ((item=it++)) { - if (item->type() == Item::SUM_FUNC_ITEM && !item->const_item()) + if (item->type() == Item::SUM_FUNC_ITEM && !item->const_item() && + (!((Item_sum*) item)->depended_from() || + ((Item_sum *)item)->depended_from() == select_lex)) *func++= (Item_sum*) item; } if (before_group_by && rollup.state == ROLLUP::STATE_INITED) @@ -14204,6 +14253,13 @@ change_to_use_tmp_fields(THD *thd, Item **ref_pointer_array, if (!item_field) DBUG_RETURN(TRUE); // Fatal error item_field->name= item->name; + if (item->type() == Item::REF_ITEM) + { + Item_field *ifield= (Item_field *) item_field; + Item_ref *iref= (Item_ref *) item; + ifield->table_name= iref->table_name; + ifield->db_name= iref->db_name; + } #ifndef DBUG_OFF if (_db_on_ && !item_field->name) { @@ -14704,7 +14760,10 @@ bool JOIN::rollup_make_fields(List &fields_arg, List &sel_fields, ref_array= ref_array_start; } - if (item->type() == Item::SUM_FUNC_ITEM && !item->const_item()) + if (item->type() == Item::SUM_FUNC_ITEM && !item->const_item() && + (!((Item_sum*) item)->depended_from() || + ((Item_sum *)item)->depended_from() == select_lex)) + { /* This is a top level summary function that must be replaced with diff --git a/sql/sql_select.h b/sql/sql_select.h index 3cdd265df9a..4f9f6e9ed48 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -470,8 +470,8 @@ TABLE *create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List &fields, ulonglong select_options, ha_rows rows_limit, char* alias); void free_tmp_table(THD *thd, TABLE *entry); -void count_field_types(TMP_TABLE_PARAM *param, List &fields, - bool reset_with_sum_func); +void count_field_types(SELECT_LEX *select_lex, TMP_TABLE_PARAM *param, + List &fields, bool reset_with_sum_func); bool setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param, Item **ref_pointer_array, List &new_list1, List &new_list2, diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 16ed20cd479..dc1a7bc3bd3 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1463,6 +1463,8 @@ static bool show_status_array(THD *thd, const char *wild, case SHOW_LONG_CONST: end= int10_to_str(*(long*) value, buff, 10); break; + case SHOW_LONGLONG_STATUS: + value= ((char *) status_var + (ulonglong) value); case SHOW_LONGLONG: end= longlong10_to_str(*(longlong*) value, buff, 10); break; @@ -1907,11 +1909,9 @@ bool uses_only_table_name_fields(Item *item, TABLE_LIST *table) if (item->type() == Item::FUNC_ITEM) { Item_func *item_func= (Item_func*)item; - Item **child; - Item **item_end= (item_func->arguments()) + item_func->argument_count(); - for (child= item_func->arguments(); child != item_end; child++) + for (uint i=0; iargument_count(); i++) { - if (!uses_only_table_name_fields(*child, table)) + if (!uses_only_table_name_fields(item_func->arguments()[i], table)) return 0; } } @@ -3158,6 +3158,7 @@ static int get_schema_views_record(THD *thd, struct st_table_list *tables, DBUG_ENTER("get_schema_views_record"); char definer[USER_HOST_BUFF_SIZE]; uint definer_len; + bool updatable_view; if (tables->view) { @@ -3195,7 +3196,34 @@ static int get_schema_views_record(THD *thd, struct st_table_list *tables, else table->field[4]->store(STRING_WITH_LEN("NONE"), cs); - if (tables->updatable_view) + updatable_view= 0; + if (tables->algorithm != VIEW_ALGORITHM_TMPTABLE) + { + /* + We should use tables->view->select_lex.item_list here and + can not use Field_iterator_view because the view always uses + temporary algorithm during opening for I_S and + TABLE_LIST fields 'field_translation' & 'field_translation_end' + are uninitialized is this case. + */ + List *fields= &tables->view->select_lex.item_list; + List_iterator it(*fields); + Item *item; + Item_field *field; + /* + chech that at least one coulmn in view is updatable + */ + while ((item= it++)) + { + if ((field= item->filed_for_view_update()) && field->field && + !field->field->table->pos_in_table_list->schema_table) + { + updatable_view= 1; + break; + } + } + } + if (updatable_view) table->field[5]->store(STRING_WITH_LEN("YES"), cs); else table->field[5]->store(STRING_WITH_LEN("NO"), cs); diff --git a/sql/sql_sort.h b/sql/sql_sort.h index da28ca07e2c..1e9322f7f5b 100644 --- a/sql/sql_sort.h +++ b/sql/sql_sort.h @@ -50,6 +50,12 @@ typedef struct st_buffpek { /* Struktur om sorteringsbuffrarna */ ulong max_keys; /* Max keys in buffert */ } BUFFPEK; +struct BUFFPEK_COMPARE_CONTEXT +{ + qsort_cmp2 key_compare; + void *key_compare_arg; +}; + typedef struct st_sort_param { uint rec_length; /* Length of sorted records */ uint sort_length; /* Length of sorted columns */ @@ -65,6 +71,9 @@ typedef struct st_sort_param { uchar *unique_buff; bool not_killable; char* tmp_buffer; + /* The fields below are used only by Unique class */ + qsort2_cmp compare; + BUFFPEK_COMPARE_CONTEXT cmp_context; } SORTPARAM; diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 079cc0d6456..87f23097a66 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -37,7 +37,8 @@ static int copy_data_between_tables(TABLE *from,TABLE *to, List &create, bool ignore, uint order_num, ORDER *order, ha_rows *copied,ha_rows *deleted, - enum enum_enable_or_disable keys_onoff); + enum enum_enable_or_disable keys_onoff, + bool error_if_not_empty); static bool prepare_blob_field(THD *thd, create_field *sql_field); static bool check_engine(THD *thd, const char *table_name, @@ -2283,33 +2284,16 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, */ if (!table->table) { - char buf[ERRMSGSIZE+ERRMSGSIZE+2]; - const char *err_msg; - protocol->prepare_for_resend(); - protocol->store(table_name, system_charset_info); - protocol->store(operator_name, system_charset_info); - protocol->store(STRING_WITH_LEN("error"), system_charset_info); - if (!(err_msg=thd->net.last_error)) - err_msg=ER(ER_CHECK_NO_SUCH_TABLE); + if (!thd->warn_list.elements) + push_warning(thd, MYSQL_ERROR::WARN_LEVEL_ERROR, + ER_CHECK_NO_SUCH_TABLE, ER(ER_CHECK_NO_SUCH_TABLE)); /* if it was a view will check md5 sum */ if (table->view && view_checksum(thd, table) == HA_ADMIN_WRONG_CHECKSUM) - { - strxmov(buf, err_msg, "; ", ER(ER_VIEW_CHECKSUM), NullS); - err_msg= (const char *)buf; - } - protocol->store(err_msg, system_charset_info); - lex->cleanup_after_one_table_open(); - thd->clear_error(); - /* - View opening can be interrupted in the middle of process so some - tables can be left opening - */ - close_thread_tables(thd); - lex->reset_query_tables_list(FALSE); - if (protocol->write()) - goto err; - continue; + push_warning(thd, MYSQL_ERROR::WARN_LEVEL_ERROR, + ER_VIEW_CHECKSUM, ER(ER_VIEW_CHECKSUM)); + result_code= HA_ADMIN_CORRUPT; + goto send_result; } if (table->view) @@ -2391,6 +2375,22 @@ send_result: lex->cleanup_after_one_table_open(); thd->clear_error(); // these errors shouldn't get client + { + List_iterator_fast it(thd->warn_list); + MYSQL_ERROR *err; + while ((err= it++)) + { + protocol->prepare_for_resend(); + protocol->store(table_name, system_charset_info); + protocol->store((char*) operator_name, system_charset_info); + protocol->store(warning_level_names[err->level], + warning_level_length[err->level], system_charset_info); + protocol->store(err->msg, system_charset_info); + if (protocol->write()) + goto err; + } + mysql_reset_errors(thd, true); + } protocol->prepare_for_resend(); protocol->store(table_name, system_charset_info); protocol->store(operator_name, system_charset_info); @@ -2718,7 +2718,8 @@ bool mysql_preload_keys(THD* thd, TABLE_LIST* tables) SYNOPSIS mysql_create_like_table() thd Thread object - table Table list (one table only) + table Table list element for target table + src_table Table list element for source table create_info Create info table_ident Src table_ident @@ -2727,61 +2728,52 @@ bool mysql_preload_keys(THD* thd, TABLE_LIST* tables) TRUE error */ -bool mysql_create_like_table(THD* thd, TABLE_LIST* table, - HA_CREATE_INFO *create_info, - Table_ident *table_ident) +bool mysql_create_like_table(THD* thd, TABLE_LIST* table, TABLE_LIST *src_table, + HA_CREATE_INFO *create_info) { TABLE **tmp_table; char src_path[FN_REFLEN], dst_path[FN_REFLEN]; char *db= table->db; char *table_name= table->table_name; - char *src_db; - char *src_table= table_ident->table.str; int err; bool res= TRUE; db_type not_used; - - TABLE_LIST src_tables_list; DBUG_ENTER("mysql_create_like_table"); - DBUG_ASSERT(table_ident->db.str); /* Must be set in the parser */ - src_db= table_ident->db.str; /* - Validate the source table + By taking name-lock on the source table and holding LOCK_open mutex we + ensure that no concurrent DDL operation will mess with this table. Note + that holding only name-lock is not enough for this, because it won't block + other DDL statements that only take name-locks on the table and don't + open it (simple name-locks are not exclusive between each other). + + Unfortunately, simply opening this table is not enough for our purproses, + since in 5.0 ALTER TABLE may change .FRM files on disk even if there are + connections that still have old version of table open. This 'optimization' + was removed in 5.1 so there we open the source table instead of taking + name-lock on it. + + We also have to acquire LOCK_open to make copying of .frm file, call to + ha_create_table() and binlogging atomic against concurrent DML and DDL + operations on the target table. */ - if (table_ident->table.length > NAME_LEN || - (table_ident->table.length && - check_table_name(src_table,table_ident->table.length))) - { - my_error(ER_WRONG_TABLE_NAME, MYF(0), src_table); - DBUG_RETURN(TRUE); - } - if (!src_db || check_db_name(src_db)) - { - my_error(ER_WRONG_DB_NAME, MYF(0), src_db ? src_db : "NULL"); - DBUG_RETURN(-1); - } - - bzero((gptr)&src_tables_list, sizeof(src_tables_list)); - src_tables_list.db= src_db; - src_tables_list.table_name= src_table; - - if (lock_and_wait_for_table_name(thd, &src_tables_list)) + if (lock_and_wait_for_table_name(thd, src_table)) goto err; - if ((tmp_table= find_temporary_table(thd, src_db, src_table))) + pthread_mutex_lock(&LOCK_open); + + if ((tmp_table= find_temporary_table(thd, src_table->db, + src_table->table_name))) strxmov(src_path, (*tmp_table)->s->path, reg_ext, NullS); else { - strxmov(src_path, mysql_data_home, "/", src_db, "/", src_table, - reg_ext, NullS); + strxmov(src_path, mysql_data_home, "/", src_table->db, "/", + src_table->table_name, reg_ext, NullS); /* Resolve symlinks (for windows) */ fn_format(src_path, src_path, "", "", MYF(MY_UNPACK_FILENAME)); - if (lower_case_table_names) - my_casedn_str(files_charset_info, src_path); if (access(src_path, F_OK)) { - my_error(ER_BAD_TABLE_ERROR, MYF(0), src_table); + my_error(ER_BAD_TABLE_ERROR, MYF(0), src_table->table_name); goto err; } } @@ -2791,10 +2783,13 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, */ if (mysql_frm_type(thd, src_path, ¬_used) != FRMTYPE_TABLE) { - my_error(ER_WRONG_OBJECT, MYF(0), src_db, src_table, "BASE TABLE"); + my_error(ER_WRONG_OBJECT, MYF(0), src_table->db, src_table->table_name, + "BASE TABLE"); goto err; } + DBUG_EXECUTE_IF("sleep_create_like_before_check_if_exists", my_sleep(6000000);); + /* Validate the destination table @@ -2810,27 +2805,22 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, } else { - bool exists; strxmov(dst_path, mysql_data_home, "/", db, "/", table_name, reg_ext, NullS); fn_format(dst_path, dst_path, "", "", MYF(MY_UNPACK_FILENAME)); /* - Note that this critical section should actually cover most - of mysql_create_like_table() function. See bugs #18950 and - #23667 for more information. - Also note that starting from 5.1 we obtain name-lock on - target table instead of inspecting table cache for presence + Note that starting from 5.1 we obtain name-lock on target + table instead of inspecting table cache for presence of open placeholders (see comment in mysql_create_table()). */ - pthread_mutex_lock(&LOCK_open); - exists= (table_cache_has_open_placeholder(thd, db, table_name) || - !access(dst_path, F_OK)); - pthread_mutex_unlock(&LOCK_open); - if (exists) + if (table_cache_has_open_placeholder(thd, db, table_name) || + !access(dst_path, F_OK)) goto table_exists; } + DBUG_EXECUTE_IF("sleep_create_like_before_copy", my_sleep(6000000);); + /* Create a new table by copying from source table */ @@ -2843,6 +2833,8 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, goto err; } + DBUG_EXECUTE_IF("sleep_create_like_before_ha_create", my_sleep(6000000);); + /* As mysql_truncate don't work on a new table at this stage of creation, instead create the table directly (for both normal @@ -2867,6 +2859,8 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, goto err; /* purecov: inspected */ } + DBUG_EXECUTE_IF("sleep_create_like_before_binlogging", my_sleep(6000000);); + // Must be written before unlock if (mysql_bin_log.is_open()) { @@ -2891,8 +2885,7 @@ table_exists: my_error(ER_TABLE_EXISTS_ERROR, MYF(0), table_name); err: - pthread_mutex_lock(&LOCK_open); - unlock_table_name(thd, &src_tables_list); + unlock_table_name(thd, src_table); pthread_mutex_unlock(&LOCK_open); DBUG_RETURN(res); } @@ -2924,7 +2917,7 @@ bool mysql_check_table(THD* thd, TABLE_LIST* tables,HA_CHECK_OPT* check_opt) DBUG_ENTER("mysql_check_table"); DBUG_RETURN(mysql_admin_table(thd, tables, check_opt, "check", lock_type, - 0, HA_OPEN_FOR_REPAIR, 0, 0, + 0, 0, HA_OPEN_FOR_REPAIR, 0, &handler::ha_check, &view_checksum)); } @@ -3077,6 +3070,16 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, bool need_copy_table; bool no_table_reopen= FALSE, varchar= FALSE; frm_type_enum frm_type; + /* + Throw an error if the table to be altered isn't empty. + Used in DATE/DATETIME fields default value checking. + */ + bool error_if_not_empty= FALSE; + /* + A field used for error reporting in DATE/DATETIME fields default + value checking. + */ + create_field *new_datetime_field= 0; DBUG_ENTER("mysql_alter_table"); thd->proc_info="init"; @@ -3097,8 +3100,6 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, alter_info->tablespace_op)); sprintf(new_name_buff,"%s/%s/%s%s",mysql_data_home, db, table_name, reg_ext); unpack_filename(new_name_buff, new_name_buff); - if (lower_case_table_names != 2) - my_casedn_str(files_charset_info, new_name_buff); frm_type= mysql_frm_type(thd, new_name_buff, &table_type); /* Rename a view */ if (frm_type == FRMTYPE_VIEW && !(alter_info->flags & ~ALTER_RENAME)) @@ -3445,6 +3446,22 @@ view_err: my_error(ER_BAD_FIELD_ERROR, MYF(0), def->change, table_name); DBUG_RETURN(TRUE); } + /* + Check that the DATE/DATETIME not null field we are going to add is + either has a default value or the '0000-00-00' is allowed by the + set sql mode. + If the '0000-00-00' value isn't allowed then raise the error_if_not_empty + flag to allow ALTER TABLE only if the table to be altered is empty. + */ + if ((def->sql_type == MYSQL_TYPE_DATE || + def->sql_type == MYSQL_TYPE_NEWDATE || + def->sql_type == MYSQL_TYPE_DATETIME) && !new_datetime_field && + !(~def->flags & (NO_DEFAULT_VALUE_FLAG | NOT_NULL_FLAG)) && + thd->variables.sql_mode & MODE_NO_ZERO_DATE) + { + new_datetime_field= def; + error_if_not_empty= TRUE; + } if (!def->after) new_info.create_list.push_back(def); else if (def->after == first_keyword) @@ -3765,7 +3782,8 @@ view_err: new_table->next_number_field=new_table->found_next_number_field; error= copy_data_between_tables(table, new_table, new_info.create_list, ignore, order_num, order, - &copied, &deleted, alter_info->keys_onoff); + &copied, &deleted, alter_info->keys_onoff, + error_if_not_empty); } else if (!new_table) { @@ -3776,6 +3794,9 @@ view_err: alter_info->keys_onoff); table->file->external_lock(thd, F_UNLCK); VOID(pthread_mutex_unlock(&LOCK_open)); + error= ha_commit_stmt(thd); + if (ha_commit(thd)) + error= 1; } thd->last_insert_id=next_insert_id; // Needed for correct log @@ -3946,16 +3967,6 @@ view_err: goto err; } } - /* The ALTER TABLE is always in its own transaction */ - error = ha_commit_stmt(thd); - if (ha_commit(thd)) - error=1; - if (error) - { - VOID(pthread_mutex_unlock(&LOCK_open)); - broadcast_refresh(); - goto err; - } thd->proc_info="end"; if (mysql_bin_log.is_open()) { @@ -3999,6 +4010,38 @@ end_temporary: DBUG_RETURN(FALSE); err: + /* + No default value was provided for a DATE/DATETIME field, the + current sql_mode doesn't allow the '0000-00-00' value and + the table to be altered isn't empty. + Report error here. + */ + if (error_if_not_empty && thd->row_count) + { + const char *f_val= 0; + enum enum_mysql_timestamp_type t_type= MYSQL_TIMESTAMP_DATE; + switch (new_datetime_field->sql_type) + { + case MYSQL_TYPE_DATE: + case MYSQL_TYPE_NEWDATE: + f_val= "0000-00-00"; + t_type= MYSQL_TIMESTAMP_DATE; + break; + case MYSQL_TYPE_DATETIME: + f_val= "0000-00-00 00:00:00"; + t_type= MYSQL_TIMESTAMP_DATETIME; + break; + default: + /* Shouldn't get here. */ + DBUG_ASSERT(0); + } + bool save_abort_on_warning= thd->abort_on_warning; + thd->abort_on_warning= TRUE; + make_truncated_value_warning(thd, MYSQL_ERROR::WARN_LEVEL_ERROR, + f_val, strlength(f_val), t_type, + new_datetime_field->field_name); + thd->abort_on_warning= save_abort_on_warning; + } DBUG_RETURN(TRUE); } @@ -4010,7 +4053,8 @@ copy_data_between_tables(TABLE *from,TABLE *to, uint order_num, ORDER *order, ha_rows *copied, ha_rows *deleted, - enum enum_enable_or_disable keys_onoff) + enum enum_enable_or_disable keys_onoff, + bool error_if_not_empty) { int error; Copy_field *copy,*copy_end; @@ -4125,6 +4169,12 @@ copy_data_between_tables(TABLE *from,TABLE *to, break; } thd->row_count++; + /* Return error if source table isn't empty. */ + if (error_if_not_empty) + { + error= 1; + break; + } if (to->next_number_field) { if (auto_increment_field_copied) @@ -4165,8 +4215,12 @@ copy_data_between_tables(TABLE *from,TABLE *to, } to->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY); - ha_enable_transaction(thd,TRUE); - + if (ha_enable_transaction(thd, TRUE)) + { + error= 1; + goto err; + } + /* Ensure that the new table is saved properly to disk so that we can do a rename diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc index cf6db22fbcb..5762614e47f 100644 --- a/sql/sql_trigger.cc +++ b/sql/sql_trigger.cc @@ -982,7 +982,7 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db, Lex_input_stream lip(thd, trg_create_str->str, trg_create_str->length); thd->m_lip= &lip; lex_start(thd); - thd->spcont= 0; + thd->spcont= NULL; int err= MYSQLparse((void *)thd); if (err || thd->is_fatal_error) diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 222e33345cc..f4239afc4cd 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -521,6 +521,37 @@ int mysql_update(THD *thd, table->file->unlock_row(); thd->row_count++; } + + /* + todo bug#27571: to avoid asynchronization of `error' and + `error_code' of binlog event constructor + + The concept, which is a bit different for insert(!), is to + replace `error' assignment with the following lines + + killed_status= thd->killed; // get the status of the volatile + + Notice: thd->killed is type of "state" whereas the lhs has + "status" the suffix which translates according to WordNet: a state + at a particular time - at the time of the end of per-row loop in + our case. Binlogging ops are conducted with the status. + + error= (killed_status == THD::NOT_KILLED)? error : 1; + + which applies to most mysql_$query functions. + Event's constructor will accept `killed_status' as an argument: + + Query_log_event qinfo(..., killed_status); + + thd->killed might be changed after killed_status had got cached and this + won't affect binlogging event but other effects remain. + + Open issue: In a case the error happened not because of KILLED - + and then KILLED was caught later still within the loop - we shall + do something to avoid binlogging of incorrect ER_SERVER_SHUTDOWN + error_code. + */ + if (thd->killed && !error) error= 1; // Aborted end_read_record(&info); @@ -915,6 +946,7 @@ bool mysql_multi_update(THD *thd, SELECT_LEX_UNIT *unit, SELECT_LEX *select_lex) { multi_update *result; + bool res; DBUG_ENTER("mysql_multi_update"); if (!(result= new multi_update(table_list, @@ -929,7 +961,7 @@ bool mysql_multi_update(THD *thd, MODE_STRICT_ALL_TABLES)); List total_list; - (void) mysql_select(thd, &select_lex->ref_pointer_array, + res= mysql_select(thd, &select_lex->ref_pointer_array, table_list, select_lex->with_wild, total_list, conds, 0, (ORDER *) NULL, (ORDER *)NULL, (Item *) NULL, @@ -937,6 +969,15 @@ bool mysql_multi_update(THD *thd, options | SELECT_NO_JOIN_CACHE | SELECT_NO_UNLOCK | OPTION_SETUP_TABLES_DONE, result, unit, select_lex); + DBUG_PRINT("info",("res: %d report_error: %d", res, + thd->net.report_error)); + res|= thd->net.report_error; + if (unlikely(res)) + { + /* If we had a another error reported earlier then this will be ignored */ + result->send_error(ER_UNKNOWN_ERROR, ER(ER_UNKNOWN_ERROR)); + result->abort(); + } delete result; thd->abort_on_warning= 0; DBUG_RETURN(FALSE); @@ -970,6 +1011,7 @@ int multi_update::prepare(List ¬_used_values, List_iterator_fast field_it(*fields); List_iterator_fast value_it(*values); uint i, max_fields; + uint leaf_table_count= 0; DBUG_ENTER("multi_update::prepare"); thd->count_cuted_fields= CHECK_FIELD_WARN; @@ -1003,6 +1045,7 @@ int multi_update::prepare(List ¬_used_values, { /* TODO: add support of view of join support */ TABLE *table=table_ref->table; + leaf_table_count++; if (tables_to_update & table->map) { TABLE_LIST *tl= (TABLE_LIST*) thd->memdup((char*) table_ref, @@ -1067,7 +1110,7 @@ int multi_update::prepare(List ¬_used_values, /* Allocate copy fields */ max_fields=0; for (i=0 ; i < table_count ; i++) - set_if_bigger(max_fields, fields_for_table[i]->elements); + set_if_bigger(max_fields, fields_for_table[i]->elements + leaf_table_count); copy_field= new Copy_field[max_fields]; DBUG_RETURN(thd->is_fatal_error != 0); } @@ -1160,13 +1203,22 @@ multi_update::initialize_tables(JOIN *join) trans_safe= transactional_tables= main_table->file->has_transactions(); table_to_update= 0; + /* Any update has at least one pair (field, value) */ + DBUG_ASSERT(fields->elements); + /* + Only one table may be modified by UPDATE of an updatable view. + For an updatable view first_table_for_update indicates this + table. + For a regular multi-update it refers to some updated table. + */ + TABLE *first_table_for_update= ((Item_field *) fields->head())->field->table; + /* Create a temporary table for keys to all tables, except main table */ for (table_ref= update_tables; table_ref; table_ref= table_ref->next_local) { TABLE *table=table_ref->table; uint cnt= table_ref->shared; - Item_field *ifield; - List temp_fields= *fields_for_table[cnt]; + List temp_fields; ORDER group; if (ignore) @@ -1174,34 +1226,63 @@ multi_update::initialize_tables(JOIN *join) if (table == main_table) // First table in join { if (safe_update_on_fly(thd, join->join_tab, table_ref, all_tables, - &temp_fields)) + fields_for_table[cnt])) { table_to_update= main_table; // Update table on the fly continue; } } + if (table == first_table_for_update && table_ref->check_option) + { + table_map unupdated_tables= table_ref->check_option->used_tables() & + ~first_table_for_update->map; + for (TABLE_LIST *tbl_ref =leaves; + unupdated_tables && tbl_ref; + tbl_ref= tbl_ref->next_leaf) + { + if (unupdated_tables & tbl_ref->table->map) + unupdated_tables&= ~tbl_ref->table->map; + else + continue; + if (unupdated_check_opt_tables.push_back(tbl_ref->table)) + DBUG_RETURN(1); + } + } + TMP_TABLE_PARAM *tmp_param= tmp_table_param+cnt; /* Create a temporary table to store all fields that are changed for this table. The first field in the temporary table is a pointer to the - original row so that we can find and update it + original row so that we can find and update it. For the updatable + VIEW a few following fields are rowids of tables used in the CHECK + OPTION condition. */ - /* ok to be on stack as this is not referenced outside of this func */ - Field_string offset(table->file->ref_length, 0, "offset", - table, &my_charset_bin); - /* - The field will be converted to varstring when creating tmp table if - table to be updated was created by mysql 4.1. Deny this. - */ - offset.can_alter_field_type= 0; - if (!(ifield= new Item_field(((Field *) &offset)))) - DBUG_RETURN(1); - ifield->maybe_null= 0; - if (temp_fields.push_front(ifield)) - DBUG_RETURN(1); + List_iterator_fast
tbl_it(unupdated_check_opt_tables); + TABLE *tbl= table; + do + { + Field_string *field= new Field_string(tbl->file->ref_length, 0, + tbl->alias, + tbl, &my_charset_bin); + if (!field) + DBUG_RETURN(1); + /* + The field will be converted to varstring when creating tmp table if + table to be updated was created by mysql 4.1. Deny this. + */ + field->can_alter_field_type= 0; + Item_field *ifield= new Item_field((Field *) field); + if (!ifield) + DBUG_RETURN(1); + ifield->maybe_null= 0; + if (temp_fields.push_back(ifield)) + DBUG_RETURN(1); + } while ((tbl= tbl_it++)); + + temp_fields.concat(fields_for_table[cnt]); /* Make an unique key over the first field to avoid duplicated updates */ bzero((char*) &group, sizeof(group)); @@ -1250,8 +1331,9 @@ multi_update::~multi_update() if (copy_field) delete [] copy_field; thd->count_cuted_fields= CHECK_FIELD_IGNORE; // Restore this setting - if (!trans_safe) + if (!trans_safe) // todo: remove since redundant thd->no_trans_update.all= TRUE; + DBUG_ASSERT(trans_safe || thd->no_trans_update.all); } @@ -1337,8 +1419,15 @@ bool multi_update::send_data(List ¬_used_values) } else { - if (!table->file->has_transactions()) + /* non-transactional or transactional table got modified */ + /* either multi_update class' flag is raised in its branch */ + if (table->file->has_transactions()) + transactional_tables= 1; + else + { + trans_safe= 0; thd->no_trans_update.stmt= TRUE; + } if (table->triggers && table->triggers->process_triggers(thd, TRG_EVENT_UPDATE, TRG_ACTION_AFTER, TRUE)) @@ -1350,10 +1439,26 @@ bool multi_update::send_data(List ¬_used_values) { int error; TABLE *tmp_table= tmp_tables[offset]; - fill_record(thd, tmp_table->field+1, *values_for_table[offset], 1); - /* Store pointer to row */ - memcpy((char*) tmp_table->field[0]->ptr, - (char*) table->file->ref, table->file->ref_length); + /* Store regular updated fields in the row. */ + fill_record(thd, + tmp_table->field + 1 + unupdated_check_opt_tables.elements, + *values_for_table[offset], 1); + /* + For updatable VIEW store rowid of the updated table and + rowids of tables used in the CHECK OPTION condition. + */ + uint field_num= 0; + List_iterator_fast
tbl_it(unupdated_check_opt_tables); + TABLE *tbl= table; + do + { + if (tbl != table) + tbl->file->position(tbl->record[0]); + memcpy((char*) tmp_table->field[field_num]->ptr, + (char*) tbl->file->ref, tbl->file->ref_length); + field_num++; + } while ((tbl= tbl_it++)); + /* Write row, ignoring duplicated updates to a row */ error= tmp_table->file->write_row(tmp_table->record[0]); if (error != HA_ERR_FOUND_DUPP_KEY && error != HA_ERR_FOUND_DUPP_UNIQUE) @@ -1379,8 +1484,8 @@ void multi_update::send_error(uint errcode,const char *err) my_error(errcode, MYF(0), err); /* If nothing updated return */ - if (!updated) - return; + if (updated == 0) /* the counter might be reset in send_eof */ + return; /* and then the query has been binlogged */ /* Something already updated so we have to invalidate cache */ query_cache_invalidate3(thd, update_tables, 1); @@ -1391,11 +1496,43 @@ void multi_update::send_error(uint errcode,const char *err) */ if (trans_safe) - ha_rollback_stmt(thd); - else if (do_update && table_count > 1) { - /* Add warning here */ - VOID(do_updates(0)); + DBUG_ASSERT(transactional_tables); + (void) ha_autocommit_or_rollback(thd, 1); + } + else + { + DBUG_ASSERT(thd->no_trans_update.stmt); + if (do_update && table_count > 1) + { + /* Add warning here */ + /* + todo/fixme: do_update() is never called with the arg 1. + should it change the signature to become argless? + */ + VOID(do_updates(0)); + } + } + if (thd->no_trans_update.stmt) + { + /* + The query has to binlog because there's a modified non-transactional table + either from the query's list or via a stored routine: bug#13270,23333 + */ + if (mysql_bin_log.is_open()) + { + Query_log_event qinfo(thd, thd->query, thd->query_length, + transactional_tables, FALSE); + mysql_bin_log.write(&qinfo); + } + if (!trans_safe) + thd->no_trans_update.all= TRUE; + } + DBUG_ASSERT(trans_safe || !updated || thd->no_trans_update.stmt); + + if (transactional_tables) + { + (void) ha_autocommit_or_rollback(thd, 1); } } @@ -1403,9 +1540,10 @@ void multi_update::send_error(uint errcode,const char *err) int multi_update::do_updates(bool from_send_error) { TABLE_LIST *cur_table; - int local_error; + int local_error= 0; ha_rows org_updated; TABLE *table, *tmp_table; + List_iterator_fast
check_opt_it(unupdated_check_opt_tables); DBUG_ENTER("do_updates"); do_update= 0; // Don't retry this function @@ -1413,8 +1551,8 @@ int multi_update::do_updates(bool from_send_error) DBUG_RETURN(0); for (cur_table= update_tables; cur_table; cur_table= cur_table->next_local) { - byte *ref_pos; bool can_compare_record; + uint offset= cur_table->shared; table = cur_table->table; if (table == table_to_update) @@ -1425,11 +1563,20 @@ int multi_update::do_updates(bool from_send_error) (void) table->file->ha_rnd_init(0); table->file->extra(HA_EXTRA_NO_CACHE); + check_opt_it.rewind(); + while(TABLE *tbl= check_opt_it++) + { + if (tbl->file->ha_rnd_init(1)) + goto err; + tbl->file->extra(HA_EXTRA_CACHE); + } + /* Setup copy functions to copy fields from temporary table */ - List_iterator_fast field_it(*fields_for_table[cur_table->shared]); - Field **field= tmp_table->field+1; // Skip row pointer + List_iterator_fast field_it(*fields_for_table[offset]); + Field **field= tmp_table->field + + 1 + unupdated_check_opt_tables.elements; // Skip row pointers Copy_field *copy_field_ptr= copy_field, *copy_field_end; for ( ; *field ; field++) { @@ -1444,7 +1591,6 @@ int multi_update::do_updates(bool from_send_error) can_compare_record= !(table->file->table_flags() & HA_PARTIAL_COLUMN_READ); - ref_pos= (byte*) tmp_table->field[0]->ptr; for (;;) { if (thd->killed && trans_safe) @@ -1457,8 +1603,20 @@ int multi_update::do_updates(bool from_send_error) continue; // May happen on dup key goto err; } - if ((local_error= table->file->rnd_pos(table->record[0], ref_pos))) - goto err; + + /* call rnd_pos() using rowids from temporary table */ + check_opt_it.rewind(); + TABLE *tbl= table; + uint field_num= 0; + do + { + if((local_error= + tbl->file->rnd_pos(tbl->record[0], + (byte *) tmp_table->field[field_num]->ptr))) + goto err; + field_num++; + } while((tbl= check_opt_it++)); + table->status|= STATUS_UPDATED; store_record(table,record[1]); @@ -1502,12 +1660,19 @@ int multi_update::do_updates(bool from_send_error) if (updated != org_updated) { if (table->file->has_transactions()) - transactional_tables= 1; + transactional_tables= 1; else - trans_safe= 0; // Can't do safe rollback + { + trans_safe= 0; // Can't do safe rollback + thd->no_trans_update.stmt= TRUE; + } } (void) table->file->ha_rnd_end(); (void) tmp_table->file->ha_rnd_end(); + check_opt_it.rewind(); + while (TABLE *tbl= check_opt_it++) + tbl->file->ha_rnd_end(); + } DBUG_RETURN(0); @@ -1521,13 +1686,19 @@ err: err2: (void) table->file->ha_rnd_end(); (void) tmp_table->file->ha_rnd_end(); + check_opt_it.rewind(); + while (TABLE *tbl= check_opt_it++) + tbl->file->ha_rnd_end(); if (updated != org_updated) { if (table->file->has_transactions()) transactional_tables= 1; else + { trans_safe= 0; + thd->no_trans_update.stmt= TRUE; + } } DBUG_RETURN(1); } @@ -1556,20 +1727,26 @@ bool multi_update::send_eof() Write the SQL statement to the binlog if we updated rows and we succeeded or if we updated some non transactional tables. + + The query has to binlog because there's a modified non-transactional table + either from the query's list or via a stored routine: bug#13270,23333 */ - if ((local_error == 0) || (updated && !trans_safe)) + DBUG_ASSERT(trans_safe || !updated || thd->no_trans_update.stmt); + if (local_error == 0 || thd->no_trans_update.stmt) { if (mysql_bin_log.is_open()) { if (local_error == 0) thd->clear_error(); + else + updated= 0; /* if there's an error binlog it here not in ::send_error */ Query_log_event qinfo(thd, thd->query, thd->query_length, transactional_tables, FALSE); if (mysql_bin_log.write(&qinfo) && trans_safe) local_error= 1; // Rollback update } - if (!transactional_tables) + if (!trans_safe) thd->no_trans_update.all= TRUE; } @@ -1581,7 +1758,7 @@ bool multi_update::send_eof() if (local_error > 0) // if the above log write did not fail ... { - /* Safety: If we haven't got an error before (should not happen) */ + /* Safety: If we haven't got an error before (can happen in do_updates) */ my_message(ER_UNKNOWN_ERROR, "An error occured in multi-table update", MYF(0)); return TRUE; diff --git a/sql/sql_view.cc b/sql/sql_view.cc index ba367040b36..6c94d388d0e 100644 --- a/sql/sql_view.cc +++ b/sql/sql_view.cc @@ -205,18 +205,17 @@ fill_defined_view_parts (THD *thd, TABLE_LIST *view) } -/* - Creating/altering VIEW procedure +/** + @brief Creating/altering VIEW procedure - SYNOPSIS - mysql_create_view() - thd - thread handler - views - views to create - mode - VIEW_CREATE_NEW, VIEW_ALTER, VIEW_CREATE_OR_REPLACE + @param thd thread handler + @param views views to create + @param mode VIEW_CREATE_NEW, VIEW_ALTER, VIEW_CREATE_OR_REPLACE - RETURN VALUE - FALSE OK - TRUE Error + @note This function handles both create and alter view commands. + + @retval FALSE Operation was a success. + @retval TRUE An error occured. */ bool mysql_create_view(THD *thd, TABLE_LIST *views, @@ -692,6 +691,7 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view, bool can_be_merged; char dir_buff[FN_REFLEN], file_buff[FN_REFLEN]; LEX_STRING dir, file; + int error= 0; DBUG_ENTER("mysql_register_view"); /* print query */ @@ -702,77 +702,14 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view, lex->unit.print(&str); thd->variables.sql_mode|= sql_mode; } - str.append('\0'); DBUG_PRINT("info", ("View: %s", str.ptr())); - /* print file name */ - (void) my_snprintf(dir_buff, FN_REFLEN, "%s/%s/", - mysql_data_home, view->db); - unpack_filename(dir_buff, dir_buff); - dir.str= dir_buff; - dir.length= strlen(dir_buff); - - file.str= file_buff; - file.length= (strxnmov(file_buff, FN_REFLEN, view->table_name, reg_ext, - NullS) - file_buff); - /* init timestamp */ - if (!view->timestamp.str) - view->timestamp.str= view->timestamp_buffer; - - /* check old .frm */ - { - char path_buff[FN_REFLEN]; - LEX_STRING path; - File_parser *parser; - - path.str= path_buff; - fn_format(path_buff, file.str, dir.str, 0, MY_UNPACK_FILENAME); - path.length= strlen(path_buff); - - if (!access(path.str, F_OK)) - { - if (mode == VIEW_CREATE_NEW) - { - my_error(ER_TABLE_EXISTS_ERROR, MYF(0), view->alias); - DBUG_RETURN(-1); - } - - if (!(parser= sql_parse_prepare(&path, thd->mem_root, 0))) - DBUG_RETURN(1); - - if (!parser->ok() || !is_equal(&view_type, parser->type())) - { - my_error(ER_WRONG_OBJECT, MYF(0), view->db, view->table_name, "VIEW"); - DBUG_RETURN(-1); - } - - /* - read revision number - - TODO: read dependence list, too, to process cascade/restrict - TODO: special cascade/restrict procedure for alter? - */ - if (parser->parse((gptr)view, thd->mem_root, - view_parameters + revision_number_position, 1, - &file_parser_dummy_hook)) - { - DBUG_RETURN(thd->net.report_error? -1 : 0); - } - } - else - { - if (mode == VIEW_ALTER) - { - my_error(ER_NO_SUCH_TABLE, MYF(0), view->db, view->alias); - DBUG_RETURN(-1); - } - } - } /* fill structure */ - view->query.str= (char*)str.ptr(); - view->query.length= str.length()-1; // we do not need last \0 + view->query.str= str.c_ptr_safe(); + view->query.length= str.length(); view->source.str= thd->query + thd->lex->create_view_select_start; - view->source.length= (char *)skip_rear_comments((char *)view->source.str, + view->source.length= (char *)skip_rear_comments(thd->charset(), + (char *)view->source.str, (char *)thd->query + thd->query_length) - view->source.str; @@ -817,6 +754,77 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view, } } loop_out: + /* print file name */ + (void) my_snprintf(dir_buff, FN_REFLEN, "%s/%s/", + mysql_data_home, view->db); + unpack_filename(dir_buff, dir_buff); + dir.str= dir_buff; + dir.length= strlen(dir_buff); + + file.str= file_buff; + file.length= (strxnmov(file_buff, FN_REFLEN, view->table_name, reg_ext, + NullS) - file_buff); + /* init timestamp */ + if (!view->timestamp.str) + view->timestamp.str= view->timestamp_buffer; + + /* check old .frm */ + { + char path_buff[FN_REFLEN]; + LEX_STRING path; + File_parser *parser; + + path.str= path_buff; + fn_format(path_buff, file.str, dir.str, 0, MY_UNPACK_FILENAME); + path.length= strlen(path_buff); + + if (!access(path.str, F_OK)) + { + if (mode == VIEW_CREATE_NEW) + { + my_error(ER_TABLE_EXISTS_ERROR, MYF(0), view->alias); + error= -1; + goto err; + } + + if (!(parser= sql_parse_prepare(&path, thd->mem_root, 0))) + { + error= 1; + goto err; + } + + if (!parser->ok() || !is_equal(&view_type, parser->type())) + { + my_error(ER_WRONG_OBJECT, MYF(0), view->db, view->table_name, "VIEW"); + error= -1; + goto err; + } + + /* + read revision number + + TODO: read dependence list, too, to process cascade/restrict + TODO: special cascade/restrict procedure for alter? + */ + if (parser->parse((gptr)view, thd->mem_root, + view_parameters + revision_number_position, 1, + &file_parser_dummy_hook)) + { + error= thd->net.report_error? -1 : 0; + goto err; + } + } + else + { + if (mode == VIEW_ALTER) + { + my_error(ER_NO_SUCH_TABLE, MYF(0), view->db, view->alias); + error= -1; + goto err; + } + } + } + /* Check that table of main select do not used in subqueries. @@ -841,15 +849,23 @@ loop_out: !view->updatable_view) { my_error(ER_VIEW_NONUPD_CHECK, MYF(0), view->db, view->table_name); - DBUG_RETURN(-1); + error= -1; + goto err; } if (sql_create_definition_file(&dir, &file, view_file_type, (gptr)view, view_parameters, num_view_backups)) { - DBUG_RETURN(thd->net.report_error? -1 : 1); + error= thd->net.report_error? -1 : 1; + goto err; } DBUG_RETURN(0); +err: + view->query.str= NULL; + view->query.length= 0; + view->md5.str= NULL; + view->md5.length= 0; + DBUG_RETURN(error); } diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index c1da870960b..5583567f1ea 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1483,7 +1483,6 @@ create: lex->create_info.options=$2 | $4; lex->create_info.db_type= (enum db_type) lex->thd->variables.table_type; lex->create_info.default_table_charset= NULL; - lex->name=0; } create2 { Lex->current_select= &Lex->select_lex; } @@ -2763,27 +2762,15 @@ create2: | opt_create_table_options create3 {} | LIKE table_ident { - LEX *lex=Lex; - THD *thd= lex->thd; - if (!(lex->name= (char *)$2)) + Lex->create_info.options|= HA_LEX_CREATE_TABLE_LIKE; + if (!Lex->select_lex.add_table_to_list(YYTHD, $2, NULL, 0, TL_READ)) MYSQL_YYABORT; - if ($2->db.str == NULL && - thd->copy_db_to(&($2->db.str), &($2->db.length))) - { - MYSQL_YYABORT; - } } | '(' LIKE table_ident ')' { - LEX *lex=Lex; - THD *thd= lex->thd; - if (!(lex->name= (char *)$3)) + Lex->create_info.options|= HA_LEX_CREATE_TABLE_LIKE; + if (!Lex->select_lex.add_table_to_list(YYTHD, $3, NULL, 0, TL_READ)) MYSQL_YYABORT; - if ($3->db.str == NULL && - thd->copy_db_to(&($3->db.str), &($3->db.length))) - { - MYSQL_YYABORT; - } } ; @@ -3684,6 +3671,11 @@ alter: { THD *thd= YYTHD; LEX *lex= thd->lex; + if (lex->sphead) + { + my_error(ER_SP_BADSTATEMENT, MYF(0), "ALTER VIEW"); + MYSQL_YYABORT; + } lex->sql_command= SQLCOM_CREATE_VIEW; lex->create_view_mode= VIEW_ALTER; /* first table in list is target VIEW name */ @@ -4376,8 +4368,12 @@ select_option: } | SQL_CACHE_SYM { - /* Honor this flag only if SQL_NO_CACHE wasn't specified. */ - if (Lex->select_lex.sql_cache != SELECT_LEX::SQL_NO_CACHE) + /* + Honor this flag only if SQL_NO_CACHE wasn't specified AND + we are parsing the outermost SELECT in the query. + */ + if (Lex->select_lex.sql_cache != SELECT_LEX::SQL_NO_CACHE && + Lex->current_select == &Lex->select_lex) { Lex->safe_to_cache_query=1; Lex->select_lex.options|= OPTION_TO_QUERY_CACHE; @@ -5163,8 +5159,8 @@ simple_expr: $$= new Item_func_sp(Lex->current_context(), name, *$4); else $$= new Item_func_sp(Lex->current_context(), name); - lex->safe_to_cache_query=0; - } + } + lex->safe_to_cache_query=0; } | UNIQUE_USERS '(' text_literal ',' NUM ',' NUM ',' expr_list ')' { @@ -5433,8 +5429,11 @@ opt_distinct: |DISTINCT { $$ = 1; }; opt_gconcat_separator: - /* empty */ { $$ = new (YYTHD->mem_root) String(",",1,default_charset_info); } - |SEPARATOR_SYM text_string { $$ = $2; }; + /* empty */ + { + $$= new (YYTHD->mem_root) String(",", 1, &my_charset_latin1); + } + | SEPARATOR_SYM text_string { $$ = $2; }; opt_gorder_clause: @@ -5833,7 +5832,8 @@ select_derived2: LEX *lex= Lex; lex->derived_tables|= DERIVED_SUBQUERY; if (lex->sql_command == (int)SQLCOM_HA_READ || - lex->sql_command == (int)SQLCOM_KILL) + lex->sql_command == (int)SQLCOM_KILL || + lex->sql_command == (int)SQLCOM_PURGE) { my_parse_error(ER(ER_SYNTAX_ERROR)); MYSQL_YYABORT; @@ -6214,6 +6214,9 @@ limit_options: ; limit_option: param_marker + { + ((Item_param *) $1)->set_strict_type(INT_RESULT); + } | ULONGLONG_NUM { $$= new Item_uint($1.str, $1.length); } | LONG_NUM { $$= new Item_uint($1.str, $1.length); } | NUM { $$= new Item_uint($1.str, $1.length); } @@ -6561,7 +6564,7 @@ insert_lock_option: insert visible only after the table unlocking but everyone can read table. */ - $$= (Lex->sphead ? TL_WRITE :TL_WRITE_CONCURRENT_INSERT); + $$= (Lex->sphead ? TL_WRITE_DEFAULT : TL_WRITE_CONCURRENT_INSERT); #else $$= TL_WRITE_CONCURRENT_INSERT; #endif @@ -6739,7 +6742,7 @@ insert_update_elem: }; opt_low_priority: - /* empty */ { $$= YYTHD->update_lock_default; } + /* empty */ { $$= TL_WRITE_DEFAULT; } | LOW_PRIORITY { $$= TL_WRITE_LOW_PRIORITY; }; /* Delete rows from a table */ @@ -6750,7 +6753,7 @@ delete: LEX *lex= Lex; lex->sql_command= SQLCOM_DELETE; mysql_init_select(lex); - lex->lock_option= lex->thd->update_lock_default; + lex->lock_option= TL_WRITE_DEFAULT; lex->ignore= 0; lex->select_lex.init_order(); } @@ -7285,6 +7288,7 @@ purge: { LEX *lex=Lex; lex->type=0; + lex->sql_command = SQLCOM_PURGE; } purge_options {} ; @@ -7296,7 +7300,6 @@ purge_options: purge_option: TO_SYM TEXT_STRING_sys { - Lex->sql_command = SQLCOM_PURGE; Lex->to_log = $2.str; } | BEFORE_SYM expr @@ -7415,7 +7418,7 @@ opt_local: | LOCAL_SYM { $$=1;}; load_data_lock: - /* empty */ { $$= YYTHD->update_lock_default; } + /* empty */ { $$= TL_WRITE_DEFAULT; } | CONCURRENT { #ifdef HAVE_QUERY_CACHE @@ -7423,7 +7426,7 @@ load_data_lock: Ignore this option in SP to avoid problem with query cache */ if (Lex->sphead != 0) - $$= YYTHD->update_lock_default; + $$= TL_WRITE_DEFAULT; else #endif $$= TL_WRITE_CONCURRENT_INSERT; @@ -8736,7 +8739,7 @@ table_lock: lock_option: READ_SYM { $$=TL_READ_NO_INSERT; } - | WRITE_SYM { $$=YYTHD->update_lock_default; } + | WRITE_SYM { $$=TL_WRITE_DEFAULT; } | LOW_PRIORITY WRITE_SYM { $$=TL_WRITE_LOW_PRIORITY; } | READ_SYM LOCAL_SYM { $$= TL_READ; } ; @@ -9415,7 +9418,8 @@ subselect_start: { LEX *lex=Lex; if (lex->sql_command == (int)SQLCOM_HA_READ || - lex->sql_command == (int)SQLCOM_KILL) + lex->sql_command == (int)SQLCOM_KILL || + lex->sql_command == (int)SQLCOM_PURGE) { my_parse_error(ER(ER_SYNTAX_ERROR)); MYSQL_YYABORT; diff --git a/sql/stacktrace.c b/sql/stacktrace.c index d8e9b7fd883..c947beafac3 100644 --- a/sql/stacktrace.c +++ b/sql/stacktrace.c @@ -241,6 +241,15 @@ void write_core(int sig) void write_core(int sig) { signal(sig, SIG_DFL); +#ifdef HAVE_gcov + /* + For GCOV build, crashing will prevent the writing of code coverage + information from this process, causing gcov output to be incomplete. + So we force the writing of coverage information here before terminating. + */ + extern void __gcov_flush(void); + __gcov_flush(); +#endif pthread_kill(pthread_self(), sig); #if defined(P_MYID) && !defined(SCO) /* On Solaris, the above kill is not enough */ diff --git a/sql/structs.h b/sql/structs.h index de4cc25db9f..28bdd8c1519 100644 --- a/sql/structs.h +++ b/sql/structs.h @@ -190,7 +190,8 @@ enum SHOW_TYPE SHOW_NET_COMPRESSION, SHOW_RPL_STATUS, SHOW_SLAVE_RUNNING, SHOW_SLAVE_RETRIED_TRANS, SHOW_KEY_CACHE_LONG, SHOW_KEY_CACHE_CONST_LONG, SHOW_KEY_CACHE_LONGLONG, - SHOW_LONG_STATUS, SHOW_LONG_CONST_STATUS, SHOW_SLAVE_SKIP_ERRORS + SHOW_LONG_STATUS, SHOW_LONG_CONST_STATUS, SHOW_SLAVE_SKIP_ERRORS, + SHOW_LONGLONG_STATUS }; enum SHOW_COMP_OPTION { SHOW_OPTION_YES, SHOW_OPTION_NO, SHOW_OPTION_DISABLED}; diff --git a/sql/table.cc b/sql/table.cc index fb2012a79d1..4e0f2b5d287 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -1442,7 +1442,19 @@ File create_frm(THD *thd, my_string name, const char *db, fileinfo[3]= (uchar) ha_checktype(thd,create_info->db_type,0,0); fileinfo[4]=1; int2store(fileinfo+6,IO_SIZE); /* Next block starts here */ - key_length=keys*(7+NAME_LEN+MAX_REF_PARTS*9)+16; + /* + Keep in sync with pack_keys() in unireg.cc + For each key: + 8 bytes for the key header + 9 bytes for each key-part (MAX_REF_PARTS) + NAME_LEN bytes for the name + 1 byte for the NAMES_SEP_CHAR (before the name) + For all keys: + 6 bytes for the header + 1 byte for the NAMES_SEP_CHAR (after the last name) + 9 extra bytes (padding for safety? alignment?) + */ + key_length= keys * (8 + MAX_REF_PARTS * 9 + NAME_LEN + 1) + 16; length= next_io_size((ulong) (IO_SIZE+key_length+reclength+ create_info->extra_size)); int4store(fileinfo+10,length); @@ -1985,6 +1997,47 @@ bool st_table_list::prep_where(THD *thd, Item **conds, } +/* + Merge ON expressions for a view + + SYNOPSIS + merge_on_conds() + thd thread handle + table table for the VIEW + is_cascaded TRUE <=> merge ON expressions from underlying views + + DESCRIPTION + This function returns the result of ANDing the ON expressions + of the given view and all underlying views. The ON expressions + of the underlying views are added only if is_cascaded is TRUE. + + RETURN + Pointer to the built expression if there is any. + Otherwise and in the case of a failure NULL is returned. +*/ + +static Item * +merge_on_conds(THD *thd, TABLE_LIST *table, bool is_cascaded) +{ + DBUG_ENTER("merge_on_conds"); + + Item *cond= NULL; + DBUG_PRINT("info", ("alias: %s", table->alias)); + if (table->on_expr) + cond= table->on_expr->copy_andor_structure(thd); + if (!table->nested_join) + DBUG_RETURN(cond); + List_iterator li(table->nested_join->join_list); + while (TABLE_LIST *tbl= li++) + { + if (tbl->view && !is_cascaded) + continue; + cond= and_conds(cond, merge_on_conds(thd, tbl, is_cascaded)); + } + DBUG_RETURN(cond); +} + + /* Prepare check option expression of table @@ -2001,8 +2054,8 @@ bool st_table_list::prep_where(THD *thd, Item **conds, VIEW_CHECK_LOCAL option. NOTE - This method build check options for every call - (usual execution or every SP/PS call) + This method builds check option condition to use it later on + every call (usual execution or every SP/PS call). This method have to be called after WHERE preparation (st_table_list::prep_where) @@ -2014,38 +2067,42 @@ bool st_table_list::prep_where(THD *thd, Item **conds, bool st_table_list::prep_check_option(THD *thd, uint8 check_opt_type) { DBUG_ENTER("st_table_list::prep_check_option"); + bool is_cascaded= check_opt_type == VIEW_CHECK_CASCADED; for (TABLE_LIST *tbl= merge_underlying_list; tbl; tbl= tbl->next_local) { /* see comment of check_opt_type parameter */ - if (tbl->view && - tbl->prep_check_option(thd, - ((check_opt_type == VIEW_CHECK_CASCADED) ? - VIEW_CHECK_CASCADED : - VIEW_CHECK_NONE))) - { + if (tbl->view && tbl->prep_check_option(thd, (is_cascaded ? + VIEW_CHECK_CASCADED : + VIEW_CHECK_NONE))) DBUG_RETURN(TRUE); - } } - if (check_opt_type) + if (check_opt_type && !check_option_processed) { - Item *item= 0; + Query_arena *arena= thd->stmt_arena, backup; + arena= thd->activate_stmt_arena_if_needed(&backup); // For easier test + if (where) { DBUG_ASSERT(where->fixed); - item= where->copy_andor_structure(thd); + check_option= where->copy_andor_structure(thd); } - if (check_opt_type == VIEW_CHECK_CASCADED) + if (is_cascaded) { for (TABLE_LIST *tbl= merge_underlying_list; tbl; tbl= tbl->next_local) { if (tbl->check_option) - item= and_conds(item, tbl->check_option); + check_option= and_conds(check_option, tbl->check_option); } } - if (item) - thd->change_item_tree(&check_option, item); + check_option= and_conds(check_option, + merge_on_conds(thd, this, is_cascaded)); + + if (arena) + thd->restore_active_arena(arena, &backup); + check_option_processed= TRUE; + } if (check_option) @@ -2150,7 +2207,7 @@ void st_table_list::cleanup_items() check CHECK OPTION condition SYNOPSIS - check_option() + st_table_list::view_check_option() ignore_failure ignore check option fail RETURN diff --git a/sql/table.h b/sql/table.h index da2c90ab212..d4dc3e8c0b8 100644 --- a/sql/table.h +++ b/sql/table.h @@ -137,7 +137,12 @@ typedef struct st_table_share const char *table_name; /* Table name (for open) */ const char *path; /* Path to .frm file (from datadir) */ LEX_STRING connect_string; - key_map keys_in_use; /* Keys in use for table */ + + /* + Set of keys in use, implemented as a Bitmap. + Excludes keys disabled by ALTER TABLE ... DISABLE KEYS. + */ + key_map keys_in_use; key_map keys_for_keyread; ulong avg_row_length; /* create information */ ulong raid_chunksize; @@ -208,7 +213,21 @@ struct st_table { byte *record[2]; /* Pointer to records */ byte *insert_values; /* used by INSERT ... UPDATE */ - key_map quick_keys, used_keys, keys_in_use_for_query; + key_map quick_keys, used_keys; + + /* + A set of keys that can be used in the query that references this + table + + All indexes disabled on the table's TABLE_SHARE (see TABLE::s) will be + subtracted from this set upon instantiation. Thus for any TABLE t it holds + that t.keys_in_use_for_query is a subset of t.s.keys_in_use. Generally we + must not introduce any new keys here (see setup_tables). + + The set is implemented as a bitmap. + */ + key_map keys_in_use_for_query; + key_map merge_keys; KEY *key_info; /* data of keys in database */ Field *next_number_field, /* Set if next_number is activated */ @@ -666,6 +685,8 @@ typedef struct st_table_list bool compact_view_format; /* Use compact format for SHOW CREATE VIEW */ /* view where processed */ bool where_processed; + /* TRUE <=> VIEW CHECK OPTION expression has been processed */ + bool check_option_processed; /* FRMTYPE_ERROR if any type is acceptable */ enum frm_type_enum required_type; char timestamp_buffer[20]; /* buffer for timestamp (19+1) */ diff --git a/sql/udf_example.c b/sql/udf_example.c index 2bb4fe92d2f..0f28c2a14b0 100644 --- a/sql/udf_example.c +++ b/sql/udf_example.c @@ -130,7 +130,8 @@ typedef long long longlong; #include /* To get strmov() */ #else /* when compiled as standalone */ -#define strmov(a,b) strcpy(a,b) +#include +#define strmov(a,b) stpcpy(a,b) #define bzero(a,b) memset(a,0,b) #define memcpy_fixed(a,b,c) memcpy(a,b,c) #endif diff --git a/sql/uniques.cc b/sql/uniques.cc index 9eb827f62a3..7c197d2a2e9 100644 --- a/sql/uniques.cc +++ b/sql/uniques.cc @@ -361,17 +361,12 @@ Unique::reset() } /* - The comparison function, passed to queue_init() in merge_walk() must + The comparison function, passed to queue_init() in merge_walk() and in + merge_buffers() when the latter is called from Uniques::get() must use comparison function of Uniques::tree, but compare members of struct BUFFPEK. */ -struct BUFFPEK_COMPARE_CONTEXT -{ - qsort_cmp2 key_compare; - void *key_compare_arg; -}; - C_MODE_START static int buffpek_compare(void *arg, byte *key_ptr1, byte *key_ptr2) @@ -630,6 +625,10 @@ bool Unique::get(TABLE *table) sort_param.unique_buff= sort_buffer+(sort_param.keys* sort_param.sort_length); + sort_param.compare= (qsort2_cmp) buffpek_compare; + sort_param.cmp_context.key_compare= tree.compare; + sort_param.cmp_context.key_compare_arg= tree.custom_arg; + /* Merge the buffers to one file, removing duplicates */ if (merge_many_buff(&sort_param,sort_buffer,file_ptr,&maxbuffer,&file)) goto err; diff --git a/sql/unireg.h b/sql/unireg.h index 886b3d99212..81ca18c1d32 100644 --- a/sql/unireg.h +++ b/sql/unireg.h @@ -71,6 +71,7 @@ #define MAX_TIME_WIDTH 23 /* -DDDDDD HH:MM:SS.###### */ #define MAX_DATETIME_FULL_WIDTH 29 /* YYYY-MM-DD HH:MM:SS.###### AM */ #define MAX_DATETIME_WIDTH 19 /* YYYY-MM-DD HH:MM:SS */ +#define MAX_DATETIME_COMPRESSED_WIDTH 14 /* YYYYMMDDHHMMSS */ #define MAX_TABLES (sizeof(table_map)*8-3) /* Max tables in join */ #define PARAM_TABLE_BIT (((table_map) 1) << (sizeof(table_map)*8-3)) @@ -119,7 +120,7 @@ #define SPECIAL_NO_HOST_CACHE 512 /* Don't cache hosts */ #define SPECIAL_SHORT_LOG_FORMAT 1024 #define SPECIAL_SAFE_MODE 2048 -#define SPECIAL_LOG_QUERIES_NOT_USING_INDEXES 4096 /* Log q not using indexes */ +#define SPECIAL_LOG_QUERIES_NOT_USING_INDEXES 4096 /* Obsolete */ /* Extern defines */ #define store_record(A,B) bmove_align((A)->B,(A)->record[0],(size_t) (A)->s->reclength) diff --git a/strings/ctype-big5.c b/strings/ctype-big5.c index be04d19a756..8bbbcac63e4 100644 --- a/strings/ctype-big5.c +++ b/strings/ctype-big5.c @@ -6400,7 +6400,7 @@ CHARSET_INFO my_charset_big5_chinese_ci= 0, /* min_sort_char */ 255, /* max_sort_char */ ' ', /* pad char */ - 0, /* escape_with_backslash_is_dangerous */ + 1, /* escape_with_backslash_is_dangerous */ &my_charset_big5_handler, &my_collation_big5_chinese_ci_handler }; @@ -6433,7 +6433,7 @@ CHARSET_INFO my_charset_big5_bin= 0, /* min_sort_char */ 255, /* max_sort_char */ ' ', /* pad char */ - 0, /* escape_with_backslash_is_dangerous */ + 1, /* escape_with_backslash_is_dangerous */ &my_charset_big5_handler, &my_collation_mb_bin_handler }; diff --git a/strings/ctype-bin.c b/strings/ctype-bin.c index e9de0ade557..f9d29ca1739 100644 --- a/strings/ctype-bin.c +++ b/strings/ctype-bin.c @@ -271,6 +271,29 @@ static int my_wc_mb_bin(CHARSET_INFO *cs __attribute__((unused)), } +void my_hash_sort_8bit_bin(CHARSET_INFO *cs __attribute__((unused)), + const uchar *key, uint len,ulong *nr1, ulong *nr2) +{ + const uchar *pos = key; + + key+= len; + + /* + Remove trailing spaces. We have to do this to be able to compare + 'A ' and 'A' as identical + */ + while (key > pos && key[-1] == ' ') + key--; + + for (; pos < (uchar*) key ; pos++) + { + nr1[0]^=(ulong) ((((uint) nr1[0] & 63)+nr2[0]) * + ((uint)*pos)) + (nr1[0] << 8); + nr2[0]+=3; + } +} + + void my_hash_sort_bin(CHARSET_INFO *cs __attribute__((unused)), const uchar *key, uint len,ulong *nr1, ulong *nr2) { @@ -471,7 +494,7 @@ MY_COLLATION_HANDLER my_collation_8bit_bin_handler = my_wildcmp_bin, my_strcasecmp_bin, my_instr_bin, - my_hash_sort_bin, + my_hash_sort_8bit_bin, my_propagate_simple }; diff --git a/strings/ctype-gbk.c b/strings/ctype-gbk.c index c7160e923a9..8ac7d62c9da 100644 --- a/strings/ctype-gbk.c +++ b/strings/ctype-gbk.c @@ -10046,7 +10046,7 @@ CHARSET_INFO my_charset_gbk_chinese_ci= 0, /* min_sort_char */ 255, /* max_sort_char */ ' ', /* pad char */ - 0, /* escape_with_backslash_is_dangerous */ + 1, /* escape_with_backslash_is_dangerous */ &my_charset_handler, &my_collation_ci_handler }; @@ -10078,7 +10078,7 @@ CHARSET_INFO my_charset_gbk_bin= 0, /* min_sort_char */ 255, /* max_sort_char */ ' ', /* pad char */ - 0, /* escape_with_backslash_is_dangerous */ + 1, /* escape_with_backslash_is_dangerous */ &my_charset_handler, &my_collation_mb_bin_handler }; diff --git a/strings/ctype-mb.c b/strings/ctype-mb.c index 40cec669766..b370714e464 100644 --- a/strings/ctype-mb.c +++ b/strings/ctype-mb.c @@ -467,6 +467,13 @@ static void my_hash_sort_mb_bin(CHARSET_INFO *cs __attribute__((unused)), key+= len; + /* + Remove trailing spaces. We have to do this to be able to compare + 'A ' and 'A' as identical + */ + while (key > pos && key[-1] == ' ') + key--; + for (; pos < (uchar*) key ; pos++) { nr1[0]^=(ulong) ((((uint) nr1[0] & 63)+nr2[0]) * @@ -556,6 +563,8 @@ my_bool my_like_range_mb(CHARSET_INFO *cs, char *min_end= min_str + res_length; char *max_end= max_str + res_length; uint maxcharlen= res_length / cs->mbmaxlen; + const char *contraction_flags= cs->contractions ? + ((const char*) cs->contractions) + 0x40*0x40 : NULL; for (; ptr != end && min_str != min_end && maxcharlen ; maxcharlen--) { @@ -564,6 +573,7 @@ my_bool my_like_range_mb(CHARSET_INFO *cs, ptr++; /* Skip escape */ else if (*ptr == w_one || *ptr == w_many) /* '_' and '%' in SQL */ { +fill_max_and_min: /* Calculate length of keys: 'a\0\0... is the smallest possible string when we have space expand @@ -595,8 +605,74 @@ my_bool my_like_range_mb(CHARSET_INFO *cs, *min_str++= *max_str++= *ptr++; } else - *min_str++= *max_str++= *ptr++; + { + /* + Special case for collations with contractions. + For example, in Chezh, 'ch' is a separate letter + which is sorted between 'h' and 'i'. + If the pattern 'abc%', 'c' at the end can mean: + - letter 'c' itself, + - beginning of the contraction 'ch'. + If we simply return this LIKE range: + + 'abc\min\min\min' and 'abc\max\max\max' + + then this query: SELECT * FROM t1 WHERE a LIKE 'abc%' + will only find values starting from 'abc[^h]', + but won't find values starting from 'abch'. + + We must ignore contraction heads followed by w_one or w_many. + ('Contraction head' means any letter which can be the first + letter in a contraction) + + For example, for Czech 'abc%', we will return LIKE range, + which is equal to LIKE range for 'ab%': + + 'ab\min\min\min\min' and 'ab\max\max\max\max'. + + */ + if (contraction_flags && ptr + 1 < end && + contraction_flags[(uchar) *ptr]) + { + /* Ptr[0] is a contraction head. */ + + if (ptr[1] == w_one || ptr[1] == w_many) + { + /* Contraction head followed by a wildcard, quit. */ + goto fill_max_and_min; + } + + /* + Some letters can be both contraction heads and contraction tails. + For example, in Danish 'aa' is a separate single letter which + is sorted after 'z'. So 'a' can be both head and tail. + + If ptr[0]+ptr[1] is a contraction, + then put both letters together. + + If ptr[1] can be a contraction part, but ptr[0]+ptr[1] + is not a contraction, then we put only ptr[0], + and continue with ptr[1] on the next loop. + */ + if (contraction_flags[(uchar) ptr[1]] && + cs->contractions[(*ptr-0x40)*0x40 + ptr[1] - 0x40]) + { + /* Contraction found */ + if (maxcharlen == 1 || min_str + 1 >= min_end) + { + /* Both contraction parts don't fit, quit */ + goto fill_max_and_min; + } + + /* Put contraction head */ + *min_str++= *max_str++= *ptr++; + maxcharlen--; + } + } + /* Put contraction tail, or a single character */ + *min_str++= *max_str++= *ptr++; + } } *min_length= *max_length = (uint) (min_str - min_org); diff --git a/strings/ctype-simple.c b/strings/ctype-simple.c index e57204f8d33..fca5607e152 100644 --- a/strings/ctype-simple.c +++ b/strings/ctype-simple.c @@ -180,7 +180,7 @@ int my_strnncollsp_simple(CHARSET_INFO * cs, const uchar *a, uint a_length, for (end= a + a_length-length; a < end ; a++) { if (*a != ' ') - return (*a < ' ') ? -swap : swap; + return (map[*a] < ' ') ? -swap : swap; } } return res; diff --git a/strings/ctype-sjis.c b/strings/ctype-sjis.c index a66a7a000a6..6a7c7d7c0a0 100644 --- a/strings/ctype-sjis.c +++ b/strings/ctype-sjis.c @@ -4694,7 +4694,7 @@ CHARSET_INFO my_charset_sjis_japanese_ci= 0, /* min_sort_char */ 255, /* max_sort_char */ ' ', /* pad char */ - 0, /* escape_with_backslash_is_dangerous */ + 1, /* escape_with_backslash_is_dangerous */ &my_charset_handler, &my_collation_ci_handler }; @@ -4726,7 +4726,7 @@ CHARSET_INFO my_charset_sjis_bin= 0, /* min_sort_char */ 255, /* max_sort_char */ ' ', /* pad char */ - 0, /* escape_with_backslash_is_dangerous */ + 1, /* escape_with_backslash_is_dangerous */ &my_charset_handler, &my_collation_mb_bin_handler }; diff --git a/strings/ctype-uca.c b/strings/ctype-uca.c index 1263882846d..81fb9ee1970 100644 --- a/strings/ctype-uca.c +++ b/strings/ctype-uca.c @@ -7937,10 +7937,16 @@ static my_bool create_tailoring(CHARSET_INFO *cs, void *(*alloc)(uint)) /* Now process contractions */ if (ncontractions) { - uint size= 0x40*0x40*sizeof(uint16); /* 8K, for basic latin letter only */ + /* + 8K for weights for basic latin letter pairs, + plus 256 bytes for "is contraction part" flags. + */ + uint size= 0x40*0x40*sizeof(uint16) + 256; + char *contraction_flags; if (!(cs->contractions= (uint16*) (*alloc)(size))) return 1; bzero((void*)cs->contractions, size); + contraction_flags= ((char*) cs->contractions) + 0x40*0x40; for (i=0; i < rc; i++) { if (rule[i].curr[1]) @@ -7966,6 +7972,9 @@ static my_bool create_tailoring(CHARSET_INFO *cs, void *(*alloc)(uint)) /* Copy base weight applying primary difference */ cs->contractions[offsc]= offsb[0] + rule[i].diff[0]; + /* Mark both letters as "is contraction part */ + contraction_flags[rule[i].curr[0]]= 1; + contraction_flags[rule[i].curr[1]]= 1; } } } @@ -8073,7 +8082,7 @@ MY_COLLATION_HANDLER my_collation_ucs2_uca_handler = my_propagate_complex }; -CHARSET_INFO my_charset_ucs2_general_uca= +CHARSET_INFO my_charset_ucs2_unicode_ci= { 128,0,0, /* number */ MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE, @@ -8734,7 +8743,7 @@ static uchar ctype_utf8[] = { extern MY_CHARSET_HANDLER my_charset_utf8_handler; -CHARSET_INFO my_charset_utf8_general_uca_ci= +CHARSET_INFO my_charset_utf8_unicode_ci= { 192,0,0, /* number */ MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE, diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c index 6b1ba3c1ef6..b5353c55e4c 100644 --- a/strings/ctype-ucs2.c +++ b/strings/ctype-ucs2.c @@ -1484,7 +1484,10 @@ void my_hash_sort_ucs2_bin(CHARSET_INFO *cs __attribute__((unused)), const uchar *pos = key; key+= len; - + + while (key > pos+1 && key[-1] == ' ' && key[-2] == '\0') + key-= 2; + for (; pos < (uchar*) key ; pos++) { nr1[0]^=(ulong) ((((uint) nr1[0] & 63)+nr2[0]) * @@ -1521,6 +1524,8 @@ my_bool my_like_range_ucs2(CHARSET_INFO *cs, char *min_org=min_str; char *min_end=min_str+res_length; uint charlen= res_length / cs->mbmaxlen; + const char *contraction_flags= cs->contractions ? + ((const char*) cs->contractions) + 0x40*0x40 : NULL; for ( ; ptr + 1 < end && min_str + 1 < min_end && charlen > 0 ; ptr+=2, charlen--) @@ -1542,6 +1547,7 @@ my_bool my_like_range_ucs2(CHARSET_INFO *cs, } if (ptr[0] == '\0' && ptr[1] == w_many) /* '%' in SQL */ { +fill_max_and_min: /* Calculate length of keys: 'a\0\0... is the smallest possible string when we have space expand @@ -1558,6 +1564,38 @@ my_bool my_like_range_ucs2(CHARSET_INFO *cs, } while (min_str + 1 < min_end); return 0; } + + if (contraction_flags && ptr + 3 < end && + ptr[0] == '\0' && contraction_flags[(uchar) ptr[1]]) + { + /* Contraction head found */ + if (ptr[2] == '\0' && (ptr[3] == w_one || ptr[3] == w_many)) + { + /* Contraction head followed by a wildcard, quit */ + goto fill_max_and_min; + } + + /* + Check if the second letter can be contraction part, + and if two letters really produce a contraction. + */ + if (ptr[2] == '\0' && contraction_flags[(uchar) ptr[3]] && + cs->contractions[(ptr[1]-0x40)*0x40 + ptr[3] - 0x40]) + { + /* Contraction found */ + if (charlen == 1 || min_str + 2 >= min_end) + { + /* Full contraction doesn't fit, quit */ + goto fill_max_and_min; + } + + /* Put contraction head */ + *min_str++= *max_str++= *ptr++; + *min_str++= *max_str++= *ptr++; + charlen--; + } + } + /* Put contraction tail, or a single character */ *min_str++= *max_str++ = ptr[0]; *min_str++= *max_str++ = ptr[1]; } diff --git a/strings/ctype.c b/strings/ctype.c index f02b5542e78..e7399c5438b 100644 --- a/strings/ctype.c +++ b/strings/ctype.c @@ -123,7 +123,7 @@ static struct my_cs_file_section_st * cs_file_sec(const char *attr, uint len) } #define MY_CS_CSDESCR_SIZE 64 -#define MY_CS_TAILORING_SIZE 128 +#define MY_CS_TAILORING_SIZE 1024 typedef struct my_cs_file_info { diff --git a/strings/decimal.c b/strings/decimal.c index 1ae75167794..f1f02f3a071 100644 --- a/strings/decimal.c +++ b/strings/decimal.c @@ -1517,9 +1517,10 @@ decimal_round(decimal_t *from, decimal_t *to, int scale, dec1 *p0= buf0+intg0+max(frac1, frac0); dec1 *p1= buf1+intg1+max(frac1, frac0); - to->buf[0]= 0; while (buf0 < p0) *(--p1) = *(--p0); + if (unlikely(intg1 > intg0)) + to->buf[0]= 0; intg0= intg1; buf0=to->buf; diff --git a/strings/strtod.c b/strings/strtod.c index 7196cafb2c9..5fe59d10bd2 100644 --- a/strings/strtod.c +++ b/strings/strtod.c @@ -31,13 +31,40 @@ #define MAX_DBL_EXP 308 #define MAX_RESULT_FOR_MAX_EXP 1.7976931348623157 -static double scaler10[] = { - 1.0, 1e10, 1e20, 1e30, 1e40, 1e50, 1e60, 1e70, 1e80, 1e90 -}; -static double scaler1[] = { - 1.0, 10.0, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9 -}; +const double log_10[] = { + 1e000, 1e001, 1e002, 1e003, 1e004, 1e005, 1e006, 1e007, 1e008, 1e009, + 1e010, 1e011, 1e012, 1e013, 1e014, 1e015, 1e016, 1e017, 1e018, 1e019, + 1e020, 1e021, 1e022, 1e023, 1e024, 1e025, 1e026, 1e027, 1e028, 1e029, + 1e030, 1e031, 1e032, 1e033, 1e034, 1e035, 1e036, 1e037, 1e038, 1e039, + 1e040, 1e041, 1e042, 1e043, 1e044, 1e045, 1e046, 1e047, 1e048, 1e049, + 1e050, 1e051, 1e052, 1e053, 1e054, 1e055, 1e056, 1e057, 1e058, 1e059, + 1e060, 1e061, 1e062, 1e063, 1e064, 1e065, 1e066, 1e067, 1e068, 1e069, + 1e070, 1e071, 1e072, 1e073, 1e074, 1e075, 1e076, 1e077, 1e078, 1e079, + 1e080, 1e081, 1e082, 1e083, 1e084, 1e085, 1e086, 1e087, 1e088, 1e089, + 1e090, 1e091, 1e092, 1e093, 1e094, 1e095, 1e096, 1e097, 1e098, 1e099, + 1e100, 1e101, 1e102, 1e103, 1e104, 1e105, 1e106, 1e107, 1e108, 1e109, + 1e110, 1e111, 1e112, 1e113, 1e114, 1e115, 1e116, 1e117, 1e118, 1e119, + 1e120, 1e121, 1e122, 1e123, 1e124, 1e125, 1e126, 1e127, 1e128, 1e129, + 1e130, 1e131, 1e132, 1e133, 1e134, 1e135, 1e136, 1e137, 1e138, 1e139, + 1e140, 1e141, 1e142, 1e143, 1e144, 1e145, 1e146, 1e147, 1e148, 1e149, + 1e150, 1e151, 1e152, 1e153, 1e154, 1e155, 1e156, 1e157, 1e158, 1e159, + 1e160, 1e161, 1e162, 1e163, 1e164, 1e165, 1e166, 1e167, 1e168, 1e169, + 1e170, 1e171, 1e172, 1e173, 1e174, 1e175, 1e176, 1e177, 1e178, 1e179, + 1e180, 1e181, 1e182, 1e183, 1e184, 1e185, 1e186, 1e187, 1e188, 1e189, + 1e190, 1e191, 1e192, 1e193, 1e194, 1e195, 1e196, 1e197, 1e198, 1e199, + 1e200, 1e201, 1e202, 1e203, 1e204, 1e205, 1e206, 1e207, 1e208, 1e209, + 1e210, 1e211, 1e212, 1e213, 1e214, 1e215, 1e216, 1e217, 1e218, 1e219, + 1e220, 1e221, 1e222, 1e223, 1e224, 1e225, 1e226, 1e227, 1e228, 1e229, + 1e230, 1e231, 1e232, 1e233, 1e234, 1e235, 1e236, 1e237, 1e238, 1e239, + 1e240, 1e241, 1e242, 1e243, 1e244, 1e245, 1e246, 1e247, 1e248, 1e249, + 1e250, 1e251, 1e252, 1e253, 1e254, 1e255, 1e256, 1e257, 1e258, 1e259, + 1e260, 1e261, 1e262, 1e263, 1e264, 1e265, 1e266, 1e267, 1e268, 1e269, + 1e270, 1e271, 1e272, 1e273, 1e274, 1e275, 1e276, 1e277, 1e278, 1e279, + 1e280, 1e281, 1e282, 1e283, 1e284, 1e285, 1e286, 1e287, 1e288, 1e289, + 1e290, 1e291, 1e292, 1e293, 1e294, 1e295, 1e296, 1e297, 1e298, 1e299, + 1e300, 1e301, 1e302, 1e303, 1e304, 1e305, 1e306, 1e307, 1e308 +}; /* Convert string to double (string doesn't have to be null terminated) @@ -57,7 +84,7 @@ double my_strtod(const char *str, char **end_ptr, int *error) { double result= 0.0; uint negative= 0, ndigits, dec_digits= 0, neg_exp= 0; - int exponent= 0, digits_after_dec_point= 0, tmp_exp; + int exponent= 0, digits_after_dec_point= 0, tmp_exp, step; const char *old_str, *end= *end_ptr, *start_of_number; char next_char; my_bool overflow=0; @@ -179,16 +206,10 @@ double my_strtod(const char *str, char **end_ptr, int *error) exponent= -exponent; neg_exp= 1; /* neg_exp was 0 before */ } - while (exponent >= 100) - { - result= neg_exp ? result/1.0e100 : result*1.0e100; - exponent-= 100; - } - scaler= scaler10[exponent/10]*scaler1[exponent%10]; - if (neg_exp) - result/= scaler; - else - result*= scaler; + step= array_elements(log_10) - 1; + for (; exponent > step; exponent-= step) + result= neg_exp ? result / log_10[step] : result * log_10[step]; + result= neg_exp ? result / log_10[exponent] : result * log_10[exponent]; } done: diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 38346ad0dbc..75c86902972 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -7564,7 +7564,9 @@ static void test_explain_bug() else { verify_prepare_field(result, 6, "key_len", "", MYSQL_TYPE_VAR_STRING, "", - "", "", NAME_LEN*MAX_KEY, 0); + "", "", + NAME_LEN*MAX_KEY / my_charset_utf8_general_ci.mbmaxlen, + 0); } verify_prepare_field(result, 7, "ref", "", MYSQL_TYPE_VAR_STRING, @@ -15560,6 +15562,179 @@ static void test_bug24179() } +/* + Bug#27876 (SF with cyrillic variable name fails during execution (regression)) +*/ +static void test_bug27876() +{ + int rc; + MYSQL_RES *result; + + char utf8_func[] = + { + 0xd1, 0x84, 0xd1, 0x83, 0xd0, 0xbd, 0xd0, 0xba, + 0xd1, 0x86, 0xd0, 0xb8, 0xd0, 0xb9, 0xd0, 0xba, + 0xd0, 0xb0, + 0x00 + }; + + char utf8_param[] = + { + 0xd0, 0xbf, 0xd0, 0xb0, 0xd1, 0x80, 0xd0, 0xb0, + 0xd0, 0xbc, 0xd0, 0xb5, 0xd1, 0x82, 0xd1, 0x8a, + 0xd1, 0x80, 0x5f, 0xd0, 0xb2, 0xd0, 0xb5, 0xd1, + 0x80, 0xd1, 0x81, 0xd0, 0xb8, 0xd1, 0x8f, + 0x00 + }; + + char query[500]; + + DBUG_ENTER("test_bug27876"); + myheader("test_bug27876"); + + rc= mysql_query(mysql, "set names utf8"); + myquery(rc); + + rc= mysql_query(mysql, "select version()"); + myquery(rc); + result= mysql_store_result(mysql); + mytest(result); + + sprintf(query, "DROP FUNCTION IF EXISTS %s", utf8_func); + rc= mysql_query(mysql, query); + myquery(rc); + + sprintf(query, + "CREATE FUNCTION %s( %s VARCHAR(25))" + " RETURNS VARCHAR(25) DETERMINISTIC RETURN %s", + utf8_func, utf8_param, utf8_param); + rc= mysql_query(mysql, query); + myquery(rc); + sprintf(query, "SELECT %s(VERSION())", utf8_func); + rc= mysql_query(mysql, query); + myquery(rc); + result= mysql_store_result(mysql); + mytest(result); + + sprintf(query, "DROP FUNCTION %s", utf8_func); + rc= mysql_query(mysql, query); + myquery(rc); + + rc= mysql_query(mysql, "set names default"); + myquery(rc); +} + + +/* + Bug#28505: mysql_affected_rows() returns wrong value if CLIENT_FOUND_ROWS + flag is set. +*/ + +static void test_bug28505() +{ + my_ulonglong res; + + myquery(mysql_query(mysql, "drop table if exists t1")); + myquery(mysql_query(mysql, "create table t1(f1 int primary key)")); + myquery(mysql_query(mysql, "insert into t1 values(1)")); + myquery(mysql_query(mysql, + "insert into t1 values(1) on duplicate key update f1=1")); + res= mysql_affected_rows(mysql); + DIE_UNLESS(!res); + myquery(mysql_query(mysql, "drop table t1")); +} + + +/* + Bug#28934: server crash when receiving malformed com_execute packets +*/ + +static void test_bug28934() +{ + my_bool error= 0; + MYSQL_BIND bind[5]; + MYSQL_STMT *stmt; + int cnt; + + myquery(mysql_query(mysql, "drop table if exists t1")); + myquery(mysql_query(mysql, "create table t1(id int)")); + + myquery(mysql_query(mysql, "insert into t1 values(1),(2),(3),(4),(5)")); + stmt= mysql_simple_prepare(mysql,"select * from t1 where id in(?,?,?,?,?)"); + check_stmt(stmt); + + memset (&bind, 0, sizeof (bind)); + for (cnt= 0; cnt < 5; cnt++) + { + bind[cnt].buffer_type= MYSQL_TYPE_LONG; + bind[cnt].buffer= (char*)&cnt; + bind[cnt].buffer_length= 0; + } + myquery(mysql_stmt_bind_param(stmt, bind)); + + stmt->param_count=2; + error= mysql_stmt_execute(stmt); + DIE_UNLESS(error != 0); + myerror(NULL); + mysql_stmt_close(stmt); + + myquery(mysql_query(mysql, "drop table t1")); +} + + +/* + Bug#27592 (stack overrun when storing datetime value using prepared statements) +*/ + +static void test_bug27592() +{ + const int NUM_ITERATIONS= 40; + int i; + int rc; + MYSQL_STMT *stmt= NULL; + MYSQL_BIND bind[1]; + MYSQL_TIME time_val; + + DBUG_ENTER("test_bug27592"); + myheader("test_bug27592"); + + mysql_query(mysql, "DROP TABLE IF EXISTS t1"); + mysql_query(mysql, "CREATE TABLE t1(c2 DATETIME)"); + + stmt= mysql_simple_prepare(mysql, "INSERT INTO t1 VALUES (?)"); + DIE_UNLESS(stmt); + + memset(bind, 0, sizeof(bind)); + + bind[0].buffer_type= MYSQL_TYPE_DATETIME; + bind[0].buffer= (char *) &time_val; + bind[0].length= NULL; + + for (i= 0; i < NUM_ITERATIONS; i++) + { + time_val.year= 2007; + time_val.month= 6; + time_val.day= 7; + time_val.hour= 18; + time_val.minute= 41; + time_val.second= 3; + + time_val.second_part=0; + time_val.neg=0; + + rc= mysql_stmt_bind_param(stmt, bind); + check_execute(stmt, rc); + + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); + } + + mysql_stmt_close(stmt); + + DBUG_VOID_RETURN; +} + + /* Read and parse arguments and MySQL options from my.cnf */ @@ -15840,6 +16015,10 @@ static struct my_tests_st my_tests[]= { { "test_bug23383", test_bug23383 }, { "test_bug21635", test_bug21635 }, { "test_bug24179", test_bug24179 }, + { "test_bug27876", test_bug27876 }, + { "test_bug28505", test_bug28505 }, + { "test_bug28934", test_bug28934 }, + { "test_bug27592", test_bug27592 }, { 0, 0 } }; diff --git a/vio/vio_priv.h b/vio/vio_priv.h index 4a272e519a3..9036952d575 100644 --- a/vio/vio_priv.h +++ b/vio/vio_priv.h @@ -23,6 +23,7 @@ #include void vio_ignore_timeout(Vio *vio, uint which, uint timeout); +void vio_timeout(Vio *vio,uint which, uint timeout); #ifdef HAVE_OPENSSL #include "my_net.h" /* needed because of struct in_addr */ diff --git a/vio/viosocket.c b/vio/viosocket.c index 01abde6e0f7..84fdd6f57e4 100644 --- a/vio/viosocket.c +++ b/vio/viosocket.c @@ -204,13 +204,14 @@ int vio_fastsend(Vio * vio __attribute__((unused))) { #ifdef __WIN__ BOOL nodelay= 1; - r= setsockopt(vio->sd, IPPROTO_TCP, TCP_NODELAY, (const char*) &nodelay, - sizeof(nodelay)); #else int nodelay = 1; - r= setsockopt(vio->sd, IPPROTO_TCP, TCP_NODELAY, (void*) &nodelay, +#endif + + r= setsockopt(vio->sd, IPPROTO_TCP, TCP_NODELAY, + IF_WIN(const char*, void*) &nodelay, sizeof(nodelay)); -#endif /* __WIN__ */ + } if (r) { @@ -380,28 +381,39 @@ my_bool vio_poll_read(Vio *vio,uint timeout) void vio_timeout(Vio *vio, uint which, uint timeout) { -/* TODO: some action should be taken if socket timeouts are not supported. */ #if defined(SO_SNDTIMEO) && defined(SO_RCVTIMEO) + int r; + DBUG_ENTER("vio_timeout"); + { #ifdef __WIN__ - - /* Windows expects time in milliseconds as int. */ + /* Windows expects time in milliseconds as int */ int wait_timeout= (int) timeout * 1000; - -#else /* ! __WIN__ */ - +#else /* POSIX specifies time as struct timeval. */ struct timeval wait_timeout; wait_timeout.tv_sec= timeout; wait_timeout.tv_usec= 0; +#endif -#endif /* ! __WIN__ */ + r= setsockopt(vio->sd, SOL_SOCKET, which ? SO_SNDTIMEO : SO_RCVTIMEO, + IF_WIN(const char*, const void*)&wait_timeout, + sizeof(wait_timeout)); - /* TODO: return value should be checked. */ - (void) setsockopt(vio->sd, SOL_SOCKET, which ? SO_SNDTIMEO : SO_RCVTIMEO, - (char*) &wait_timeout, sizeof(wait_timeout)); + } -#endif /* defined(SO_SNDTIMEO) && defined(SO_RCVTIMEO) */ +#ifndef DBUG_OFF + if (r != 0) + DBUG_PRINT("error", ("setsockopt failed: %d, errno: %d", r, socket_errno)); +#endif + + DBUG_VOID_RETURN; +#else +/* + Platforms not suporting setting of socket timeout should either use + thr_alarm or just run without read/write timeout(s) +*/ +#endif } diff --git a/vio/viossl.c b/vio/viossl.c index 5e4203a3fb5..861989136d3 100644 --- a/vio/viossl.c +++ b/vio/viossl.c @@ -123,6 +123,16 @@ int vio_ssl_close(Vio *vio) if (ssl) { + /* + THE SSL standard says that SSL sockets must send and receive a close_notify + alert on socket shutdown to avoid truncation attacks. However, this can + cause problems since we often hold a lock during shutdown and this IO can + take an unbounded amount of time to complete. Since our packets are self + describing with length, we aren't vunerable to these attacks. Therefore, + we just shutdown by closing the socket (quiet shutdown). + */ + SSL_set_quiet_shutdown(ssl, 1); + switch ((r= SSL_shutdown(ssl))) { case 1: diff --git a/win/create_manifest.js b/win/create_manifest.js index ac62cb2a8c2..8569bd508ff 100755 --- a/win/create_manifest.js +++ b/win/create_manifest.js @@ -1,11 +1,10 @@ /* manifest.js - Writes a custom XML manifest for each executable/library - 6 command line options must be supplied: + 5 command line options must be supplied: name - Name of the executable/library into which the mainfest will be embedded. version - Version of the executable arch - Architecture intended. - type - Application type. exe_level - Application execution level. [asInvoker|highestAvailable|requireAdministrator] outfile - Final destination where mainfest will be written. @@ -27,15 +26,16 @@ try var app_name= parts[1]; break; case "version": - var app_version= parts[1]; + var supp_version= parts[1]; + // Clean up the supplied version string. + var end= supp_version.indexOf("-"); + if (end == -1) end= supp_version.length; + var app_version= supp_version.substring(0, end); app_version+= ".0"; break; case "arch": var app_arch= parts[1]; break; - case "type": - var app_type= parts[1]; - break; case "exe_level": var app_exe_level= parts[1]; break; @@ -46,7 +46,7 @@ try WScript.echo("Invalid argument supplied."); } } - if (i != 6) + if (i != 5) throw new Error(1, "Incorrect number of arguments."); var manifest_xml= "\r\n"; @@ -57,7 +57,7 @@ try manifest_xml+= " version=\'" + app_version + "\'"; manifest_xml+= " processorArchitecture=\'" + app_arch + "\'"; // TOADD - Add publicKeyToken attribute once we have Authenticode key. - manifest_xml+= " type=\'" + app_type + "\' />\r\n"; + manifest_xml+= " type=\'win32\' />\r\n"; // Identify the application security requirements. manifest_xml+= "\t\r\n"; manifest_xml+= "\t\t\r\n\t\t\t\r\n\t\t\t\t"; diff --git a/win/mysql_manifest.cmake b/win/mysql_manifest.cmake index b5bb6fda8fb..4c88be1d800 100755 --- a/win/mysql_manifest.cmake +++ b/win/mysql_manifest.cmake @@ -9,7 +9,7 @@ MACRO(MYSQL_EMBED_MANIFEST _target_name _required_privs) TARGET ${_target_name} PRE_LINK COMMAND cscript.exe - ARGS "${PROJECT_SOURCE_DIR}/win/create_manifest.js" name=$(ProjectName) version=${VERSION} arch=${PROCESSOR_ARCH} type=$(PlatformName) exe_level=${_required_privs} outfile=$(IntDir)\\$(TargetFileName).intermediate.manifest + ARGS "${PROJECT_SOURCE_DIR}/win/create_manifest.js" name=$(ProjectName) version=${VERSION} arch=${PROCESSOR_ARCH} exe_level=${_required_privs} outfile=$(IntDir)\\$(TargetFileName).intermediate.manifest COMMENT "Generates the contents of the manifest contents.") ADD_CUSTOM_COMMAND( TARGET ${_target_name}