From 4a3876c3df4232b00a9ad8f66d47b7593468a19f Mon Sep 17 00:00:00 2001 From: Mattias Jonsson Date: Fri, 7 Aug 2009 15:08:32 +0200 Subject: [PATCH 01/68] Bug#32430: 'show innodb status' causes errors Invalid (old?) table or database name in logs Post push patch. Bug was that a non partitioned table file was not converted to system_charset, (due to table_name_len was not set). Also missing DBUG_RETURN. And Innodb adds quotes after calling the function, so I added one more mode where explain_filename does not add quotes. But it still appends the [sub]partition name as a comment. Also caught a minor quoting bug, the character '`' was not quoted in the identifier. (so 'a`b' was quoted as `a`b` and not `a``b`, this is mulitbyte characters aware.) --- sql/mysql_priv.h | 3 +- sql/share/errmsg.txt | 16 +++++----- sql/sql_table.cc | 76 +++++++++++++++++++++++++++++++++++--------- 3 files changed, 71 insertions(+), 24 deletions(-) diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 03c366a45bf..609254448e3 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -2261,7 +2261,8 @@ enum enum_explain_filename_mode { EXPLAIN_ALL_VERBOSE= 0, EXPLAIN_PARTITIONS_VERBOSE, - EXPLAIN_PARTITIONS_AS_COMMENT + EXPLAIN_PARTITIONS_AS_COMMENT, + EXPLAIN_PARTITIONS_AS_COMMENT_NO_QUOTING }; uint explain_filename(const char *from, char *to, uint to_length, enum_explain_filename_mode explain_mode); diff --git a/sql/share/errmsg.txt b/sql/share/errmsg.txt index 5531ee71620..3aba434b284 100644 --- a/sql/share/errmsg.txt +++ b/sql/share/errmsg.txt @@ -6184,17 +6184,17 @@ ER_FUNC_INEXISTENT_NAME_COLLISION 42000 # When updating these, please update EXPLAIN_FILENAME_MAX_EXTRA_LENGTH in # mysql_priv.h with the new maximal additional length for explain_filename. ER_DATABASE_NAME - eng "Database `%s`" - swe "Databas `%s`" + eng "Database" + swe "Databas" ER_TABLE_NAME - eng "Table `%s`" - swe "Tabell `%s`" + eng "Table" + swe "Tabell" ER_PARTITION_NAME - eng "Partition `%s`" - swe "Partition `%s`" + eng "Partition" + swe "Partition" ER_SUBPARTITION_NAME - eng "Subpartition `%s`" - swe "Subpartition `%s`" + eng "Subpartition" + swe "Subpartition" ER_TEMPORARY_NAME eng "Temporary" swe "Tempor鋜" diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 0066c66eb59..7e4318b7d16 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -72,7 +72,7 @@ static void wait_for_kill_signal(THD *thd) @brief Helper function for explain_filename */ static char* add_identifier(char *to_p, const char * end_p, - const char* name, uint name_len, int errcode) + const char* name, uint name_len, bool add_quotes) { uint res; uint errors; @@ -92,18 +92,44 @@ static char* add_identifier(char *to_p, const char * end_p, res= strconvert(&my_charset_filename, conv_name, system_charset_info, conv_string, FN_REFLEN, &errors); if (!res || errors) + { + DBUG_PRINT("error", ("strconvert of '%s' failed with %u (errors: %u)", conv_name, res, errors)); conv_name= name; + } else { DBUG_PRINT("info", ("conv '%s' -> '%s'", conv_name, conv_string)); conv_name= conv_string; } - if (errcode) - to_p+= my_snprintf(to_p, end_p - to_p, ER(errcode), conv_name); + if (add_quotes && (end_p - to_p > 2)) + { + *(to_p++)= '`'; + while (*conv_name && (end_p - to_p - 1) > 0) + { + uint length= my_mbcharlen(system_charset_info, *conv_name); + if (!length) + length= 1; + if (length == 1 && *conv_name == '`') + { + if ((end_p - to_p) < 3) + break; + *(to_p++)= '`'; + *(to_p++)= *(conv_name++); + } + else if (length < (end_p - to_p)) + { + to_p= strnmov(to_p, conv_name, length); + conv_name+= length; + } + else + break; /* string already filled */ + } + to_p= strnmov(to_p, "`", end_p - to_p); + } else - to_p+= my_snprintf(to_p, end_p - to_p, "`%s`", conv_name); - return to_p; + to_p= strnmov(to_p, conv_name, end_p - to_p); + DBUG_RETURN(to_p); } @@ -135,6 +161,8 @@ static char* add_identifier(char *to_p, const char * end_p, [,[ Temporary| Renamed] Partition `p` [, Subpartition `sp`]] *| (| is really a /, and it is all in one line) + EXPLAIN_PARTITIONS_AS_COMMENT_NO_QUOTING -> + same as above but no quotes are added. @retval Length of returned string */ @@ -245,28 +273,39 @@ uint explain_filename(const char *from, part_name_len-= 5; } } + else + table_name_len= strlen(table_name); if (db_name) { if (explain_mode == EXPLAIN_ALL_VERBOSE) { - to_p= add_identifier(to_p, end_p, db_name, db_name_len, - ER_DATABASE_NAME); + to_p= strnmov(to_p, ER(ER_DATABASE_NAME), end_p - to_p); + *(to_p++)= ' '; + to_p= add_identifier(to_p, end_p, db_name, db_name_len, 1); to_p= strnmov(to_p, ", ", end_p - to_p); } else { - to_p= add_identifier(to_p, end_p, db_name, db_name_len, 0); + to_p= add_identifier(to_p, end_p, db_name, db_name_len, + (explain_mode != + EXPLAIN_PARTITIONS_AS_COMMENT_NO_QUOTING)); to_p= strnmov(to_p, ".", end_p - to_p); } } if (explain_mode == EXPLAIN_ALL_VERBOSE) - to_p= add_identifier(to_p, end_p, table_name, table_name_len, - ER_TABLE_NAME); + { + to_p= strnmov(to_p, ER(ER_TABLE_NAME), end_p - to_p); + *(to_p++)= ' '; + to_p= add_identifier(to_p, end_p, table_name, table_name_len, 1); + } else - to_p= add_identifier(to_p, end_p, table_name, table_name_len, 0); + to_p= add_identifier(to_p, end_p, table_name, table_name_len, + (explain_mode != + EXPLAIN_PARTITIONS_AS_COMMENT_NO_QUOTING)); if (part_name) { - if (explain_mode == EXPLAIN_PARTITIONS_AS_COMMENT) + if (explain_mode == EXPLAIN_PARTITIONS_AS_COMMENT || + explain_mode == EXPLAIN_PARTITIONS_AS_COMMENT_NO_QUOTING) to_p= strnmov(to_p, " /* ", end_p - to_p); else if (explain_mode == EXPLAIN_PARTITIONS_VERBOSE) to_p= strnmov(to_p, " ", end_p - to_p); @@ -280,15 +319,22 @@ uint explain_filename(const char *from, to_p= strnmov(to_p, ER(ER_RENAMED_NAME), end_p - to_p); to_p= strnmov(to_p, " ", end_p - to_p); } + to_p= strnmov(to_p, ER(ER_PARTITION_NAME), end_p - to_p); + *(to_p++)= ' '; to_p= add_identifier(to_p, end_p, part_name, part_name_len, - ER_PARTITION_NAME); + (explain_mode != + EXPLAIN_PARTITIONS_AS_COMMENT_NO_QUOTING)); if (subpart_name) { to_p= strnmov(to_p, ", ", end_p - to_p); + to_p= strnmov(to_p, ER(ER_SUBPARTITION_NAME), end_p - to_p); + *(to_p++)= ' '; to_p= add_identifier(to_p, end_p, subpart_name, subpart_name_len, - ER_SUBPARTITION_NAME); + (explain_mode != + EXPLAIN_PARTITIONS_AS_COMMENT_NO_QUOTING)); } - if (explain_mode == EXPLAIN_PARTITIONS_AS_COMMENT) + if (explain_mode == EXPLAIN_PARTITIONS_AS_COMMENT || + explain_mode == EXPLAIN_PARTITIONS_AS_COMMENT_NO_QUOTING) to_p= strnmov(to_p, " */", end_p - to_p); } DBUG_PRINT("exit", ("to '%s'", to)); From 8dba7d18b4ff2641ac6556a3a4e543bae42d0227 Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Wed, 19 Aug 2009 17:53:43 +0300 Subject: [PATCH 02/68] Bug #46807: subselect test fails on PB-2 with a crash The check for stack overflow was independent of the size of the structure stored in the heap. Fixed by adding sizeof(PARAM) to the requested free heap size. --- sql/opt_range.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 32f9b0df4c0..d007009d62c 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -2063,7 +2063,7 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use, KEY *key_info; PARAM param; - if (check_stack_overrun(thd, 2*STACK_MIN_SIZE, buff)) + if (check_stack_overrun(thd, 2*STACK_MIN_SIZE + sizeof(PARAM), buff)) DBUG_RETURN(0); // Fatal error flag is set /* set up parameter that is passed to all functions */ From 90032c100751d4a864f371dd451fda7d8b12022d Mon Sep 17 00:00:00 2001 From: Anurag Shekhar Date: Mon, 24 Aug 2009 13:15:51 +0530 Subject: [PATCH 03/68] Bug #44723 Larger read_buffer_size values can cause performance decrease for INSERTs Bulk inserts (multiple row, CREATE ... SELECT, INSERT ... SELECT) into MyISAM tables were performed inefficiently. This was mainly affecting use cases where read_buffer_size was considerably large (>256K) and low number of rows was inserted (e.g. 30-100). The problem was that during I/O cache initialization (this happens before each bulk insert) allocated I/O buffer was unnecessarily initialized to '\0'. This was happening because of mess in flag values. MyISAM informs I/O cache to wait for free space (if out of disk space) by passing MY_WAIT_IF_FULL flag. Since MY_WAIT_IF_FULL and MY_ZEROFILL have the same values, memory allocator was initializing memory to '\0'. The performance gain provided with this patch may only be visible with non-debug binaries, since safemalloc always initializes allocated memory to 0xA5A5... --- mysys/mf_iocache.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/mysys/mf_iocache.c b/mysys/mf_iocache.c index d2ace12da4d..3aab904a6e0 100644 --- a/mysys/mf_iocache.c +++ b/mysys/mf_iocache.c @@ -233,10 +233,13 @@ int init_io_cache(IO_CACHE *info, File file, uint cachesize, buffer_block = cachesize; if (type == SEQ_READ_APPEND) buffer_block *= 2; - if ((info->buffer= - (byte*) my_malloc(buffer_block, - MYF((cache_myflags & ~ MY_WME) | - (cachesize == min_cache ? MY_WME : 0)))) != 0) + /* + Unset MY_WAIT_IF_FULL bit if it is set, to prevent conflict with + MY_ZEROFILL. + */ + myf flag = MYF((cache_myflags & ~ (MY_WME | MY_WAIT_IF_FULL)) | + (cachesize == min_cache ? MY_WME : 0)); + if ((info->buffer= (byte*) my_malloc(buffer_block, flag)) != 0) { info->write_buffer=info->buffer; if (type == SEQ_READ_APPEND) From e4f8deb2266ec8509d95bb29e508a82bb666c7db Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Mon, 24 Aug 2009 15:28:03 +0300 Subject: [PATCH 04/68] Bug #37044: Read overflow in opt_range.cc found during "make test" The code was using a special global buffer for the value of IS NULL ranges. This was not always long enough to be copied by a regular memcpy. As a result read buffer overflows may occur. Fixed by setting the null byte to 1 and setting the rest of the field disk image to NULL with a bzero (instead of relying on the buffer and memcpy()). --- sql/opt_range.cc | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/sql/opt_range.cc b/sql/opt_range.cc index d007009d62c..778fc418392 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -8308,11 +8308,21 @@ get_constant_key_infix(KEY *index_info, SEL_ARG *index_range_tree, return FALSE; uint field_length= cur_part->store_length; - if ((cur_range->maybe_null && + if (cur_range->maybe_null && cur_range->min_value[0] && cur_range->max_value[0]) - || - (memcmp(cur_range->min_value, cur_range->max_value, field_length) == 0)) - { /* cur_range specifies 'IS NULL' or an equality condition. */ + { + /* + cur_range specifies 'IS NULL'. In this case the argument points to a "null value" (is_null_string) + that may not always be long enough for a direct memcpy to a field. + */ + DBUG_ASSERT (field_length > 0); + *key_ptr= 1; + bzero(key_ptr+1,field_length-1); + key_ptr+= field_length; + *key_infix_len+= field_length; + } + else if (memcmp(cur_range->min_value, cur_range->max_value, field_length) == 0) + { /* cur_range specifies an equality condition. */ memcpy(key_ptr, cur_range->min_value, field_length); key_ptr+= field_length; *key_infix_len+= field_length; From 3b756a01a04cf8d7a2a11207d3512f5839b4fd89 Mon Sep 17 00:00:00 2001 From: Mattias Jonsson Date: Wed, 26 Aug 2009 12:51:23 +0200 Subject: [PATCH 05/68] Bug#46362: Endpoint should be set to false for TO_DAYS(DATE) There were a problem since pruning uses the field for comparison (while evaluate_join_record uses longlong), resulting in pruning failures when comparing DATE to DATETIME. Fix was to always comparing DATE vs DATETIME as DATETIME, by adding ' 00:00:00' to the DATE string. And adding optimization for comparing with 23:59:59, so that DATETIME_col > '2001-02-03 23:59:59' -> TO_DAYS(DATETIME_col) > TO_DAYS('2001-02-03 23:59:59') instead of '>='. --- mysql-test/r/partition_pruning.result | 621 ++++++++++++++++++++++++++ mysql-test/t/partition_pruning.test | 308 +++++++++++++ sql-common/my_time.c | 4 +- sql/item.cc | 50 ++- sql/item.h | 6 +- sql/item_timefunc.cc | 10 +- sql/opt_range.cc | 15 +- 7 files changed, 989 insertions(+), 25 deletions(-) diff --git a/mysql-test/r/partition_pruning.result b/mysql-test/r/partition_pruning.result index 26ddc92e97b..abaa37715bf 100644 --- a/mysql-test/r/partition_pruning.result +++ b/mysql-test/r/partition_pruning.result @@ -1,4 +1,625 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +# Test with DATETIME column NOT NULL +CREATE TABLE t1 ( +a int(10) unsigned NOT NULL, +b DATETIME NOT NULL, +PRIMARY KEY (a, b) +) PARTITION BY RANGE (TO_DAYS(b)) +(PARTITION p20090401 VALUES LESS THAN (TO_DAYS('2009-04-02')), +PARTITION p20090402 VALUES LESS THAN (TO_DAYS('2009-04-03')), +PARTITION p20090403 VALUES LESS THAN (TO_DAYS('2009-04-04')), +PARTITION p20090404 VALUES LESS THAN (TO_DAYS('2009-04-05')), +PARTITION p20090405 VALUES LESS THAN MAXVALUE); +INSERT INTO t1 VALUES (1, '2009-01-01'), (1, '2009-04-01'), (2, '2009-04-01'), +(1, '2009-04-02'), (2, '2009-04-02'), (1, '2009-04-02 23:59:59'), +(1, '2009-04-03'), (2, '2009-04-03'), (1, '2009-04-04'), (2, '2009-04-04'), +(1, '2009-04-05'), (1, '2009-04-06'), (1, '2009-04-07'); +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-03' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 12 NULL 6 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-03' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 12 NULL 8 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090403 index NULL PRIMARY 12 NULL 8 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090403,p20090404,p20090405 index NULL PRIMARY 12 NULL 13 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090403,p20090404,p20090405 index NULL PRIMARY 12 NULL 13 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 +WHERE b < CAST('2009-04-02 23:59:59' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 12 NULL 13 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 +WHERE b <= CAST('2009-04-02 23:59:59' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 12 NULL 13 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 +WHERE b = CAST('2009-04-02 23:59:59' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090402 index NULL PRIMARY 12 NULL 13 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 +WHERE b >= CAST('2009-04-02 23:59:59' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090402,p20090403,p20090404,p20090405 index NULL PRIMARY 12 NULL 13 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 +WHERE b > CAST('2009-04-02 23:59:59' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090403,p20090404,p20090405 index NULL PRIMARY 12 NULL 13 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-03' AS DATE); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 12 NULL 13 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-03' AS DATE); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 12 NULL 13 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATE); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090403 index NULL PRIMARY 12 NULL 13 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATE); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090403,p20090404,p20090405 index NULL PRIMARY 12 NULL 13 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATE); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090403,p20090404,p20090405 index NULL PRIMARY 12 NULL 13 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-03 00:00:00'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 12 NULL 13 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-03 00:00:00'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 12 NULL 13 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-03 00:00:00'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090403 index NULL PRIMARY 12 NULL 13 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-03 00:00:00'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090403,p20090404,p20090405 index NULL PRIMARY 12 NULL 13 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-03 00:00:00'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090403,p20090404,p20090405 index NULL PRIMARY 12 NULL 13 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-02 23:59:59'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 12 NULL 13 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-02 23:59:59'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 12 NULL 13 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-02 23:59:59'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090402 index NULL PRIMARY 12 NULL 13 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-02 23:59:59'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090402,p20090403,p20090404,p20090405 index NULL PRIMARY 12 NULL 13 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-02 23:59:59'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090403,p20090404,p20090405 index NULL PRIMARY 12 NULL 13 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-03'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 12 NULL 13 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-03'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 12 NULL 13 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-03'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090403 index NULL PRIMARY 12 NULL 13 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-03'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090403,p20090404,p20090405 index NULL PRIMARY 12 NULL 13 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-03'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090403,p20090404,p20090405 index NULL PRIMARY 12 NULL 13 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 +WHERE b < CAST('2009-04-03 00:00:01' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 12 NULL 13 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 +WHERE b <= CAST('2009-04-03 00:00:01' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 12 NULL 13 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 +WHERE b = CAST('2009-04-03 00:00:01' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090403 index NULL PRIMARY 12 NULL 13 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 +WHERE b >= CAST('2009-04-03 00:00:01' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090403,p20090404,p20090405 index NULL PRIMARY 12 NULL 13 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 +WHERE b > CAST('2009-04-03 00:00:01' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090403,p20090404,p20090405 index NULL PRIMARY 12 NULL 13 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 +WHERE b < CAST('2009-04-02 23:59:58' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 12 NULL 13 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 +WHERE b <= CAST('2009-04-02 23:59:58' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 12 NULL 13 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 +WHERE b = CAST('2009-04-02 23:59:58' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090402 index NULL PRIMARY 12 NULL 13 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 +WHERE b >= CAST('2009-04-02 23:59:58' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090402,p20090403,p20090404,p20090405 index NULL PRIMARY 12 NULL 13 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 +WHERE b > CAST('2009-04-02 23:59:58' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090402,p20090403,p20090404,p20090405 index NULL PRIMARY 12 NULL 13 Using where; Using index +DROP TABLE t1; +# Test with DATE column NOT NULL +CREATE TABLE t1 ( +a int(10) unsigned NOT NULL, +b DATE NOT NULL, +PRIMARY KEY (a, b) +) PARTITION BY RANGE (TO_DAYS(b)) +(PARTITION p20090401 VALUES LESS THAN (TO_DAYS('2009-04-02')), +PARTITION p20090402 VALUES LESS THAN (TO_DAYS('2009-04-03')), +PARTITION p20090403 VALUES LESS THAN (TO_DAYS('2009-04-04')), +PARTITION p20090404 VALUES LESS THAN (TO_DAYS('2009-04-05')), +PARTITION p20090405 VALUES LESS THAN MAXVALUE); +INSERT INTO t1 VALUES (1, '2009-01-01'), (1, '2009-04-01'), (2, '2009-04-01'), +(1, '2009-04-02'), (2, '2009-04-02'), (1, '2009-04-03'), (2, '2009-04-03'), +(1, '2009-04-04'), (2, '2009-04-04'), (1, '2009-04-05'), (1, '2009-04-06'), +(1, '2009-04-07'); +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-03' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 7 NULL 5 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-03' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 7 NULL 7 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090403 index NULL PRIMARY 7 NULL 7 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090403,p20090404,p20090405 index NULL PRIMARY 7 NULL 12 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090404,p20090405 index NULL PRIMARY 7 NULL 12 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 +WHERE b < CAST('2009-04-02 23:59:59' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 7 NULL 12 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 +WHERE b <= CAST('2009-04-02 23:59:59' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 7 NULL 12 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 +WHERE b = CAST('2009-04-02 23:59:59' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +EXPLAIN PARTITIONS SELECT * FROM t1 +WHERE b >= CAST('2009-04-02 23:59:59' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090403,p20090404,p20090405 index NULL PRIMARY 7 NULL 12 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 +WHERE b > CAST('2009-04-02 23:59:59' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090403,p20090404,p20090405 index NULL PRIMARY 7 NULL 12 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-03' AS DATE); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 7 NULL 12 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-03' AS DATE); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 7 NULL 12 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATE); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090403 index NULL PRIMARY 7 NULL 12 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATE); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090403,p20090404,p20090405 index NULL PRIMARY 7 NULL 12 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATE); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090404,p20090405 index NULL PRIMARY 7 NULL 12 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-03 00:00:00'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 7 NULL 12 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-03 00:00:00'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 7 NULL 12 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-03 00:00:00'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090403 index NULL PRIMARY 7 NULL 12 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-03 00:00:00'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090403,p20090404,p20090405 index NULL PRIMARY 7 NULL 12 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-03 00:00:00'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090404,p20090405 index NULL PRIMARY 7 NULL 12 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-02 23:59:59'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 7 NULL 12 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-02 23:59:59'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 7 NULL 12 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-02 23:59:59'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-02 23:59:59'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090403,p20090404,p20090405 index NULL PRIMARY 7 NULL 12 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-02 23:59:59'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090403,p20090404,p20090405 index NULL PRIMARY 7 NULL 12 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-03'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 7 NULL 12 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-03'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 7 NULL 12 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-03'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090403 index NULL PRIMARY 7 NULL 12 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-03'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090403,p20090404,p20090405 index NULL PRIMARY 7 NULL 12 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-03'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090404,p20090405 index NULL PRIMARY 7 NULL 12 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 +WHERE b < CAST('2009-04-03 00:00:01' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 7 NULL 12 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 +WHERE b <= CAST('2009-04-03 00:00:01' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 7 NULL 12 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 +WHERE b = CAST('2009-04-03 00:00:01' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +EXPLAIN PARTITIONS SELECT * FROM t1 +WHERE b >= CAST('2009-04-03 00:00:01' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090404,p20090405 index NULL PRIMARY 7 NULL 12 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 +WHERE b > CAST('2009-04-03 00:00:01' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090404,p20090405 index NULL PRIMARY 7 NULL 12 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 +WHERE b < CAST('2009-04-02 23:59:58' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 7 NULL 12 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 +WHERE b <= CAST('2009-04-02 23:59:58' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 7 NULL 12 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 +WHERE b = CAST('2009-04-02 23:59:58' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +EXPLAIN PARTITIONS SELECT * FROM t1 +WHERE b >= CAST('2009-04-02 23:59:58' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090403,p20090404,p20090405 index NULL PRIMARY 7 NULL 12 Using where; Using index +EXPLAIN PARTITIONS SELECT * FROM t1 +WHERE b > CAST('2009-04-02 23:59:58' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090403,p20090404,p20090405 index NULL PRIMARY 7 NULL 12 Using where; Using index +DROP TABLE t1; +# Test with DATETIME column NULL +CREATE TABLE t1 ( +a int(10) unsigned NOT NULL, +b DATETIME NULL +) PARTITION BY RANGE (TO_DAYS(b)) +(PARTITION p20090401 VALUES LESS THAN (TO_DAYS('2009-04-02')), +PARTITION p20090402 VALUES LESS THAN (TO_DAYS('2009-04-03')), +PARTITION p20090403 VALUES LESS THAN (TO_DAYS('2009-04-04')), +PARTITION p20090404 VALUES LESS THAN (TO_DAYS('2009-04-05')), +PARTITION p20090405 VALUES LESS THAN MAXVALUE); +INSERT INTO t1 VALUES (1, '2009-01-01'), (1, '2009-04-01'), (2, '2009-04-01'), +(1, '2009-04-02'), (2, '2009-04-02'), (1, '2009-04-02 23:59:59'), +(1, '2009-04-03'), (2, '2009-04-03'), (1, '2009-04-04'), (2, '2009-04-04'), +(1, '2009-04-05'), (1, '2009-04-06'), (1, '2009-04-07'); +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-03' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 6 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-03' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090401,p20090402,p20090403 ALL NULL NULL NULL NULL 8 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090403 ALL NULL NULL NULL NULL 8 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 13 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 13 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 +WHERE b < CAST('2009-04-02 23:59:59' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 13 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 +WHERE b <= CAST('2009-04-02 23:59:59' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 13 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 +WHERE b = CAST('2009-04-02 23:59:59' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090402 ALL NULL NULL NULL NULL 13 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 +WHERE b >= CAST('2009-04-02 23:59:59' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090402,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 13 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 +WHERE b > CAST('2009-04-02 23:59:59' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 13 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-03' AS DATE); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 13 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-03' AS DATE); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090401,p20090402,p20090403 ALL NULL NULL NULL NULL 13 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATE); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090403 ALL NULL NULL NULL NULL 13 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATE); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 13 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATE); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 13 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-03 00:00:00'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 13 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-03 00:00:00'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090401,p20090402,p20090403 ALL NULL NULL NULL NULL 13 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-03 00:00:00'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090403 ALL NULL NULL NULL NULL 13 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-03 00:00:00'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 13 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-03 00:00:00'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 13 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-02 23:59:59'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 13 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-02 23:59:59'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 13 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-02 23:59:59'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090402 ALL NULL NULL NULL NULL 13 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-02 23:59:59'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090402,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 13 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-02 23:59:59'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 13 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-03'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 13 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-03'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090401,p20090402,p20090403 ALL NULL NULL NULL NULL 13 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-03'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090403 ALL NULL NULL NULL NULL 13 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-03'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 13 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-03'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 13 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 +WHERE b < CAST('2009-04-03 00:00:01' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090401,p20090402,p20090403 ALL NULL NULL NULL NULL 13 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 +WHERE b <= CAST('2009-04-03 00:00:01' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090401,p20090402,p20090403 ALL NULL NULL NULL NULL 13 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 +WHERE b = CAST('2009-04-03 00:00:01' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090403 ALL NULL NULL NULL NULL 13 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 +WHERE b >= CAST('2009-04-03 00:00:01' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 13 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 +WHERE b > CAST('2009-04-03 00:00:01' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 13 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 +WHERE b < CAST('2009-04-02 23:59:58' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 13 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 +WHERE b <= CAST('2009-04-02 23:59:58' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 13 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 +WHERE b = CAST('2009-04-02 23:59:58' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090402 ALL NULL NULL NULL NULL 13 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 +WHERE b >= CAST('2009-04-02 23:59:58' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090402,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 13 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 +WHERE b > CAST('2009-04-02 23:59:58' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090402,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 13 Using where +DROP TABLE t1; +# Test with DATE column NULL +CREATE TABLE t1 ( +a int(10) unsigned NOT NULL, +b DATE NULL +) PARTITION BY RANGE (TO_DAYS(b)) +(PARTITION p20090401 VALUES LESS THAN (TO_DAYS('2009-04-02')), +PARTITION p20090402 VALUES LESS THAN (TO_DAYS('2009-04-03')), +PARTITION p20090403 VALUES LESS THAN (TO_DAYS('2009-04-04')), +PARTITION p20090404 VALUES LESS THAN (TO_DAYS('2009-04-05')), +PARTITION p20090405 VALUES LESS THAN MAXVALUE); +INSERT INTO t1 VALUES (1, '2009-01-01'), (1, '2009-04-01'), (2, '2009-04-01'), +(1, '2009-04-02'), (2, '2009-04-02'), (1, '2009-04-03'), (2, '2009-04-03'), +(1, '2009-04-04'), (2, '2009-04-04'), (1, '2009-04-05'), (1, '2009-04-06'), +(1, '2009-04-07'); +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-03' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 5 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-03' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090401,p20090402,p20090403 ALL NULL NULL NULL NULL 7 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090403 ALL NULL NULL NULL NULL 7 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 12 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090404,p20090405 ALL NULL NULL NULL NULL 12 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 +WHERE b < CAST('2009-04-02 23:59:59' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 12 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 +WHERE b <= CAST('2009-04-02 23:59:59' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 12 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 +WHERE b = CAST('2009-04-02 23:59:59' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +EXPLAIN PARTITIONS SELECT * FROM t1 +WHERE b >= CAST('2009-04-02 23:59:59' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 12 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 +WHERE b > CAST('2009-04-02 23:59:59' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 12 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-03' AS DATE); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 12 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-03' AS DATE); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090401,p20090402,p20090403 ALL NULL NULL NULL NULL 12 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATE); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090403 ALL NULL NULL NULL NULL 12 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATE); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 12 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATE); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090404,p20090405 ALL NULL NULL NULL NULL 12 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-03 00:00:00'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 12 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-03 00:00:00'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090401,p20090402,p20090403 ALL NULL NULL NULL NULL 12 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-03 00:00:00'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090403 ALL NULL NULL NULL NULL 12 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-03 00:00:00'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 12 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-03 00:00:00'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090404,p20090405 ALL NULL NULL NULL NULL 12 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-02 23:59:59'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 12 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-02 23:59:59'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 12 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-02 23:59:59'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-02 23:59:59'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 12 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-02 23:59:59'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 12 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-03'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 12 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-03'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090401,p20090402,p20090403 ALL NULL NULL NULL NULL 12 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-03'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090403 ALL NULL NULL NULL NULL 12 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-03'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 12 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-03'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090404,p20090405 ALL NULL NULL NULL NULL 12 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 +WHERE b < CAST('2009-04-03 00:00:01' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090401,p20090402,p20090403 ALL NULL NULL NULL NULL 12 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 +WHERE b <= CAST('2009-04-03 00:00:01' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090401,p20090402,p20090403 ALL NULL NULL NULL NULL 12 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 +WHERE b = CAST('2009-04-03 00:00:01' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +EXPLAIN PARTITIONS SELECT * FROM t1 +WHERE b >= CAST('2009-04-03 00:00:01' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090404,p20090405 ALL NULL NULL NULL NULL 12 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 +WHERE b > CAST('2009-04-03 00:00:01' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090404,p20090405 ALL NULL NULL NULL NULL 12 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 +WHERE b < CAST('2009-04-02 23:59:58' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 12 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 +WHERE b <= CAST('2009-04-02 23:59:58' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 12 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 +WHERE b = CAST('2009-04-02 23:59:58' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +EXPLAIN PARTITIONS SELECT * FROM t1 +WHERE b >= CAST('2009-04-02 23:59:58' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 12 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 +WHERE b > CAST('2009-04-02 23:59:58' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 12 Using where +DROP TABLE t1; +# For better code coverage of the patch +CREATE TABLE t1 ( +a int(10) unsigned NOT NULL, +b DATE +) PARTITION BY RANGE ( TO_DAYS(b) ) +(PARTITION p20090401 VALUES LESS THAN (TO_DAYS('2009-04-02')), +PARTITION p20090402 VALUES LESS THAN (TO_DAYS('2009-04-03')), +PARTITION p20090403 VALUES LESS THAN (TO_DAYS('2009-04-04')), +PARTITION p20090404 VALUES LESS THAN (TO_DAYS('2009-04-05')), +PARTITION p20090405 VALUES LESS THAN MAXVALUE); +INSERT INTO t1 VALUES (1, '2009-01-01'), (2, NULL); +# test with an invalid date, which lead to item->null_value is set. +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-99' AS DATETIME); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +Warnings: +Warning 1292 Incorrect datetime value: '2009-04-99' +Warning 1292 Incorrect datetime value: '2009-04-99' +DROP TABLE t1; CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT, b DATETIME, diff --git a/mysql-test/t/partition_pruning.test b/mysql-test/t/partition_pruning.test index ad102062ef8..ef28820852e 100644 --- a/mysql-test/t/partition_pruning.test +++ b/mysql-test/t/partition_pruning.test @@ -8,6 +8,314 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; --enable_warnings +# +# Bug#46362: Endpoint should be set to false for TO_DAYS(DATE) +# +# There is a problem when comparing DATE with DATETIME. +# In pruning it is converted into the field type +# and in row evaluation it is converted to longlong +# (like a DATETIME). +--echo # Test with DATETIME column NOT NULL +CREATE TABLE t1 ( + a int(10) unsigned NOT NULL, + b DATETIME NOT NULL, + PRIMARY KEY (a, b) +) PARTITION BY RANGE (TO_DAYS(b)) +(PARTITION p20090401 VALUES LESS THAN (TO_DAYS('2009-04-02')), + PARTITION p20090402 VALUES LESS THAN (TO_DAYS('2009-04-03')), + PARTITION p20090403 VALUES LESS THAN (TO_DAYS('2009-04-04')), + PARTITION p20090404 VALUES LESS THAN (TO_DAYS('2009-04-05')), + PARTITION p20090405 VALUES LESS THAN MAXVALUE); +INSERT INTO t1 VALUES (1, '2009-01-01'), (1, '2009-04-01'), (2, '2009-04-01'), + (1, '2009-04-02'), (2, '2009-04-02'), (1, '2009-04-02 23:59:59'), + (1, '2009-04-03'), (2, '2009-04-03'), (1, '2009-04-04'), (2, '2009-04-04'), + (1, '2009-04-05'), (1, '2009-04-06'), (1, '2009-04-07'); +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-03' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-03' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 + WHERE b < CAST('2009-04-02 23:59:59' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 + WHERE b <= CAST('2009-04-02 23:59:59' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 + WHERE b = CAST('2009-04-02 23:59:59' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 + WHERE b >= CAST('2009-04-02 23:59:59' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 + WHERE b > CAST('2009-04-02 23:59:59' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-03' AS DATE); +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-03' AS DATE); +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATE); +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATE); +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATE); +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-03 00:00:00'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-03 00:00:00'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-03 00:00:00'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-03 00:00:00'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-03 00:00:00'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-02 23:59:59'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-02 23:59:59'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-02 23:59:59'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-02 23:59:59'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-02 23:59:59'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-03'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-03'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-03'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-03'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-03'; +EXPLAIN PARTITIONS SELECT * FROM t1 + WHERE b < CAST('2009-04-03 00:00:01' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 + WHERE b <= CAST('2009-04-03 00:00:01' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 + WHERE b = CAST('2009-04-03 00:00:01' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 + WHERE b >= CAST('2009-04-03 00:00:01' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 + WHERE b > CAST('2009-04-03 00:00:01' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 + WHERE b < CAST('2009-04-02 23:59:58' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 + WHERE b <= CAST('2009-04-02 23:59:58' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 + WHERE b = CAST('2009-04-02 23:59:58' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 + WHERE b >= CAST('2009-04-02 23:59:58' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 + WHERE b > CAST('2009-04-02 23:59:58' AS DATETIME); +DROP TABLE t1; + +--echo # Test with DATE column NOT NULL +CREATE TABLE t1 ( + a int(10) unsigned NOT NULL, + b DATE NOT NULL, + PRIMARY KEY (a, b) +) PARTITION BY RANGE (TO_DAYS(b)) +(PARTITION p20090401 VALUES LESS THAN (TO_DAYS('2009-04-02')), + PARTITION p20090402 VALUES LESS THAN (TO_DAYS('2009-04-03')), + PARTITION p20090403 VALUES LESS THAN (TO_DAYS('2009-04-04')), + PARTITION p20090404 VALUES LESS THAN (TO_DAYS('2009-04-05')), + PARTITION p20090405 VALUES LESS THAN MAXVALUE); +INSERT INTO t1 VALUES (1, '2009-01-01'), (1, '2009-04-01'), (2, '2009-04-01'), + (1, '2009-04-02'), (2, '2009-04-02'), (1, '2009-04-03'), (2, '2009-04-03'), + (1, '2009-04-04'), (2, '2009-04-04'), (1, '2009-04-05'), (1, '2009-04-06'), + (1, '2009-04-07'); +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-03' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-03' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 + WHERE b < CAST('2009-04-02 23:59:59' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 + WHERE b <= CAST('2009-04-02 23:59:59' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 + WHERE b = CAST('2009-04-02 23:59:59' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 + WHERE b >= CAST('2009-04-02 23:59:59' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 + WHERE b > CAST('2009-04-02 23:59:59' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-03' AS DATE); +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-03' AS DATE); +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATE); +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATE); +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATE); +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-03 00:00:00'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-03 00:00:00'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-03 00:00:00'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-03 00:00:00'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-03 00:00:00'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-02 23:59:59'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-02 23:59:59'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-02 23:59:59'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-02 23:59:59'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-02 23:59:59'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-03'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-03'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-03'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-03'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-03'; +EXPLAIN PARTITIONS SELECT * FROM t1 + WHERE b < CAST('2009-04-03 00:00:01' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 + WHERE b <= CAST('2009-04-03 00:00:01' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 + WHERE b = CAST('2009-04-03 00:00:01' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 + WHERE b >= CAST('2009-04-03 00:00:01' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 + WHERE b > CAST('2009-04-03 00:00:01' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 + WHERE b < CAST('2009-04-02 23:59:58' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 + WHERE b <= CAST('2009-04-02 23:59:58' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 + WHERE b = CAST('2009-04-02 23:59:58' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 + WHERE b >= CAST('2009-04-02 23:59:58' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 + WHERE b > CAST('2009-04-02 23:59:58' AS DATETIME); +DROP TABLE t1; + +--echo # Test with DATETIME column NULL +CREATE TABLE t1 ( + a int(10) unsigned NOT NULL, + b DATETIME NULL +) PARTITION BY RANGE (TO_DAYS(b)) +(PARTITION p20090401 VALUES LESS THAN (TO_DAYS('2009-04-02')), + PARTITION p20090402 VALUES LESS THAN (TO_DAYS('2009-04-03')), + PARTITION p20090403 VALUES LESS THAN (TO_DAYS('2009-04-04')), + PARTITION p20090404 VALUES LESS THAN (TO_DAYS('2009-04-05')), + PARTITION p20090405 VALUES LESS THAN MAXVALUE); +INSERT INTO t1 VALUES (1, '2009-01-01'), (1, '2009-04-01'), (2, '2009-04-01'), + (1, '2009-04-02'), (2, '2009-04-02'), (1, '2009-04-02 23:59:59'), + (1, '2009-04-03'), (2, '2009-04-03'), (1, '2009-04-04'), (2, '2009-04-04'), + (1, '2009-04-05'), (1, '2009-04-06'), (1, '2009-04-07'); +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-03' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-03' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 + WHERE b < CAST('2009-04-02 23:59:59' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 + WHERE b <= CAST('2009-04-02 23:59:59' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 + WHERE b = CAST('2009-04-02 23:59:59' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 + WHERE b >= CAST('2009-04-02 23:59:59' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 + WHERE b > CAST('2009-04-02 23:59:59' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-03' AS DATE); +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-03' AS DATE); +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATE); +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATE); +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATE); +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-03 00:00:00'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-03 00:00:00'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-03 00:00:00'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-03 00:00:00'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-03 00:00:00'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-02 23:59:59'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-02 23:59:59'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-02 23:59:59'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-02 23:59:59'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-02 23:59:59'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-03'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-03'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-03'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-03'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-03'; +EXPLAIN PARTITIONS SELECT * FROM t1 + WHERE b < CAST('2009-04-03 00:00:01' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 + WHERE b <= CAST('2009-04-03 00:00:01' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 + WHERE b = CAST('2009-04-03 00:00:01' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 + WHERE b >= CAST('2009-04-03 00:00:01' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 + WHERE b > CAST('2009-04-03 00:00:01' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 + WHERE b < CAST('2009-04-02 23:59:58' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 + WHERE b <= CAST('2009-04-02 23:59:58' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 + WHERE b = CAST('2009-04-02 23:59:58' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 + WHERE b >= CAST('2009-04-02 23:59:58' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 + WHERE b > CAST('2009-04-02 23:59:58' AS DATETIME); +DROP TABLE t1; + +--echo # Test with DATE column NULL +CREATE TABLE t1 ( + a int(10) unsigned NOT NULL, + b DATE NULL +) PARTITION BY RANGE (TO_DAYS(b)) +(PARTITION p20090401 VALUES LESS THAN (TO_DAYS('2009-04-02')), + PARTITION p20090402 VALUES LESS THAN (TO_DAYS('2009-04-03')), + PARTITION p20090403 VALUES LESS THAN (TO_DAYS('2009-04-04')), + PARTITION p20090404 VALUES LESS THAN (TO_DAYS('2009-04-05')), + PARTITION p20090405 VALUES LESS THAN MAXVALUE); +INSERT INTO t1 VALUES (1, '2009-01-01'), (1, '2009-04-01'), (2, '2009-04-01'), + (1, '2009-04-02'), (2, '2009-04-02'), (1, '2009-04-03'), (2, '2009-04-03'), + (1, '2009-04-04'), (2, '2009-04-04'), (1, '2009-04-05'), (1, '2009-04-06'), + (1, '2009-04-07'); +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-03' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-03' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 + WHERE b < CAST('2009-04-02 23:59:59' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 + WHERE b <= CAST('2009-04-02 23:59:59' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 + WHERE b = CAST('2009-04-02 23:59:59' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 + WHERE b >= CAST('2009-04-02 23:59:59' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 + WHERE b > CAST('2009-04-02 23:59:59' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-03' AS DATE); +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-03' AS DATE); +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATE); +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATE); +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATE); +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-03 00:00:00'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-03 00:00:00'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-03 00:00:00'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-03 00:00:00'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-03 00:00:00'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-02 23:59:59'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-02 23:59:59'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-02 23:59:59'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-02 23:59:59'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-02 23:59:59'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-03'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-03'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-03'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-03'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-03'; +EXPLAIN PARTITIONS SELECT * FROM t1 + WHERE b < CAST('2009-04-03 00:00:01' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 + WHERE b <= CAST('2009-04-03 00:00:01' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 + WHERE b = CAST('2009-04-03 00:00:01' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 + WHERE b >= CAST('2009-04-03 00:00:01' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 + WHERE b > CAST('2009-04-03 00:00:01' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 + WHERE b < CAST('2009-04-02 23:59:58' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 + WHERE b <= CAST('2009-04-02 23:59:58' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 + WHERE b = CAST('2009-04-02 23:59:58' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 + WHERE b >= CAST('2009-04-02 23:59:58' AS DATETIME); +EXPLAIN PARTITIONS SELECT * FROM t1 + WHERE b > CAST('2009-04-02 23:59:58' AS DATETIME); +DROP TABLE t1; + +--echo # For better code coverage of the patch +CREATE TABLE t1 ( + a int(10) unsigned NOT NULL, + b DATE +) PARTITION BY RANGE ( TO_DAYS(b) ) +(PARTITION p20090401 VALUES LESS THAN (TO_DAYS('2009-04-02')), + PARTITION p20090402 VALUES LESS THAN (TO_DAYS('2009-04-03')), + PARTITION p20090403 VALUES LESS THAN (TO_DAYS('2009-04-04')), + PARTITION p20090404 VALUES LESS THAN (TO_DAYS('2009-04-05')), + PARTITION p20090405 VALUES LESS THAN MAXVALUE); +INSERT INTO t1 VALUES (1, '2009-01-01'), (2, NULL); +--echo # test with an invalid date, which lead to item->null_value is set. +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-99' AS DATETIME); +DROP TABLE t1; + # # Bug#40972: some sql execution lead the whole database crashing # diff --git a/sql-common/my_time.c b/sql-common/my_time.c index 747c5797ed4..a1b85049934 100644 --- a/sql-common/my_time.c +++ b/sql-common/my_time.c @@ -450,9 +450,7 @@ str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time, } } - DBUG_RETURN(l_time->time_type= - (number_of_fields <= 3 ? MYSQL_TIMESTAMP_DATE : - MYSQL_TIMESTAMP_DATETIME)); + DBUG_RETURN(l_time->time_type); err: bzero((char*) l_time, sizeof(*l_time)); diff --git a/sql/item.cc b/sql/item.cc index 2640b74851b..79ae4b20f30 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -6846,14 +6846,21 @@ void resolve_const_item(THD *thd, Item **ref, Item *comp_item) } /** - Return true if the value stored in the field is equal to the const - item. + Compare the value stored in field, with the original item. - We need to use this on the range optimizer because in some cases - we can't store the value in the field without some precision/character loss. + @param field field which the item is converted and stored in + @param item original item + + @return Return an integer greater than, equal to, or less than 0 if + the value stored in the field is greater than, equal to, + or less than the original item + + @note We only use this on the range optimizer/partition pruning, + because in some cases we can't store the value in the field + without some precision/character loss. */ -bool field_is_equal_to_item(Field *field,Item *item) +int stored_field_cmp_to_item(Field *field, Item *item) { Item_result res_type=item_cmp_type(field->result_type(), @@ -6864,28 +6871,49 @@ bool field_is_equal_to_item(Field *field,Item *item) char field_buff[MAX_FIELD_WIDTH]; String item_tmp(item_buff,sizeof(item_buff),&my_charset_bin),*item_result; String field_tmp(field_buff,sizeof(field_buff),&my_charset_bin); + enum_field_types field_type; item_result=item->val_str(&item_tmp); if (item->null_value) - return 1; // This must be true + return 0; field->val_str(&field_tmp); - return !stringcmp(&field_tmp,item_result); + + /* + If comparing DATE with DATETIME, append the time-part to the DATE. + So that the strings are equally formatted. + A DATE converted to string is 10 characters, and a DATETIME converted + to string is 19 characters. + */ + field_type= field->type(); + if (field_type == MYSQL_TYPE_DATE && + item_result->length() == 19) + field_tmp.append(" 00:00:00"); + else if (field_type == MYSQL_TYPE_DATETIME && + item_result->length() == 10) + item_result->append(" 00:00:00"); + + return stringcmp(&field_tmp,item_result); } if (res_type == INT_RESULT) - return 1; // Both where of type int + return 0; // Both are of type int if (res_type == DECIMAL_RESULT) { my_decimal item_buf, *item_val, field_buf, *field_val; item_val= item->val_decimal(&item_buf); if (item->null_value) - return 1; // This must be true + return 0; field_val= field->val_decimal(&field_buf); - return !my_decimal_cmp(item_val, field_val); + return my_decimal_cmp(item_val, field_val); } double result= item->val_real(); if (item->null_value) + return 0; + double field_result= field->val_real(); + if (field_result < result) + return -1; + else if (field_result > result) return 1; - return result == field->val_real(); + return 0; } Item_cache* Item_cache::get_cache(const Item *item) diff --git a/sql/item.h b/sql/item.h index 3dfcd7c2612..8b37bd3c26d 100644 --- a/sql/item.h +++ b/sql/item.h @@ -576,8 +576,8 @@ public: left_endp FALSE <=> The interval is "x < const" or "x <= const" TRUE <=> The interval is "x > const" or "x >= const" - incl_endp IN TRUE <=> the comparison is '<' or '>' - FALSE <=> the comparison is '<=' or '>=' + incl_endp IN FALSE <=> the comparison is '<' or '>' + TRUE <=> the comparison is '<=' or '>=' OUT The same but for the "F(x) $CMP$ F(const)" comparison DESCRIPTION @@ -3117,4 +3117,4 @@ void mark_select_range_as_dependent(THD *thd, extern Cached_item *new_Cached_item(THD *thd, Item *item); extern Item_result item_cmp_type(Item_result a,Item_result b); extern void resolve_const_item(THD *thd, Item **ref, Item *cmp_item); -extern bool field_is_equal_to_item(Field *field,Item *item); +extern int stored_field_cmp_to_item(Field *field, Item *item); diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index d79b0b02998..eebede32f8d 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -991,15 +991,19 @@ longlong Item_func_to_days::val_int_endpoint(bool left_endp, bool *incl_endp) point to day bound ("strictly less" comparison stays intact): col < '2007-09-15 00:00:00' -> TO_DAYS(col) < TO_DAYS('2007-09-15') + col > '2007-09-15 23:59:59' -> TO_DAYS(col) > TO_DAYS('2007-09-15') which is different from the general case ("strictly less" changes to "less or equal"): col < '2007-09-15 12:34:56' -> TO_DAYS(col) <= TO_DAYS('2007-09-15') */ - if (!left_endp && !(ltime.hour || ltime.minute || ltime.second || - ltime.second_part)) - ; /* do nothing */ + if ((!left_endp && !(ltime.hour || ltime.minute || ltime.second || + ltime.second_part)) || + (left_endp && ltime.hour == 23 && ltime.minute == 59 && + ltime.second == 59)) + /* do nothing */ + ; else *incl_endp= TRUE; return res; diff --git a/sql/opt_range.cc b/sql/opt_range.cc index e3aef02637f..96631a741da 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -5855,7 +5855,7 @@ get_mm_leaf(RANGE_OPT_PARAM *param, COND *conf_func, Field *field, but we'll need to convert '>' to '>=' and '<' to '<='. This will be done together with other types at the end of this function - (grep for field_is_equal_to_item) + (grep for stored_field_cmp_to_item) */ } else @@ -5930,7 +5930,7 @@ get_mm_leaf(RANGE_OPT_PARAM *param, COND *conf_func, Field *field, switch (type) { case Item_func::LT_FUNC: - if (field_is_equal_to_item(field,value)) + if (stored_field_cmp_to_item(field,value) == 0) tree->max_flag=NEAR_MAX; /* fall through */ case Item_func::LE_FUNC: @@ -5944,11 +5944,16 @@ get_mm_leaf(RANGE_OPT_PARAM *param, COND *conf_func, Field *field, break; case Item_func::GT_FUNC: /* Don't use open ranges for partial key_segments */ - if (field_is_equal_to_item(field,value) && - !(key_part->flag & HA_PART_KEY_SEG)) + if ((!(key_part->flag & HA_PART_KEY_SEG)) && + (stored_field_cmp_to_item(field, value) <= 0)) tree->min_flag=NEAR_MIN; - /* fall through */ + tree->max_flag= NO_MAX_RANGE; + break; case Item_func::GE_FUNC: + /* Don't use open ranges for partial key_segments */ + if ((!(key_part->flag & HA_PART_KEY_SEG)) && + (stored_field_cmp_to_item(field,value) < 0)) + tree->min_flag= NEAR_MIN; tree->max_flag=NO_MAX_RANGE; break; case Item_func::SP_EQUALS_FUNC: From 401fb7c6fb84d1fe255fd490a0d3eb6ccb216507 Mon Sep 17 00:00:00 2001 From: Mattias Jonsson Date: Wed, 26 Aug 2009 12:59:49 +0200 Subject: [PATCH 06/68] Bug#20577: Partitions: use of to_days() function leads to selection failures Problem was that the partition containing NULL values was pruned away, since '2001-01-01' < '2001-02-00' but TO_DAYS('2001-02-00') is NULL. Added the NULL partition for RANGE/LIST partitioning on TO_DAYS() function to be scanned too. Also fixed a bug that added ALLOW_INVALID_DATES to sql_mode (SELECT * FROM t WHERE date_col < '1999-99-99' on a RANGE/LIST partitioned table would add it). --- mysql-test/include/partition_date_range.inc | 63 +++ mysql-test/r/partition_pruning.result | 425 ++++++++++++++++++++ mysql-test/r/partition_range.result | 4 +- mysql-test/t/partition_pruning.test | 44 ++ sql/item.h | 9 +- sql/item_timefunc.cc | 21 +- sql/opt_range.cc | 4 + sql/partition_info.h | 1 + sql/sql_partition.cc | 65 ++- 9 files changed, 624 insertions(+), 12 deletions(-) create mode 100644 mysql-test/include/partition_date_range.inc diff --git a/mysql-test/include/partition_date_range.inc b/mysql-test/include/partition_date_range.inc new file mode 100644 index 00000000000..c54396af9cb --- /dev/null +++ b/mysql-test/include/partition_date_range.inc @@ -0,0 +1,63 @@ +# Created for verifying bug#20577. +# expects TABLE t1 (... , a DATE, ...) + +--sorted_result +SELECT * FROM t1 WHERE a < '1001-01-01'; +--sorted_result +SELECT * FROM t1 WHERE a <= '1001-01-01'; +--sorted_result +SELECT * FROM t1 WHERE a >= '1001-01-01'; +--sorted_result +SELECT * FROM t1 WHERE a > '1001-01-01'; +--sorted_result +SELECT * FROM t1 WHERE a = '1001-01-01'; +--sorted_result +SELECT * FROM t1 WHERE a < '1001-00-00'; +--sorted_result +SELECT * FROM t1 WHERE a <= '1001-00-00'; +--sorted_result +SELECT * FROM t1 WHERE a >= '1001-00-00'; +--sorted_result +SELECT * FROM t1 WHERE a > '1001-00-00'; +--sorted_result +SELECT * FROM t1 WHERE a = '1001-00-00'; +--sorted_result +SELECT * FROM t1 WHERE a < '1999-02-31'; +--sorted_result +SELECT * FROM t1 WHERE a <= '1999-02-31'; +--sorted_result +SELECT * FROM t1 WHERE a >= '1999-02-31'; +--sorted_result +SELECT * FROM t1 WHERE a > '1999-02-31'; +--sorted_result +SELECT * FROM t1 WHERE a = '1999-02-31'; +--sorted_result +SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1002-00-00'; +--sorted_result +SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1001-01-01'; +--sorted_result +SELECT * FROM t1 WHERE a BETWEEN '0001-01-02' AND '1002-00-00'; +--sorted_result +SELECT * FROM t1 WHERE a BETWEEN '0001-01-01' AND '1001-01-01'; +if ($explain_partitions) +{ +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1001-01-01'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1001-01-01'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1001-01-01'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > '1001-01-01'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1001-01-01'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1001-00-00'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1001-00-00'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1001-00-00'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > '1001-00-00'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1001-00-00'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1999-02-31'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1999-02-31'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1999-02-31'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > '1999-02-31'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1999-02-31'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1002-00-00'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1001-01-01'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0001-01-02' AND '1002-00-00'; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0001-01-01' AND '1001-01-01'; +} diff --git a/mysql-test/r/partition_pruning.result b/mysql-test/r/partition_pruning.result index 26ddc92e97b..7ac1e24cfab 100644 --- a/mysql-test/r/partition_pruning.result +++ b/mysql-test/r/partition_pruning.result @@ -1,4 +1,429 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +# test of RANGE and index +CREATE TABLE t1 (a DATE, KEY(a)) +PARTITION BY RANGE (TO_DAYS(a)) +(PARTITION `pNULL` VALUES LESS THAN (0), +PARTITION `p0001-01-01` VALUES LESS THAN (366 + 1), +PARTITION `p1001-01-01` VALUES LESS THAN (TO_DAYS('1001-01-01') + 1), +PARTITION `p2001-01-01` VALUES LESS THAN (TO_DAYS('2001-01-01') + 1)); +INSERT INTO t1 VALUES ('0000-00-00'), ('0000-01-02'), ('0001-01-01'), +('1001-00-00'), ('1001-01-01'), ('1002-00-00'), ('2001-01-01'); +SELECT * FROM t1 WHERE a < '1001-01-01'; +a +0000-00-00 +0000-01-02 +0001-01-01 +1001-00-00 +SELECT * FROM t1 WHERE a <= '1001-01-01'; +a +0000-00-00 +0000-01-02 +0001-01-01 +1001-00-00 +1001-01-01 +SELECT * FROM t1 WHERE a >= '1001-01-01'; +a +1001-01-01 +1002-00-00 +2001-01-01 +SELECT * FROM t1 WHERE a > '1001-01-01'; +a +1002-00-00 +2001-01-01 +SELECT * FROM t1 WHERE a = '1001-01-01'; +a +1001-01-01 +SELECT * FROM t1 WHERE a < '1001-00-00'; +a +0000-00-00 +0000-01-02 +0001-01-01 +SELECT * FROM t1 WHERE a <= '1001-00-00'; +a +0000-00-00 +0000-01-02 +0001-01-01 +1001-00-00 +SELECT * FROM t1 WHERE a >= '1001-00-00'; +a +1001-00-00 +1001-01-01 +1002-00-00 +2001-01-01 +SELECT * FROM t1 WHERE a > '1001-00-00'; +a +1001-01-01 +1002-00-00 +2001-01-01 +SELECT * FROM t1 WHERE a = '1001-00-00'; +a +1001-00-00 +SELECT * FROM t1 WHERE a < '1999-02-31'; +a +0000-00-00 +0000-01-02 +0001-01-01 +1001-00-00 +1001-01-01 +1002-00-00 +SELECT * FROM t1 WHERE a <= '1999-02-31'; +a +0000-00-00 +0000-01-02 +0001-01-01 +1001-00-00 +1001-01-01 +1002-00-00 +SELECT * FROM t1 WHERE a >= '1999-02-31'; +a +2001-01-01 +SELECT * FROM t1 WHERE a > '1999-02-31'; +a +2001-01-01 +SELECT * FROM t1 WHERE a = '1999-02-31'; +a +Warning 1292 Incorrect date value: '1999-02-31' for column 'a' at row 1 +Warnings: +SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1002-00-00'; +a +0000-00-00 +0000-01-02 +0001-01-01 +1001-00-00 +1001-01-01 +1002-00-00 +SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1001-01-01'; +a +0000-00-00 +0000-01-02 +0001-01-01 +1001-00-00 +1001-01-01 +SELECT * FROM t1 WHERE a BETWEEN '0001-01-02' AND '1002-00-00'; +a +1001-00-00 +1001-01-01 +1002-00-00 +SELECT * FROM t1 WHERE a BETWEEN '0001-01-01' AND '1001-01-01'; +a +0001-01-01 +1001-00-00 +1001-01-01 +# test without index +ALTER TABLE t1 DROP KEY a; +SELECT * FROM t1 WHERE a < '1001-01-01'; +a +0000-00-00 +0000-01-02 +0001-01-01 +1001-00-00 +SELECT * FROM t1 WHERE a <= '1001-01-01'; +a +0000-00-00 +0000-01-02 +0001-01-01 +1001-00-00 +1001-01-01 +SELECT * FROM t1 WHERE a >= '1001-01-01'; +a +1001-01-01 +1002-00-00 +2001-01-01 +SELECT * FROM t1 WHERE a > '1001-01-01'; +a +1002-00-00 +2001-01-01 +SELECT * FROM t1 WHERE a = '1001-01-01'; +a +1001-01-01 +SELECT * FROM t1 WHERE a < '1001-00-00'; +a +0000-00-00 +0000-01-02 +0001-01-01 +SELECT * FROM t1 WHERE a <= '1001-00-00'; +a +0000-00-00 +0000-01-02 +0001-01-01 +1001-00-00 +SELECT * FROM t1 WHERE a >= '1001-00-00'; +a +1001-00-00 +1001-01-01 +1002-00-00 +2001-01-01 +SELECT * FROM t1 WHERE a > '1001-00-00'; +a +1001-01-01 +1002-00-00 +2001-01-01 +SELECT * FROM t1 WHERE a = '1001-00-00'; +a +1001-00-00 +SELECT * FROM t1 WHERE a < '1999-02-31'; +a +0000-00-00 +0000-01-02 +0001-01-01 +1001-00-00 +1001-01-01 +1002-00-00 +SELECT * FROM t1 WHERE a <= '1999-02-31'; +a +0000-00-00 +0000-01-02 +0001-01-01 +1001-00-00 +1001-01-01 +1002-00-00 +SELECT * FROM t1 WHERE a >= '1999-02-31'; +a +2001-01-01 +SELECT * FROM t1 WHERE a > '1999-02-31'; +a +2001-01-01 +SELECT * FROM t1 WHERE a = '1999-02-31'; +a +SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1002-00-00'; +a +0000-00-00 +0000-01-02 +0001-01-01 +1001-00-00 +1001-01-01 +1002-00-00 +SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1001-01-01'; +a +0000-00-00 +0000-01-02 +0001-01-01 +1001-00-00 +1001-01-01 +SELECT * FROM t1 WHERE a BETWEEN '0001-01-02' AND '1002-00-00'; +a +1001-00-00 +1001-01-01 +1002-00-00 +SELECT * FROM t1 WHERE a BETWEEN '0001-01-01' AND '1001-01-01'; +a +0001-01-01 +1001-00-00 +1001-01-01 +DROP TABLE t1; +# test of LIST and index +CREATE TABLE t1 (a DATE, KEY(a)) +PARTITION BY LIST (TO_DAYS(a)) +(PARTITION `p0001-01-01` VALUES IN (TO_DAYS('0001-01-01')), +PARTITION `p2001-01-01` VALUES IN (TO_DAYS('2001-01-01')), +PARTITION `pNULL` VALUES IN (NULL), +PARTITION `p0000-01-02` VALUES IN (TO_DAYS('0000-01-02')), +PARTITION `p1001-01-01` VALUES IN (TO_DAYS('1001-01-01'))); +INSERT INTO t1 VALUES ('0000-00-00'), ('0000-01-02'), ('0001-01-01'), +('1001-00-00'), ('1001-01-01'), ('1002-00-00'), ('2001-01-01'); +SELECT * FROM t1 WHERE a < '1001-01-01'; +a +0000-00-00 +0000-01-02 +0001-01-01 +1001-00-00 +SELECT * FROM t1 WHERE a <= '1001-01-01'; +a +0000-00-00 +0000-01-02 +0001-01-01 +1001-00-00 +1001-01-01 +SELECT * FROM t1 WHERE a >= '1001-01-01'; +a +1001-01-01 +1002-00-00 +2001-01-01 +SELECT * FROM t1 WHERE a > '1001-01-01'; +a +1002-00-00 +2001-01-01 +SELECT * FROM t1 WHERE a = '1001-01-01'; +a +1001-01-01 +SELECT * FROM t1 WHERE a < '1001-00-00'; +a +0000-00-00 +0000-01-02 +0001-01-01 +SELECT * FROM t1 WHERE a <= '1001-00-00'; +a +0000-00-00 +0000-01-02 +0001-01-01 +1001-00-00 +SELECT * FROM t1 WHERE a >= '1001-00-00'; +a +1001-00-00 +1001-01-01 +1002-00-00 +2001-01-01 +SELECT * FROM t1 WHERE a > '1001-00-00'; +a +1001-01-01 +1002-00-00 +2001-01-01 +SELECT * FROM t1 WHERE a = '1001-00-00'; +a +1001-00-00 +SELECT * FROM t1 WHERE a < '1999-02-31'; +a +0000-00-00 +0000-01-02 +0001-01-01 +1001-00-00 +1001-01-01 +1002-00-00 +SELECT * FROM t1 WHERE a <= '1999-02-31'; +a +0000-00-00 +0000-01-02 +0001-01-01 +1001-00-00 +1001-01-01 +1002-00-00 +SELECT * FROM t1 WHERE a >= '1999-02-31'; +a +2001-01-01 +SELECT * FROM t1 WHERE a > '1999-02-31'; +a +2001-01-01 +SELECT * FROM t1 WHERE a = '1999-02-31'; +a +Warning 1292 Incorrect date value: '1999-02-31' for column 'a' at row 1 +Warnings: +SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1002-00-00'; +a +0000-00-00 +0000-01-02 +0001-01-01 +1001-00-00 +1001-01-01 +1002-00-00 +SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1001-01-01'; +a +0000-00-00 +0000-01-02 +0001-01-01 +1001-00-00 +1001-01-01 +SELECT * FROM t1 WHERE a BETWEEN '0001-01-02' AND '1002-00-00'; +a +1001-00-00 +1001-01-01 +1002-00-00 +SELECT * FROM t1 WHERE a BETWEEN '0001-01-01' AND '1001-01-01'; +a +0001-01-01 +1001-00-00 +1001-01-01 +# test without index +ALTER TABLE t1 DROP KEY a; +SELECT * FROM t1 WHERE a < '1001-01-01'; +a +0000-00-00 +0000-01-02 +0001-01-01 +1001-00-00 +SELECT * FROM t1 WHERE a <= '1001-01-01'; +a +0000-00-00 +0000-01-02 +0001-01-01 +1001-00-00 +1001-01-01 +SELECT * FROM t1 WHERE a >= '1001-01-01'; +a +1001-01-01 +1002-00-00 +2001-01-01 +SELECT * FROM t1 WHERE a > '1001-01-01'; +a +1002-00-00 +2001-01-01 +SELECT * FROM t1 WHERE a = '1001-01-01'; +a +1001-01-01 +SELECT * FROM t1 WHERE a < '1001-00-00'; +a +0000-00-00 +0000-01-02 +0001-01-01 +SELECT * FROM t1 WHERE a <= '1001-00-00'; +a +0000-00-00 +0000-01-02 +0001-01-01 +1001-00-00 +SELECT * FROM t1 WHERE a >= '1001-00-00'; +a +1001-00-00 +1001-01-01 +1002-00-00 +2001-01-01 +SELECT * FROM t1 WHERE a > '1001-00-00'; +a +1001-01-01 +1002-00-00 +2001-01-01 +SELECT * FROM t1 WHERE a = '1001-00-00'; +a +1001-00-00 +SELECT * FROM t1 WHERE a < '1999-02-31'; +a +0000-00-00 +0000-01-02 +0001-01-01 +1001-00-00 +1001-01-01 +1002-00-00 +SELECT * FROM t1 WHERE a <= '1999-02-31'; +a +0000-00-00 +0000-01-02 +0001-01-01 +1001-00-00 +1001-01-01 +1002-00-00 +SELECT * FROM t1 WHERE a >= '1999-02-31'; +a +2001-01-01 +SELECT * FROM t1 WHERE a > '1999-02-31'; +a +2001-01-01 +SELECT * FROM t1 WHERE a = '1999-02-31'; +a +SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1002-00-00'; +a +0000-00-00 +0000-01-02 +0001-01-01 +1001-00-00 +1001-01-01 +1002-00-00 +SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1001-01-01'; +a +0000-00-00 +0000-01-02 +0001-01-01 +1001-00-00 +1001-01-01 +SELECT * FROM t1 WHERE a BETWEEN '0001-01-02' AND '1002-00-00'; +a +1001-00-00 +1001-01-01 +1002-00-00 +SELECT * FROM t1 WHERE a BETWEEN '0001-01-01' AND '1001-01-01'; +a +0001-01-01 +1001-00-00 +1001-01-01 +DROP TABLE t1; CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT, b DATETIME, diff --git a/mysql-test/r/partition_range.result b/mysql-test/r/partition_range.result index e8fc55b759b..02d2f6359c5 100644 --- a/mysql-test/r/partition_range.result +++ b/mysql-test/r/partition_range.result @@ -745,7 +745,7 @@ a EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '2004-07-01' AND a <= '2004-09-30'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p407,p408,p409 ALL NULL NULL NULL NULL 9 Using where +1 SIMPLE t1 p3xx,p407,p408,p409 ALL NULL NULL NULL NULL 18 Using where SELECT * from t1 WHERE (a >= '2004-07-01' AND a <= '2004-09-30') OR (a >= '2005-07-01' AND a <= '2005-09-30'); @@ -772,7 +772,7 @@ EXPLAIN PARTITIONS SELECT * from t1 WHERE (a >= '2004-07-01' AND a <= '2004-09-30') OR (a >= '2005-07-01' AND a <= '2005-09-30'); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p407,p408,p409,p507,p508,p509 ALL NULL NULL NULL NULL 18 Using where +1 SIMPLE t1 p3xx,p407,p408,p409,p507,p508,p509 ALL NULL NULL NULL NULL 27 Using where DROP TABLE t1; create table t1 (a int); insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); diff --git a/mysql-test/t/partition_pruning.test b/mysql-test/t/partition_pruning.test index ad102062ef8..511cfa595a4 100644 --- a/mysql-test/t/partition_pruning.test +++ b/mysql-test/t/partition_pruning.test @@ -8,6 +8,50 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; --enable_warnings +# +# Bug#20577: Partitions: use of to_days() function leads to selection failures +# +--let $explain_partitions= 1; +--let $verify_without_partitions= 0; +--echo # test of RANGE and index +CREATE TABLE t1 (a DATE, KEY(a)) +PARTITION BY RANGE (TO_DAYS(a)) +(PARTITION `pNULL` VALUES LESS THAN (0), + PARTITION `p0001-01-01` VALUES LESS THAN (366 + 1), + PARTITION `p1001-01-01` VALUES LESS THAN (TO_DAYS('1001-01-01') + 1), + PARTITION `p2001-01-01` VALUES LESS THAN (TO_DAYS('2001-01-01') + 1)); +if ($verify_without_partitions) +{ +ALTER TABLE t1 REMOVE PARTITIONING; +} +INSERT INTO t1 VALUES ('0000-00-00'), ('0000-01-02'), ('0001-01-01'), + ('1001-00-00'), ('1001-01-01'), ('1002-00-00'), ('2001-01-01'); +--source include/partition_date_range.inc +--echo # test without index +ALTER TABLE t1 DROP KEY a; +--source include/partition_date_range.inc +DROP TABLE t1; + +--echo # test of LIST and index +CREATE TABLE t1 (a DATE, KEY(a)) +PARTITION BY LIST (TO_DAYS(a)) +(PARTITION `p0001-01-01` VALUES IN (TO_DAYS('0001-01-01')), + PARTITION `p2001-01-01` VALUES IN (TO_DAYS('2001-01-01')), + PARTITION `pNULL` VALUES IN (NULL), + PARTITION `p0000-01-02` VALUES IN (TO_DAYS('0000-01-02')), + PARTITION `p1001-01-01` VALUES IN (TO_DAYS('1001-01-01'))); +if ($verify_without_partitions) +{ +ALTER TABLE t1 REMOVE PARTITIONING; +} +INSERT INTO t1 VALUES ('0000-00-00'), ('0000-01-02'), ('0001-01-01'), + ('1001-00-00'), ('1001-01-01'), ('1002-00-00'), ('2001-01-01'); +--source include/partition_date_range.inc +--echo # test without index +ALTER TABLE t1 DROP KEY a; +--source include/partition_date_range.inc +DROP TABLE t1; + # # Bug#40972: some sql execution lead the whole database crashing # diff --git a/sql/item.h b/sql/item.h index 3dfcd7c2612..30478ddf13d 100644 --- a/sql/item.h +++ b/sql/item.h @@ -397,13 +397,20 @@ public: from INT_RESULT, may be NULL, or are unsigned. It will be possible to address this issue once the related partitioning bugs (BUG#16002, BUG#15447, BUG#13436) are fixed. + + The NOT_NULL enums are used in TO_DAYS, since TO_DAYS('2001-00-00') returns + NULL which puts those rows into the NULL partition, but + '2000-12-31' < '2001-00-00' < '2001-01-01'. So special handling is needed + for this (see Bug#20577). */ typedef enum monotonicity_info { NON_MONOTONIC, /* none of the below holds */ MONOTONIC_INCREASING, /* F() is unary and (x < y) => (F(x) <= F(y)) */ - MONOTONIC_STRICT_INCREASING /* F() is unary and (x < y) => (F(x) < F(y)) */ + MONOTONIC_INCREASING_NOT_NULL, /* But only for valid/real x and y */ + MONOTONIC_STRICT_INCREASING,/* F() is unary and (x < y) => (F(x) < F(y)) */ + MONOTONIC_STRICT_INCREASING_NOT_NULL /* But only for valid/real x and y */ } enum_monotonicity_info; /*************************************************************************/ diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index d79b0b02998..eefe47232ae 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -960,9 +960,9 @@ enum_monotonicity_info Item_func_to_days::get_monotonicity_info() const if (args[0]->type() == Item::FIELD_ITEM) { if (args[0]->field_type() == MYSQL_TYPE_DATE) - return MONOTONIC_STRICT_INCREASING; + return MONOTONIC_STRICT_INCREASING_NOT_NULL; if (args[0]->field_type() == MYSQL_TYPE_DATETIME) - return MONOTONIC_INCREASING; + return MONOTONIC_INCREASING_NOT_NULL; } return NON_MONOTONIC; } @@ -973,12 +973,27 @@ longlong Item_func_to_days::val_int_endpoint(bool left_endp, bool *incl_endp) DBUG_ASSERT(fixed == 1); MYSQL_TIME ltime; longlong res; - if (get_arg0_date(<ime, TIME_NO_ZERO_DATE)) + int dummy; /* unused */ + if (get_arg0_date(<ime, TIME_FUZZY_DATE)) { /* got NULL, leave the incl_endp intact */ return LONGLONG_MIN; } res=(longlong) calc_daynr(ltime.year,ltime.month,ltime.day); + /* Set to NULL if invalid date, but keep the value */ + null_value= check_date(<ime, + (ltime.year || ltime.month || ltime.day), + (TIME_NO_ZERO_IN_DATE | TIME_NO_ZERO_DATE), + &dummy); + if (null_value) + { + /* + Even if the evaluation return NULL, the calc_daynr is useful for pruning + */ + if (args[0]->field_type() != MYSQL_TYPE_DATE) + *incl_endp= TRUE; + return res; + } if (args[0]->field_type() == MYSQL_TYPE_DATE) { diff --git a/sql/opt_range.cc b/sql/opt_range.cc index e3aef02637f..e26d91dcd44 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -5826,6 +5826,7 @@ get_mm_leaf(RANGE_OPT_PARAM *param, COND *conf_func, Field *field, { tree= new (alloc) SEL_ARG(field, 0, 0); tree->type= SEL_ARG::IMPOSSIBLE; + field->table->in_use->variables.sql_mode= orig_sql_mode; goto end; } else @@ -5859,7 +5860,10 @@ get_mm_leaf(RANGE_OPT_PARAM *param, COND *conf_func, Field *field, */ } else + { + field->table->in_use->variables.sql_mode= orig_sql_mode; goto end; + } } } diff --git a/sql/partition_info.h b/sql/partition_info.h index 415f955d5d4..8832b6ee409 100644 --- a/sql/partition_info.h +++ b/sql/partition_info.h @@ -300,6 +300,7 @@ static inline void init_single_partition_iterator(uint32 part_id, { part_iter->part_nums.start= part_iter->part_nums.cur= part_id; part_iter->part_nums.end= part_id+1; + part_iter->ret_null_part= part_iter->ret_null_part_orig= FALSE; part_iter->get_next= get_next_partition_id_range; } diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index 61766e5c509..ad24af12087 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -2766,8 +2766,24 @@ uint32 get_list_array_idx_for_endpoint(partition_info *part_info, if (part_info->part_expr->null_value) { - DBUG_RETURN(0); + /* + Special handling for MONOTONIC functions that can return NULL for + values that are comparable. I.e. + '2000-00-00' can be compared to '2000-01-01' but TO_DAYS('2000-00-00') + returns NULL which cannot be compared used <, >, <=, >= etc. + + Otherwise, just return the the first index (lowest value). + */ + enum_monotonicity_info monotonic; + monotonic= part_info->part_expr->get_monotonicity_info(); + if (monotonic != MONOTONIC_INCREASING_NOT_NULL && + monotonic != MONOTONIC_STRICT_INCREASING_NOT_NULL) + { + /* F(col) can not return NULL, return index with lowest value */ + DBUG_RETURN(0); + } } + if (unsigned_flag) part_func_value-= 0x8000000000000000ULL; DBUG_ASSERT(part_info->no_list_values); @@ -2916,11 +2932,29 @@ uint32 get_partition_id_range_for_endpoint(partition_info *part_info, if (part_info->part_expr->null_value) { - uint32 ret_part_id= 0; - if (!left_endpoint && include_endpoint) - ret_part_id= 1; - DBUG_RETURN(ret_part_id); + /* + Special handling for MONOTONIC functions that can return NULL for + values that are comparable. I.e. + '2000-00-00' can be compared to '2000-01-01' but TO_DAYS('2000-00-00') + returns NULL which cannot be compared used <, >, <=, >= etc. + + Otherwise, just return the first partition + (may be included if not left endpoint) + */ + enum_monotonicity_info monotonic; + monotonic= part_info->part_expr->get_monotonicity_info(); + if (monotonic != MONOTONIC_INCREASING_NOT_NULL && + monotonic != MONOTONIC_STRICT_INCREASING_NOT_NULL) + { + /* F(col) can not return NULL, return partition with lowest value */ + if (!left_endpoint && include_endpoint) + DBUG_RETURN(1); + DBUG_RETURN(0); + + } } + + if (unsigned_flag) part_func_value-= 0x8000000000000000ULL; if (left_endpoint && !include_endpoint) @@ -6733,6 +6767,19 @@ int get_part_iter_for_interval_via_mapping(partition_info *part_info, } else assert(0); + + if (part_info->part_type == RANGE_PARTITION || + part_info->has_null_value) + { + enum_monotonicity_info monotonic; + monotonic= part_info->part_expr->get_monotonicity_info(); + if (monotonic == MONOTONIC_INCREASING_NOT_NULL || + monotonic == MONOTONIC_STRICT_INCREASING_NOT_NULL) + { + /* col is NOT NULL, but F(col) can return NULL, add NULL partition */ + part_iter->ret_null_part= part_iter->ret_null_part_orig= TRUE; + } + } /* Find minimum: Do special handling if the interval has left bound in form @@ -6959,7 +7006,13 @@ uint32 get_next_partition_id_range(PARTITION_ITERATOR* part_iter) { if (part_iter->part_nums.cur >= part_iter->part_nums.end) { + if (part_iter->ret_null_part) + { + part_iter->ret_null_part= FALSE; + return 0; /* NULL always in first range partition */ + } part_iter->part_nums.cur= part_iter->part_nums.start; + part_iter->ret_null_part= part_iter->ret_null_part_orig; return NOT_A_PARTITION_ID; } else @@ -6987,7 +7040,7 @@ uint32 get_next_partition_id_range(PARTITION_ITERATOR* part_iter) uint32 get_next_partition_id_list(PARTITION_ITERATOR *part_iter) { - if (part_iter->part_nums.cur == part_iter->part_nums.end) + if (part_iter->part_nums.cur >= part_iter->part_nums.end) { if (part_iter->ret_null_part) { From dbcfef4cf26e42be98ac82b8aca76e32f1ea85bd Mon Sep 17 00:00:00 2001 From: Alfranio Correia Date: Thu, 27 Aug 2009 00:13:03 +0100 Subject: [PATCH 07/68] BUG#28976 Mixing trans and non-trans tables in one transaction results in incorrect binlog Mixing transactional (T) and non-transactional (N) tables on behalf of a transaction may lead to inconsistencies among masters and slaves in STATEMENT mode. The problem stems from the fact that although modifications done to non-transactional tables on behalf of a transaction become immediately visible to other connections they do not immediately get to the binary log and therefore consistency is broken. Although there may be issues in mixing T and M tables in STATEMENT mode, there are safe combinations that clients find useful. In this bug, we fix the following issue. Mixing N and T tables in multi-level (e.g. a statement that fires a trigger) or multi-table table statements (e.g. update t1, t2...) were not handled correctly. In such cases, it was not possible to distinguish when a T table was updated if the sequence of changes was N and T. In a nutshell, just the flag "modified_non_trans_table" was not enough to reflect that both a N and T tables were changed. To circumvent this issue, we check if an engine is registered in the handler's list and changed something which means that a T table was modified. Check WL 2687 for a full-fledged patch that will make the use of either the MIXED or ROW modes completely safe. --- .../extra/rpl_tests/rpl_mixing_engines.test | 727 +++++++++++++++ mysql-test/include/commit.inc | 4 +- mysql-test/r/commit_1innodb.result | 8 +- .../r/binlog_row_mix_innodb_myisam.result | 4 + .../r/binlog_stm_mix_innodb_myisam.result | 6 + .../suite/rpl/r/rpl_innodb_mixed_dml.result | 2 + .../suite/rpl/r/rpl_stm_mixing_engines.result | 871 ++++++++++++++++++ .../suite/rpl/t/rpl_stm_mixing_engines.test | 5 + sql/log.cc | 22 +- 9 files changed, 1642 insertions(+), 7 deletions(-) create mode 100644 mysql-test/extra/rpl_tests/rpl_mixing_engines.test create mode 100644 mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result create mode 100644 mysql-test/suite/rpl/t/rpl_stm_mixing_engines.test diff --git a/mysql-test/extra/rpl_tests/rpl_mixing_engines.test b/mysql-test/extra/rpl_tests/rpl_mixing_engines.test new file mode 100644 index 00000000000..73713b7998b --- /dev/null +++ b/mysql-test/extra/rpl_tests/rpl_mixing_engines.test @@ -0,0 +1,727 @@ +################################################################################### +# This test checks if transactions that mixes transactional and non-transactional +# tables are correctly handled in statement mode. In an nutshell, we have what +# follows: +# +# 1) "B T T C" generates in binlog the "B T T C" entries. +# +# 2) "B T T R" generates in binlog an "empty" entry. +# +# 3) "B T N C" generates in binlog the "B T N C" entries. +# +# 4) "B T N R" generates in binlog the "B T N R" entries. +# +# 5) "T" generates in binlog the "B T C" entry. +# +# 6) "N" generates in binlog the "N" entry. +# +# 7) "M" generates in binglog the "B M C" entries. +# +# 8) "B N N T C" generates in binglog the "N N B T C" entries. +# +# 9) "B N N T R" generates in binlog the "N N B T R" entries. +# +# 10) "B N N C" generates in binglog the "N N" entries. +# +# 11) "B N N R" generates in binlog the "N N" entries. +# +# 12) "B M T C" generates in the binlog the "B M T C" entries. +# +# 13) "B M T R" generates in the binlog the "B M T R" entries. +################################################################################### + +--echo ################################################################################### +--echo # CONFIGURATION +--echo ################################################################################### +connection master; + +SET SQL_LOG_BIN=0; +CREATE TABLE nt_1 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM; +CREATE TABLE nt_2 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM; +CREATE TABLE nt_3 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM; +CREATE TABLE nt_4 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM; +CREATE TABLE tt_1 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb; +CREATE TABLE tt_2 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb; +CREATE TABLE tt_3 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb; +CREATE TABLE tt_4 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb; +SET SQL_LOG_BIN=1; + +connection slave; + +SET SQL_LOG_BIN=0; +CREATE TABLE nt_1 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM; +CREATE TABLE nt_2 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM; +CREATE TABLE nt_3 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM; +CREATE TABLE nt_4 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM; +CREATE TABLE tt_1 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb; +CREATE TABLE tt_2 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb; +CREATE TABLE tt_3 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb; +CREATE TABLE tt_4 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb; +SET SQL_LOG_BIN=1; + +connection master; + +DELIMITER |; + +CREATE FUNCTION f1 () RETURNS VARCHAR(64) +BEGIN + RETURN "Testing..."; +END| + +CREATE FUNCTION f2 () RETURNS VARCHAR(64) +BEGIN + RETURN f1(); +END| + +CREATE PROCEDURE pc_i_tt_3 (IN x INT, IN y VARCHAR(64)) +BEGIN + INSERT INTO tt_3 VALUES (y,x,x); +END| + +CREATE TRIGGER tr_i_tt_3_to_nt_3 BEFORE INSERT ON tt_3 FOR EACH ROW +BEGIN + INSERT INTO nt_3 VALUES (NEW.a, NEW.b, NEW.c); +END| + +CREATE TRIGGER tr_i_nt_4_to_tt_4 BEFORE INSERT ON nt_4 FOR EACH ROW +BEGIN + INSERT INTO tt_4 VALUES (NEW.a, NEW.b, NEW.c); +END| + +DELIMITER ;| + +--echo ################################################################################### +--echo # MIXING TRANSACTIONAL and NON-TRANSACTIONAL TABLES +--echo ################################################################################### +connection master; + +let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1); +--echo # +--echo #1) "B T T C" generates in binlog the "B T T C" entries. +--echo # +BEGIN; +INSERT INTO tt_1 VALUES ("new text 4", 4, "new text 4"); +INSERT INTO tt_2 VALUES ("new text 4", 4, "new text 4"); +COMMIT; + +--source include/show_binlog_events.inc + +--echo +--echo +--echo +--echo +let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1); +--echo # +--echo #1.e) "B T T C" with error in T generates in binlog the "B T T C" entries. +--echo # +INSERT INTO tt_1 VALUES ("new text -2", -2, "new text -2"); +BEGIN; +--error ER_DUP_ENTRY +INSERT INTO tt_1 VALUES ("new text -1", -1, "new text -1"), ("new text -2", -2, "new text -2"); +INSERT INTO tt_2 VALUES ("new text -3", -3, "new text -3"); +COMMIT; + +BEGIN; +INSERT INTO tt_2 VALUES ("new text -5", -5, "new text -5"); +--error ER_DUP_ENTRY +INSERT INTO tt_2 VALUES ("new text -4", -4, "new text -4"), ("new text -5", -5, "new text -5"); +COMMIT; + +--source include/show_binlog_events.inc + +--echo +--echo +--echo +--echo +let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1); +--echo # +--echo #2) "B T T R" generates in binlog an "empty" entry. +--echo # +BEGIN; +INSERT INTO tt_1 VALUES ("new text 5", 5, "new text 5"); +INSERT INTO tt_2 VALUES ("new text 5", 5, "new text 5"); +ROLLBACK; + +--source include/show_binlog_events.inc + +--echo +--echo +--echo +--echo +let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1); +--echo # +--echo #2.e) "B T T R" with error in T generates in binlog an "empty" entry. +--echo # +INSERT INTO tt_1 VALUES ("new text -7", -7, "new text -7"); +BEGIN; +--error ER_DUP_ENTRY +INSERT INTO tt_1 VALUES ("new text -6", -6, "new text -6"), ("new text -7", -7, "new text -7"); +INSERT INTO tt_2 VALUES ("new text -8", -8, "new text -8"); +ROLLBACK; + +BEGIN; +INSERT INTO tt_2 VALUES ("new text -10", -10, "new text -10"); +--error ER_DUP_ENTRY +INSERT INTO tt_2 VALUES ("new text -9", -9, "new text -9"), ("new text -10", -10, "new text -10"); +ROLLBACK; + +--source include/show_binlog_events.inc + +--echo +--echo +--echo +--echo +let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1); +--echo # +--echo #3) "B T N C" generates in binlog the "B T N C" entries. +--echo # +BEGIN; +INSERT INTO tt_1 VALUES ("new text 6", 6, "new text 6"); +INSERT INTO nt_1 VALUES ("new text 6", 6, "new text 6"); +COMMIT; + +--source include/show_binlog_events.inc + +--echo +--echo +--echo +--echo +let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1); +--echo # +--echo #3.e) "B T N C" with error in either T or N generates in binlog the "B T N C" entries. +--echo # +INSERT INTO tt_1 VALUES ("new text -12", -12, "new text -12"); +BEGIN; +--error ER_DUP_ENTRY +INSERT INTO tt_1 VALUES ("new text -11", -11, "new text -11"), ("new text -12", -12, "new text -12"); +INSERT INTO nt_1 VALUES ("new text -13", -13, "new text -13"); +COMMIT; + +BEGIN; +INSERT INTO tt_1 VALUES ("new text -14", -14, "new text -14"); +INSERT INTO nt_1 VALUES ("new text -16", -16, "new text -16"); +--error ER_DUP_ENTRY +INSERT INTO nt_1 VALUES ("new text -15", -15, "new text -15"), ("new text -16", -16, "new text -16"); +COMMIT; + +--source include/show_binlog_events.inc + +--echo +--echo +--echo +--echo +let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1); +--echo # +--echo #4) "B T N R" generates in binlog the "B T N R" entries. +--echo # +BEGIN; +INSERT INTO tt_1 VALUES ("new text 7", 7, "new text 7"); +INSERT INTO nt_1 VALUES ("new text 7", 7, "new text 7"); +ROLLBACK; + +--source include/show_binlog_events.inc + +--echo +--echo +--echo +--echo +let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1); +--echo # +--echo #4.e) "B T N R" with error in either T or N generates in binlog the "B T N R" entries. +--echo # +INSERT INTO tt_1 VALUES ("new text -17", -17, "new text -17"); +BEGIN; +--error ER_DUP_ENTRY +INSERT INTO tt_1 VALUES ("new text -16", -16, "new text -16"), ("new text -17", -17, "new text -17"); +INSERT INTO nt_1 VALUES ("new text -18", -18, "new text -18"); +ROLLBACK; + +BEGIN; +INSERT INTO tt_1 VALUES ("new text -19", -19, "new text -19"); +INSERT INTO nt_1 VALUES ("new text -21", -21, "new text -21"); +--error ER_DUP_ENTRY +INSERT INTO nt_1 VALUES ("new text -20", -20, "new text -20"), ("new text -21", -21, "new text -21"); +ROLLBACK; + +--source include/show_binlog_events.inc + +--echo +--echo +--echo +--echo +let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1); +--echo # +--echo #5) "T" generates in binlog the "B T C" entry. +--echo # +INSERT INTO tt_1 VALUES ("new text 8", 8, "new text 8"); + +--source include/show_binlog_events.inc + +--echo +--echo +--echo +--echo +let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1); +--echo # +--echo #5.e) "T" with error in T generates in binlog an "empty" entry. +--echo # +INSERT INTO tt_1 VALUES ("new text -1", -1, "new text -1"); +--error ER_DUP_ENTRY +INSERT INTO tt_1 VALUES ("new text -1", -1, "new text -1"), ("new text -22", -22, "new text -22"); +--error ER_DUP_ENTRY +INSERT INTO tt_1 VALUES ("new text -23", -23, "new text -23"), ("new text -1", -1, "new text -1"); + +--source include/show_binlog_events.inc + +--echo +--echo +--echo +--echo +let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1); +--echo # +--echo #6) "N" generates in binlog the "N" entry. +--echo # +INSERT INTO nt_1 VALUES ("new text 9", 9, "new text 9"); + +--source include/show_binlog_events.inc + +--echo +--echo +--echo +--echo +let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1); +--echo # +--echo #6.e) "N" with error in N generates in binlog an empty entry if the error +--echo # happens in the first tuple. Otherwise, generates the "N" entry and +--echo # the error is appended. +--echo # +INSERT INTO nt_1 VALUES ("new text -1", -1, "new text -1"); +--error ER_DUP_ENTRY +INSERT INTO nt_1 VALUES ("new text -1", -1, "new text -1"); +--error ER_DUP_ENTRY +INSERT INTO nt_1 VALUES ("new text -24", -24, "new text -24"), ("new text -1", -1, "new text -1"); + +--source include/show_binlog_events.inc + +--echo +--echo +--echo +--echo +let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1); +--echo # +--echo #7) "M" generates in binglog the "B M C" entries. +--echo # + +DELETE FROM nt_1; + +INSERT INTO nt_1 SELECT * FROM tt_1; + +DELETE FROM tt_1; + +INSERT INTO tt_1 SELECT * FROM nt_1; + +INSERT INTO tt_3 VALUES ("new text 000", 000, ''); + +INSERT INTO tt_3 VALUES("new text 100", 100, f1()); + +INSERT INTO nt_4 VALUES("new text 100", 100, f1()); + +INSERT INTO tt_3 VALUES("new text 200", 200, f2()); + +INSERT INTO nt_4 VALUES ("new text 300", 300, ''); + +INSERT INTO nt_4 VALUES ("new text 400", 400, f1()); + +INSERT INTO nt_4 VALUES ("new text 500", 500, f2()); + +CALL pc_i_tt_3(600, "Testing..."); + +UPDATE nt_3, nt_4, tt_3, tt_4 SET nt_3.a= "new text 1", nt_4.a= "new text 1", tt_3.a= "new text 1", tt_4.a= "new text 1" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100; + +UPDATE tt_3, tt_4, nt_3, nt_4 SET tt_3.a= "new text 2", tt_4.a= "new text 2", nt_3.a= "new text 2", nt_4.a = "new text 2" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100; + +UPDATE tt_3, nt_3, nt_4, tt_4 SET tt_3.a= "new text 3", nt_3.a= "new text 3", nt_4.a= "new text 3", tt_4.a = "new text 3" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100; + +UPDATE tt_3, nt_3, nt_4, tt_4 SET tt_3.a= "new text 4", nt_3.a= "new text 4", nt_4.a= "new text 4", tt_4.a = "new text 4" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100; + +--source include/show_binlog_events.inc + +--echo +--echo +--echo +--echo +let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1); +--echo # +--echo #7.e) "M" with error in M generates in binglog the "B M R" entries. +--echo # + +INSERT INTO nt_3 VALUES ("new text -26", -26, ''); +SELECT * FROM tt_3; +--error ER_DUP_ENTRY +INSERT INTO tt_3 VALUES ("new text -25", -25, ''), ("new text -26", -26, ''); +SELECT * FROM tt_3; + +INSERT INTO tt_4 VALUES ("new text -26", -26, ''); +SELECT * FROM nt_4; +--error ER_DUP_ENTRY +INSERT INTO nt_4 VALUES ("new text -25", -25, ''), ("new text -26", -26, ''); +SELECT * FROM nt_4; + +--source include/show_binlog_events.inc + +--echo +--echo +--echo +--echo +let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1); +--echo # +--echo #8) "B N N T C" generates in binglog the "N N B T C" entries. +--echo # +BEGIN; +INSERT INTO nt_1 VALUES ("new text 10", 10, "new text 10"); +INSERT INTO nt_2 VALUES ("new text 10", 10, "new text 10"); +INSERT INTO tt_1 VALUES ("new text 10", 10, "new text 10"); +COMMIT; + +--source include/show_binlog_events.inc + +--echo +--echo +--echo +--echo +--echo # +--echo #8.e) "B N N T R" See 6.e and 9.e. +--echo # + +--echo +--echo +--echo +--echo +let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1); +--echo # +--echo #9) "B N N T R" generates in binlog the "N N B T R" entries. +--echo # +BEGIN; +INSERT INTO nt_1 VALUES ("new text 11", 11, "new text 11"); +INSERT INTO nt_2 VALUES ("new text 11", 11, "new text 11"); +INSERT INTO tt_1 VALUES ("new text 11", 11, "new text 11"); +ROLLBACK; + +--source include/show_binlog_events.inc + +--echo +--echo +--echo +--echo +let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1); +--echo # +--echo #9.e) "B N N T R" with error in N generates in binlog the "N N B T R" entries. +--echo # +BEGIN; +INSERT INTO nt_1 VALUES ("new text -25", -25, "new text -25"); +INSERT INTO nt_2 VALUES ("new text -25", -25, "new text -25"); +--error ER_DUP_ENTRY +INSERT INTO nt_2 VALUES ("new text -26", -26, "new text -26"), ("new text -25", -25, "new text -25"); +INSERT INTO tt_1 VALUES ("new text -27", -27, "new text -27"); +ROLLBACK; + +--source include/show_binlog_events.inc + +--echo +--echo +--echo +--echo +let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1); +--echo # +--echo #10) "B N N C" generates in binglog the "N N" entries. +--echo # +BEGIN; +INSERT INTO nt_1 VALUES ("new text 12", 12, "new text 12"); +INSERT INTO nt_2 VALUES ("new text 12", 12, "new text 12"); +COMMIT; + +--source include/show_binlog_events.inc + +--echo +--echo +--echo +--echo +--echo # +--echo #10.e) "B N N C" See 6.e and 9.e. +--echo # + +--echo +--echo +--echo +--echo +let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1); +--echo # +--echo #11) "B N N R" generates in binlog the "N N" entries. +--echo # +BEGIN; +INSERT INTO nt_1 VALUES ("new text 13", 13, "new text 13"); +INSERT INTO nt_2 VALUES ("new text 13", 13, "new text 13"); +ROLLBACK; + +--source include/show_binlog_events.inc + +--echo +--echo +--echo +--echo +--echo # +--echo #11.e) "B N N R" See 6.e and 9.e. +--echo # + +--echo +--echo +--echo +--echo +let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1); +--echo # +--echo #12) "B M T C" generates in the binlog the "B M T C" entries. +--echo # +DELETE FROM nt_1; +BEGIN; +INSERT INTO nt_1 SELECT * FROM tt_1; +INSERT INTO tt_2 VALUES ("new text 14", 14, "new text 14"); +COMMIT; + +DELETE FROM tt_1; +BEGIN; +INSERT INTO tt_1 SELECT * FROM nt_1; +INSERT INTO tt_2 VALUES ("new text 15", 15, "new text 15"); +COMMIT; + +BEGIN; +INSERT INTO tt_3 VALUES ("new text 700", 700, ''); +INSERT INTO tt_1 VALUES ("new text 800", 800, ''); +COMMIT; + +BEGIN; +INSERT INTO tt_3 VALUES("new text 900", 900, f1()); +INSERT INTO tt_1 VALUES ("new text 1000", 1000, ''); +COMMIT; + +BEGIN; +INSERT INTO tt_3 VALUES(1100, 1100, f2()); +INSERT INTO tt_1 VALUES ("new text 1200", 1200, ''); +COMMIT; + +BEGIN; +INSERT INTO nt_4 VALUES ("new text 1300", 1300, ''); +INSERT INTO tt_1 VALUES ("new text 1400", 1400, ''); +COMMIT; + +BEGIN; +INSERT INTO nt_4 VALUES("new text 1500", 1500, f1()); +INSERT INTO tt_1 VALUES ("new text 1600", 1600, ''); +COMMIT; + +BEGIN; +INSERT INTO nt_4 VALUES("new text 1700", 1700, f2()); +INSERT INTO tt_1 VALUES ("new text 1800", 1800, ''); +COMMIT; + +BEGIN; +CALL pc_i_tt_3(1900, "Testing..."); +INSERT INTO tt_1 VALUES ("new text 2000", 2000, ''); +COMMIT; + +BEGIN; +UPDATE nt_3, nt_4, tt_3, tt_4 SET nt_3.a= "new text 5", nt_4.a= "new text 5", tt_3.a= "new text 5", tt_4.a= "new text 5" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100; +INSERT INTO tt_1 VALUES ("new text 2100", 2100, ''); +COMMIT; + +BEGIN; +UPDATE tt_3, tt_4, nt_3, nt_4 SET tt_3.a= "new text 6", tt_4.a= "new text 6", nt_3.a= "new text 6", nt_4.a = "new text 6" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100; +INSERT INTO tt_1 VALUES ("new text 2200", 2200, ''); +COMMIT; + +BEGIN; +UPDATE tt_3, nt_3, nt_4, tt_4 SET tt_3.a= "new text 7", nt_3.a= "new text 7", nt_4.a= "new text 7", tt_4.a = "new text 7" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100; +INSERT INTO tt_1 VALUES ("new text 2300", 2300, ''); +COMMIT; + +BEGIN; +UPDATE tt_3, nt_3, nt_4, tt_4 SET tt_3.a= "new text 8", nt_3.a= "new text 8", nt_4.a= "new text 8", tt_4.a = "new text 8" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100; +INSERT INTO tt_1 VALUES ("new text 2400", 2400, ''); +COMMIT; + +--source include/show_binlog_events.inc + +--echo +--echo +--echo +--echo +let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1); +--echo # +--echo #12.e) "B M T C" with error in M generates in the binlog the "B M T C" entries. +--echo # + +--echo # There is a bug in the slave that needs to be fixed before enabling +--echo # this part of the test. A bug report will be filed referencing this +--echo # test case. +# +#BEGIN; +#INSERT INTO nt_3 VALUES ("new text -28", -28, ''); +#--error ER_DUP_ENTRY +#INSERT INTO tt_3 VALUES ("new text -27", -27, ''), ("new text -28", -28, ''); +#INSERT INTO tt_1 VALUES ("new text -27", -27, ''); +#COMMIT; +# +#BEGIN; +#INSERT INTO tt_4 VALUES ("new text -28", -28, ''); +#--error ER_DUP_ENTRY +#INSERT INTO nt_4 VALUES ("new text -27", -27, ''), ("new text -28", -28, ''); +#INSERT INTO tt_1 VALUES ("new text -28", -28, ''); +#COMMIT; +# +--source include/show_binlog_events.inc + +--echo +--echo +--echo +--echo +let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1); +--echo # +--echo #13) "B M T R" generates in the binlog the "B M T R" entries +--echo # + +DELETE FROM nt_1; +BEGIN; +INSERT INTO nt_1 SELECT * FROM tt_1; +INSERT INTO tt_2 VALUES ("new text 17", 17, "new text 17"); +ROLLBACK; + +DELETE FROM tt_1; +BEGIN; +INSERT INTO tt_1 SELECT * FROM nt_1; +INSERT INTO tt_2 VALUES ("new text 18", 18, "new text 18"); +ROLLBACK; +INSERT INTO tt_1 SELECT * FROM nt_1; + +BEGIN; +INSERT INTO tt_3 VALUES ("new text 2500", 2500, ''); +INSERT INTO tt_1 VALUES ("new text 2600", 2600, ''); +ROLLBACK; + +BEGIN; +INSERT INTO tt_3 VALUES("new text 2700", 2700, f1()); +INSERT INTO tt_1 VALUES ("new text 2800", 2800, ''); +ROLLBACK; + +BEGIN; +INSERT INTO tt_3 VALUES(2900, 2900, f2()); +INSERT INTO tt_1 VALUES ("new text 3000", 3000, ''); +ROLLBACK; + +BEGIN; +INSERT INTO nt_4 VALUES ("new text 3100", 3100, ''); +INSERT INTO tt_1 VALUES ("new text 3200", 3200, ''); +ROLLBACK; + +BEGIN; +INSERT INTO nt_4 VALUES("new text 3300", 3300, f1()); +INSERT INTO tt_1 VALUES ("new text 3400", 3400, ''); +ROLLBACK; + +BEGIN; +INSERT INTO nt_4 VALUES("new text 3500", 3500, f2()); +INSERT INTO tt_1 VALUES ("new text 3600", 3600, ''); +ROLLBACK; + +BEGIN; +CALL pc_i_tt_3(3700, "Testing..."); +INSERT INTO tt_1 VALUES ("new text 3700", 3700, ''); +ROLLBACK; + +BEGIN; +UPDATE nt_3, nt_4, tt_3, tt_4 SET nt_3.a= "new text 9", nt_4.a= "new text 9", tt_3.a= "new text 9", tt_4.a= "new text 9" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100; +INSERT INTO tt_1 VALUES ("new text 3800", 3800, ''); +ROLLBACK; + +BEGIN; +UPDATE tt_3, tt_4, nt_3, nt_4 SET tt_3.a= "new text 10", tt_4.a= "new text 10", nt_3.a= "new text 10", nt_4.a = "new text 10" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100; +INSERT INTO tt_1 VALUES ("new text 3900", 3900, ''); +ROLLBACK; + +BEGIN; +UPDATE tt_3, nt_3, nt_4, tt_4 SET tt_3.a= "new text 11", nt_3.a= "new text 11", nt_4.a= "new text 11", tt_4.a = "new text 11" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100; +INSERT INTO tt_1 VALUES ("new text 4000", 4000, ''); +ROLLBACK; + +BEGIN; +UPDATE tt_3, nt_3, nt_4, tt_4 SET tt_3.a= "new text 12", nt_3.a= "new text 12", nt_4.a= "new text 12", tt_4.a = "new text 12" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100; +INSERT INTO tt_1 VALUES ("new text 4100", 4100, ''); +ROLLBACK; + +--source include/show_binlog_events.inc + +--echo +--echo +--echo +--echo +let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1); +--echo # +--echo #13.e) "B M T R" with error in M generates in the binlog the "B M T R" entries. +--echo # + +BEGIN; +INSERT INTO nt_3 VALUES ("new text -30", -30, ''); +--error ER_DUP_ENTRY +INSERT INTO tt_3 VALUES ("new text -29", -29, ''), ("new text -30", -30, ''); +INSERT INTO tt_1 VALUES ("new text -30", -30, ''); +ROLLBACK; + +BEGIN; +INSERT INTO tt_4 VALUES ("new text -30", -30, ''); +--error ER_DUP_ENTRY +INSERT INTO nt_4 VALUES ("new text -29", -29, ''), ("new text -30", -30, ''); +INSERT INTO tt_1 VALUES ("new text -31", -31, ''); +ROLLBACK; + +--source include/show_binlog_events.inc + +--echo +--echo +--echo +--echo +let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1); +--echo # +--echo #14) "B M T R" with error in M generates in the binlog the "B M T R" entries. +--echo # + +BEGIN; +INSERT INTO tt_4 VALUES ("new text -32", -32, ''); +TRUNCATE TABLE tt_4; +INSERT INTO tt_4 VALUES ("new text -33", -33, ''); +ROLLBACK; + +--source include/show_binlog_events.inc + +connection master; +sync_slave_with_master; + +--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/test-master.sql +--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/test-slave.sql +--diff_files $MYSQLTEST_VARDIR/tmp/test-master.sql $MYSQLTEST_VARDIR/tmp/test-slave.sql + +--echo ################################################################################### +--echo # CLEAN +--echo ################################################################################### + +connection master; +DROP TABLE tt_1; +DROP TABLE tt_2; +DROP TABLE tt_3; +DROP TABLE tt_4; +DROP TABLE nt_1; +DROP TABLE nt_2; +DROP TABLE nt_3; +DROP TABLE nt_4; +DROP PROCEDURE pc_i_tt_3; +DROP FUNCTION f1; +DROP FUNCTION f2; + +sync_slave_with_master; diff --git a/mysql-test/include/commit.inc b/mysql-test/include/commit.inc index d412eae8364..d91ba8291fd 100644 --- a/mysql-test/include/commit.inc +++ b/mysql-test/include/commit.inc @@ -725,9 +725,9 @@ call p_verify_status_increment(4, 4, 4, 4); alter table t3 add column (b int); call p_verify_status_increment(2, 0, 2, 0); alter table t3 rename t4; -call p_verify_status_increment(1, 0, 1, 0); +call p_verify_status_increment(2, 2, 2, 2); rename table t4 to t3; -call p_verify_status_increment(1, 0, 1, 0); +call p_verify_status_increment(2, 2, 2, 2); truncate table t3; call p_verify_status_increment(4, 4, 4, 4); create view v1 as select * from t2; diff --git a/mysql-test/r/commit_1innodb.result b/mysql-test/r/commit_1innodb.result index cabd4c29c1d..51c4ac3002c 100644 --- a/mysql-test/r/commit_1innodb.result +++ b/mysql-test/r/commit_1innodb.result @@ -841,17 +841,17 @@ call p_verify_status_increment(2, 0, 2, 0); SUCCESS alter table t3 rename t4; -call p_verify_status_increment(1, 0, 1, 0); +call p_verify_status_increment(2, 2, 2, 2); SUCCESS rename table t4 to t3; -call p_verify_status_increment(1, 0, 1, 0); +call p_verify_status_increment(2, 2, 2, 2); SUCCESS truncate table t3; call p_verify_status_increment(4, 4, 4, 4); -ERROR -Expected commit increment: 4 actual: 2 +SUCCESS + create view v1 as select * from t2; call p_verify_status_increment(1, 0, 1, 0); SUCCESS diff --git a/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result b/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result index 4d639c3da68..9ae5121f618 100644 --- a/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result +++ b/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result @@ -379,7 +379,9 @@ master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; TRUNCATE table t2 +master-bin.000001 # Xid # # COMMIT /* XID */ master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F @@ -838,8 +840,10 @@ UPDATE t4,t3 SET t4.a=t3.a + bug27417(1) /* top level non-ta table */; ERROR 23000: Duplicate entry '2' for key 'PRIMARY' show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN master-bin.000001 # Intvar # # INSERT_ID=6 master-bin.000001 # Query # # use `test`; UPDATE t4,t3 SET t4.a=t3.a + bug27417(1) /* top level non-ta table */ +master-bin.000001 # Query # # ROLLBACK select count(*) from t1 /* must be 4 */; count(*) 4 diff --git a/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result b/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result index 95773a247b9..1ded5c8b622 100644 --- a/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result +++ b/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result @@ -346,7 +346,9 @@ master-bin.000001 # Query # # use `test`; INSERT INTO t1 values (3,3) master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS t2 master-bin.000001 # Query # # use `test`; CREATE TABLE t2 (a int, b int, primary key (a)) engine=innodb master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (4,4) +master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; TRUNCATE table t2 +master-bin.000001 # Xid # # COMMIT /* XID */ master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (5,5) master-bin.000001 # Query # # use `test`; DROP TABLE t2 master-bin.000001 # Query # # use `test`; INSERT INTO t1 values (6,6) @@ -545,8 +547,10 @@ UPDATE t4,t3 SET t4.a=t3.a + bug27417(1) /* top level non-ta table */; ERROR 23000: Duplicate entry '2' for key 'PRIMARY' show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN master-bin.000001 # Intvar # # INSERT_ID=6 master-bin.000001 # Query # # use `test`; UPDATE t4,t3 SET t4.a=t3.a + bug27417(1) /* top level non-ta table */ +master-bin.000001 # Query # # ROLLBACK /* the output must denote there is the query */; select count(*) from t1 /* must be 4 */; count(*) @@ -782,8 +786,10 @@ UPDATE t4,t3 SET t4.a=t3.a + bug27417(1) /* top level non-ta table */; ERROR 23000: Duplicate entry '2' for key 'PRIMARY' show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN master-bin.000001 # Intvar # # INSERT_ID=6 master-bin.000001 # Query # # use `test`; UPDATE t4,t3 SET t4.a=t3.a + bug27417(1) /* top level non-ta table */ +master-bin.000001 # Query # # ROLLBACK select count(*) from t1 /* must be 4 */; count(*) 4 diff --git a/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result b/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result index 033f71c16b7..6c5ab43da5f 100644 --- a/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result +++ b/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result @@ -963,7 +963,9 @@ master-bin.000001 # Xid 1 # # master-bin.000001 # Query 1 # BEGIN master-bin.000001 # Query 1 # use `test_rpl`; INSERT INTO t1 VALUES(1, 't1, text 1') master-bin.000001 # Xid 1 # # +master-bin.000001 # Query 1 # BEGIN master-bin.000001 # Query 1 # use `test_rpl`; TRUNCATE t1 +master-bin.000001 # Xid 1 # # master-bin.000001 # Query 1 # BEGIN master-bin.000001 # Query 1 # use `test_rpl`; DELETE FROM t1 master-bin.000001 # Xid 1 # # diff --git a/mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result b/mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result new file mode 100644 index 00000000000..f8510b3a85e --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result @@ -0,0 +1,871 @@ +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; +################################################################################### +# CONFIGURATION +################################################################################### +SET SQL_LOG_BIN=0; +CREATE TABLE nt_1 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM; +CREATE TABLE nt_2 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM; +CREATE TABLE nt_3 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM; +CREATE TABLE nt_4 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM; +CREATE TABLE tt_1 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb; +CREATE TABLE tt_2 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb; +CREATE TABLE tt_3 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb; +CREATE TABLE tt_4 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=0; +CREATE TABLE nt_1 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM; +CREATE TABLE nt_2 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM; +CREATE TABLE nt_3 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM; +CREATE TABLE nt_4 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM; +CREATE TABLE tt_1 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb; +CREATE TABLE tt_2 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb; +CREATE TABLE tt_3 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb; +CREATE TABLE tt_4 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb; +SET SQL_LOG_BIN=1; +CREATE FUNCTION f1 () RETURNS VARCHAR(64) +BEGIN +RETURN "Testing..."; +END| +CREATE FUNCTION f2 () RETURNS VARCHAR(64) +BEGIN +RETURN f1(); +END| +CREATE PROCEDURE pc_i_tt_3 (IN x INT, IN y VARCHAR(64)) +BEGIN +INSERT INTO tt_3 VALUES (y,x,x); +END| +CREATE TRIGGER tr_i_tt_3_to_nt_3 BEFORE INSERT ON tt_3 FOR EACH ROW +BEGIN +INSERT INTO nt_3 VALUES (NEW.a, NEW.b, NEW.c); +END| +CREATE TRIGGER tr_i_nt_4_to_tt_4 BEFORE INSERT ON nt_4 FOR EACH ROW +BEGIN +INSERT INTO tt_4 VALUES (NEW.a, NEW.b, NEW.c); +END| +################################################################################### +# MIXING TRANSACTIONAL and NON-TRANSACTIONAL TABLES +################################################################################### +# +#1) "B T T C" generates in binlog the "B T T C" entries. +# +BEGIN; +INSERT INTO tt_1 VALUES ("new text 4", 4, "new text 4"); +INSERT INTO tt_2 VALUES ("new text 4", 4, "new text 4"); +COMMIT; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text 4", 4, "new text 4") +master-bin.000001 # Query # # use `test`; INSERT INTO tt_2 VALUES ("new text 4", 4, "new text 4") +master-bin.000001 # Xid # # COMMIT /* XID */ + + + + +# +#1.e) "B T T C" with error in T generates in binlog the "B T T C" entries. +# +INSERT INTO tt_1 VALUES ("new text -2", -2, "new text -2"); +BEGIN; +INSERT INTO tt_1 VALUES ("new text -1", -1, "new text -1"), ("new text -2", -2, "new text -2"); +ERROR 23000: Duplicate entry '-2' for key 'PRIMARY' +INSERT INTO tt_2 VALUES ("new text -3", -3, "new text -3"); +COMMIT; +BEGIN; +INSERT INTO tt_2 VALUES ("new text -5", -5, "new text -5"); +INSERT INTO tt_2 VALUES ("new text -4", -4, "new text -4"), ("new text -5", -5, "new text -5"); +ERROR 23000: Duplicate entry '-5' for key 'PRIMARY' +COMMIT; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text -2", -2, "new text -2") +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_2 VALUES ("new text -3", -3, "new text -3") +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_2 VALUES ("new text -5", -5, "new text -5") +master-bin.000001 # Xid # # COMMIT /* XID */ + + + + +# +#2) "B T T R" generates in binlog an "empty" entry. +# +BEGIN; +INSERT INTO tt_1 VALUES ("new text 5", 5, "new text 5"); +INSERT INTO tt_2 VALUES ("new text 5", 5, "new text 5"); +ROLLBACK; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info + + + + +# +#2.e) "B T T R" with error in T generates in binlog an "empty" entry. +# +INSERT INTO tt_1 VALUES ("new text -7", -7, "new text -7"); +BEGIN; +INSERT INTO tt_1 VALUES ("new text -6", -6, "new text -6"), ("new text -7", -7, "new text -7"); +ERROR 23000: Duplicate entry '-7' for key 'PRIMARY' +INSERT INTO tt_2 VALUES ("new text -8", -8, "new text -8"); +ROLLBACK; +BEGIN; +INSERT INTO tt_2 VALUES ("new text -10", -10, "new text -10"); +INSERT INTO tt_2 VALUES ("new text -9", -9, "new text -9"), ("new text -10", -10, "new text -10"); +ERROR 23000: Duplicate entry '-10' for key 'PRIMARY' +ROLLBACK; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text -7", -7, "new text -7") +master-bin.000001 # Xid # # COMMIT /* XID */ + + + + +# +#3) "B T N C" generates in binlog the "B T N C" entries. +# +BEGIN; +INSERT INTO tt_1 VALUES ("new text 6", 6, "new text 6"); +INSERT INTO nt_1 VALUES ("new text 6", 6, "new text 6"); +COMMIT; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text 6", 6, "new text 6") +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1 VALUES ("new text 6", 6, "new text 6") +master-bin.000001 # Xid # # COMMIT /* XID */ + + + + +# +#3.e) "B T N C" with error in either T or N generates in binlog the "B T N C" entries. +# +INSERT INTO tt_1 VALUES ("new text -12", -12, "new text -12"); +BEGIN; +INSERT INTO tt_1 VALUES ("new text -11", -11, "new text -11"), ("new text -12", -12, "new text -12"); +ERROR 23000: Duplicate entry '-12' for key 'PRIMARY' +INSERT INTO nt_1 VALUES ("new text -13", -13, "new text -13"); +COMMIT; +BEGIN; +INSERT INTO tt_1 VALUES ("new text -14", -14, "new text -14"); +INSERT INTO nt_1 VALUES ("new text -16", -16, "new text -16"); +INSERT INTO nt_1 VALUES ("new text -15", -15, "new text -15"), ("new text -16", -16, "new text -16"); +ERROR 23000: Duplicate entry '-16' for key 'PRIMARY' +COMMIT; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text -12", -12, "new text -12") +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1 VALUES ("new text -13", -13, "new text -13") +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text -14", -14, "new text -14") +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1 VALUES ("new text -16", -16, "new text -16") +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1 VALUES ("new text -15", -15, "new text -15"), ("new text -16", -16, "new text -16") +master-bin.000001 # Xid # # COMMIT /* XID */ + + + + +# +#4) "B T N R" generates in binlog the "B T N R" entries. +# +BEGIN; +INSERT INTO tt_1 VALUES ("new text 7", 7, "new text 7"); +INSERT INTO nt_1 VALUES ("new text 7", 7, "new text 7"); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text 7", 7, "new text 7") +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1 VALUES ("new text 7", 7, "new text 7") +master-bin.000001 # Query # # ROLLBACK + + + + +# +#4.e) "B T N R" with error in either T or N generates in binlog the "B T N R" entries. +# +INSERT INTO tt_1 VALUES ("new text -17", -17, "new text -17"); +BEGIN; +INSERT INTO tt_1 VALUES ("new text -16", -16, "new text -16"), ("new text -17", -17, "new text -17"); +ERROR 23000: Duplicate entry '-17' for key 'PRIMARY' +INSERT INTO nt_1 VALUES ("new text -18", -18, "new text -18"); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +BEGIN; +INSERT INTO tt_1 VALUES ("new text -19", -19, "new text -19"); +INSERT INTO nt_1 VALUES ("new text -21", -21, "new text -21"); +INSERT INTO nt_1 VALUES ("new text -20", -20, "new text -20"), ("new text -21", -21, "new text -21"); +ERROR 23000: Duplicate entry '-21' for key 'PRIMARY' +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text -17", -17, "new text -17") +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1 VALUES ("new text -18", -18, "new text -18") +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text -19", -19, "new text -19") +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1 VALUES ("new text -21", -21, "new text -21") +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1 VALUES ("new text -20", -20, "new text -20"), ("new text -21", -21, "new text -21") +master-bin.000001 # Query # # ROLLBACK + + + + +# +#5) "T" generates in binlog the "B T C" entry. +# +INSERT INTO tt_1 VALUES ("new text 8", 8, "new text 8"); +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text 8", 8, "new text 8") +master-bin.000001 # Xid # # COMMIT /* XID */ + + + + +# +#5.e) "T" with error in T generates in binlog an "empty" entry. +# +INSERT INTO tt_1 VALUES ("new text -1", -1, "new text -1"); +INSERT INTO tt_1 VALUES ("new text -1", -1, "new text -1"), ("new text -22", -22, "new text -22"); +ERROR 23000: Duplicate entry '-1' for key 'PRIMARY' +INSERT INTO tt_1 VALUES ("new text -23", -23, "new text -23"), ("new text -1", -1, "new text -1"); +ERROR 23000: Duplicate entry '-1' for key 'PRIMARY' +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text -1", -1, "new text -1") +master-bin.000001 # Xid # # COMMIT /* XID */ + + + + +# +#6) "N" generates in binlog the "N" entry. +# +INSERT INTO nt_1 VALUES ("new text 9", 9, "new text 9"); +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1 VALUES ("new text 9", 9, "new text 9") + + + + +# +#6.e) "N" with error in N generates in binlog an empty entry if the error +# happens in the first tuple. Otherwise, generates the "N" entry and +# the error is appended. +# +INSERT INTO nt_1 VALUES ("new text -1", -1, "new text -1"); +INSERT INTO nt_1 VALUES ("new text -1", -1, "new text -1"); +ERROR 23000: Duplicate entry '-1' for key 'PRIMARY' +INSERT INTO nt_1 VALUES ("new text -24", -24, "new text -24"), ("new text -1", -1, "new text -1"); +ERROR 23000: Duplicate entry '-1' for key 'PRIMARY' +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1 VALUES ("new text -1", -1, "new text -1") +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1 VALUES ("new text -24", -24, "new text -24"), ("new text -1", -1, "new text -1") + + + + +# +#7) "M" generates in binglog the "B M C" entries. +# +DELETE FROM nt_1; +INSERT INTO nt_1 SELECT * FROM tt_1; +DELETE FROM tt_1; +INSERT INTO tt_1 SELECT * FROM nt_1; +INSERT INTO tt_3 VALUES ("new text 000", 000, ''); +INSERT INTO tt_3 VALUES("new text 100", 100, f1()); +INSERT INTO nt_4 VALUES("new text 100", 100, f1()); +INSERT INTO tt_3 VALUES("new text 200", 200, f2()); +INSERT INTO nt_4 VALUES ("new text 300", 300, ''); +INSERT INTO nt_4 VALUES ("new text 400", 400, f1()); +INSERT INTO nt_4 VALUES ("new text 500", 500, f2()); +CALL pc_i_tt_3(600, "Testing..."); +UPDATE nt_3, nt_4, tt_3, tt_4 SET nt_3.a= "new text 1", nt_4.a= "new text 1", tt_3.a= "new text 1", tt_4.a= "new text 1" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100; +UPDATE tt_3, tt_4, nt_3, nt_4 SET tt_3.a= "new text 2", tt_4.a= "new text 2", nt_3.a= "new text 2", nt_4.a = "new text 2" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100; +UPDATE tt_3, nt_3, nt_4, tt_4 SET tt_3.a= "new text 3", nt_3.a= "new text 3", nt_4.a= "new text 3", tt_4.a = "new text 3" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100; +UPDATE tt_3, nt_3, nt_4, tt_4 SET tt_3.a= "new text 4", nt_3.a= "new text 4", nt_4.a= "new text 4", tt_4.a = "new text 4" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DELETE FROM nt_1 +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1 SELECT * FROM tt_1 +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; DELETE FROM tt_1 +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 SELECT * FROM nt_1 +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_3 VALUES ("new text 000", 000, '') +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_3 VALUES("new text 100", 100, f1()) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_4 VALUES("new text 100", 100, f1()) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_3 VALUES("new text 200", 200, f2()) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_4 VALUES ("new text 300", 300, '') +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_4 VALUES ("new text 400", 400, f1()) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_4 VALUES ("new text 500", 500, f2()) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_3 VALUES ( NAME_CONST('y',_latin1'Testing...' COLLATE 'latin1_swedish_ci'), NAME_CONST('x',600), NAME_CONST('x',600)) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; UPDATE nt_3, nt_4, tt_3, tt_4 SET nt_3.a= "new text 1", nt_4.a= "new text 1", tt_3.a= "new text 1", tt_4.a= "new text 1" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100 +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; UPDATE tt_3, tt_4, nt_3, nt_4 SET tt_3.a= "new text 2", tt_4.a= "new text 2", nt_3.a= "new text 2", nt_4.a = "new text 2" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100 +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; UPDATE tt_3, nt_3, nt_4, tt_4 SET tt_3.a= "new text 3", nt_3.a= "new text 3", nt_4.a= "new text 3", tt_4.a = "new text 3" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100 +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; UPDATE tt_3, nt_3, nt_4, tt_4 SET tt_3.a= "new text 4", nt_3.a= "new text 4", nt_4.a= "new text 4", tt_4.a = "new text 4" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100 +master-bin.000001 # Xid # # COMMIT /* XID */ + + + + +# +#7.e) "M" with error in M generates in binglog the "B M R" entries. +# +INSERT INTO nt_3 VALUES ("new text -26", -26, ''); +SELECT * FROM tt_3; +a b c +new text 000 0 +new text 4 100 Testing... +new text 200 200 Testing... +Testing... 600 600 +INSERT INTO tt_3 VALUES ("new text -25", -25, ''), ("new text -26", -26, ''); +ERROR 23000: Duplicate entry '-26' for key 'PRIMARY' +SELECT * FROM tt_3; +a b c +new text 000 0 +new text 4 100 Testing... +new text 200 200 Testing... +Testing... 600 600 +INSERT INTO tt_4 VALUES ("new text -26", -26, ''); +SELECT * FROM nt_4; +a b c +new text 4 100 Testing... +new text 300 300 +new text 400 400 Testing... +new text 500 500 Testing... +INSERT INTO nt_4 VALUES ("new text -25", -25, ''), ("new text -26", -26, ''); +ERROR 23000: Duplicate entry '-26' for key 'PRIMARY' +SELECT * FROM nt_4; +a b c +new text 4 100 Testing... +new text 300 300 +new text 400 400 Testing... +new text 500 500 Testing... +new text -25 -25 +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; INSERT INTO nt_3 VALUES ("new text -26", -26, '') +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_3 VALUES ("new text -25", -25, ''), ("new text -26", -26, '') +master-bin.000001 # Query # # ROLLBACK +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_4 VALUES ("new text -26", -26, '') +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_4 VALUES ("new text -25", -25, ''), ("new text -26", -26, '') +master-bin.000001 # Query # # ROLLBACK + + + + +# +#8) "B N N T C" generates in binglog the "N N B T C" entries. +# +BEGIN; +INSERT INTO nt_1 VALUES ("new text 10", 10, "new text 10"); +INSERT INTO nt_2 VALUES ("new text 10", 10, "new text 10"); +INSERT INTO tt_1 VALUES ("new text 10", 10, "new text 10"); +COMMIT; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1 VALUES ("new text 10", 10, "new text 10") +master-bin.000001 # Query # # use `test`; INSERT INTO nt_2 VALUES ("new text 10", 10, "new text 10") +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text 10", 10, "new text 10") +master-bin.000001 # Xid # # COMMIT /* XID */ + + + + +# +#8.e) "B N N T R" See 6.e and 9.e. +# + + + + +# +#9) "B N N T R" generates in binlog the "N N B T R" entries. +# +BEGIN; +INSERT INTO nt_1 VALUES ("new text 11", 11, "new text 11"); +INSERT INTO nt_2 VALUES ("new text 11", 11, "new text 11"); +INSERT INTO tt_1 VALUES ("new text 11", 11, "new text 11"); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1 VALUES ("new text 11", 11, "new text 11") +master-bin.000001 # Query # # use `test`; INSERT INTO nt_2 VALUES ("new text 11", 11, "new text 11") +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text 11", 11, "new text 11") +master-bin.000001 # Query # # ROLLBACK + + + + +# +#9.e) "B N N T R" with error in N generates in binlog the "N N B T R" entries. +# +BEGIN; +INSERT INTO nt_1 VALUES ("new text -25", -25, "new text -25"); +INSERT INTO nt_2 VALUES ("new text -25", -25, "new text -25"); +INSERT INTO nt_2 VALUES ("new text -26", -26, "new text -26"), ("new text -25", -25, "new text -25"); +ERROR 23000: Duplicate entry '-25' for key 'PRIMARY' +INSERT INTO tt_1 VALUES ("new text -27", -27, "new text -27"); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1 VALUES ("new text -25", -25, "new text -25") +master-bin.000001 # Query # # use `test`; INSERT INTO nt_2 VALUES ("new text -25", -25, "new text -25") +master-bin.000001 # Query # # use `test`; INSERT INTO nt_2 VALUES ("new text -26", -26, "new text -26"), ("new text -25", -25, "new text -25") +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text -27", -27, "new text -27") +master-bin.000001 # Query # # ROLLBACK + + + + +# +#10) "B N N C" generates in binglog the "N N" entries. +# +BEGIN; +INSERT INTO nt_1 VALUES ("new text 12", 12, "new text 12"); +INSERT INTO nt_2 VALUES ("new text 12", 12, "new text 12"); +COMMIT; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1 VALUES ("new text 12", 12, "new text 12") +master-bin.000001 # Query # # use `test`; INSERT INTO nt_2 VALUES ("new text 12", 12, "new text 12") + + + + +# +#10.e) "B N N C" See 6.e and 9.e. +# + + + + +# +#11) "B N N R" generates in binlog the "N N" entries. +# +BEGIN; +INSERT INTO nt_1 VALUES ("new text 13", 13, "new text 13"); +INSERT INTO nt_2 VALUES ("new text 13", 13, "new text 13"); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1 VALUES ("new text 13", 13, "new text 13") +master-bin.000001 # Query # # use `test`; INSERT INTO nt_2 VALUES ("new text 13", 13, "new text 13") + + + + +# +#11.e) "B N N R" See 6.e and 9.e. +# + + + + +# +#12) "B M T C" generates in the binlog the "B M T C" entries. +# +DELETE FROM nt_1; +BEGIN; +INSERT INTO nt_1 SELECT * FROM tt_1; +INSERT INTO tt_2 VALUES ("new text 14", 14, "new text 14"); +COMMIT; +DELETE FROM tt_1; +BEGIN; +INSERT INTO tt_1 SELECT * FROM nt_1; +INSERT INTO tt_2 VALUES ("new text 15", 15, "new text 15"); +COMMIT; +BEGIN; +INSERT INTO tt_3 VALUES ("new text 700", 700, ''); +INSERT INTO tt_1 VALUES ("new text 800", 800, ''); +COMMIT; +BEGIN; +INSERT INTO tt_3 VALUES("new text 900", 900, f1()); +INSERT INTO tt_1 VALUES ("new text 1000", 1000, ''); +COMMIT; +BEGIN; +INSERT INTO tt_3 VALUES(1100, 1100, f2()); +INSERT INTO tt_1 VALUES ("new text 1200", 1200, ''); +COMMIT; +BEGIN; +INSERT INTO nt_4 VALUES ("new text 1300", 1300, ''); +INSERT INTO tt_1 VALUES ("new text 1400", 1400, ''); +COMMIT; +BEGIN; +INSERT INTO nt_4 VALUES("new text 1500", 1500, f1()); +INSERT INTO tt_1 VALUES ("new text 1600", 1600, ''); +COMMIT; +BEGIN; +INSERT INTO nt_4 VALUES("new text 1700", 1700, f2()); +INSERT INTO tt_1 VALUES ("new text 1800", 1800, ''); +COMMIT; +BEGIN; +CALL pc_i_tt_3(1900, "Testing..."); +INSERT INTO tt_1 VALUES ("new text 2000", 2000, ''); +COMMIT; +BEGIN; +UPDATE nt_3, nt_4, tt_3, tt_4 SET nt_3.a= "new text 5", nt_4.a= "new text 5", tt_3.a= "new text 5", tt_4.a= "new text 5" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100; +INSERT INTO tt_1 VALUES ("new text 2100", 2100, ''); +COMMIT; +BEGIN; +UPDATE tt_3, tt_4, nt_3, nt_4 SET tt_3.a= "new text 6", tt_4.a= "new text 6", nt_3.a= "new text 6", nt_4.a = "new text 6" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100; +INSERT INTO tt_1 VALUES ("new text 2200", 2200, ''); +COMMIT; +BEGIN; +UPDATE tt_3, nt_3, nt_4, tt_4 SET tt_3.a= "new text 7", nt_3.a= "new text 7", nt_4.a= "new text 7", tt_4.a = "new text 7" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100; +INSERT INTO tt_1 VALUES ("new text 2300", 2300, ''); +COMMIT; +BEGIN; +UPDATE tt_3, nt_3, nt_4, tt_4 SET tt_3.a= "new text 8", nt_3.a= "new text 8", nt_4.a= "new text 8", tt_4.a = "new text 8" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100; +INSERT INTO tt_1 VALUES ("new text 2400", 2400, ''); +COMMIT; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DELETE FROM nt_1 +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1 SELECT * FROM tt_1 +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_2 VALUES ("new text 14", 14, "new text 14") +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; DELETE FROM tt_1 +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 SELECT * FROM nt_1 +master-bin.000001 # Query # # use `test`; INSERT INTO tt_2 VALUES ("new text 15", 15, "new text 15") +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_3 VALUES ("new text 700", 700, '') +master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text 800", 800, '') +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_3 VALUES("new text 900", 900, f1()) +master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text 1000", 1000, '') +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_3 VALUES(1100, 1100, f2()) +master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text 1200", 1200, '') +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_4 VALUES ("new text 1300", 1300, '') +master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text 1400", 1400, '') +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_4 VALUES("new text 1500", 1500, f1()) +master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text 1600", 1600, '') +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_4 VALUES("new text 1700", 1700, f2()) +master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text 1800", 1800, '') +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_3 VALUES ( NAME_CONST('y',_latin1'Testing...' COLLATE 'latin1_swedish_ci'), NAME_CONST('x',1900), NAME_CONST('x',1900)) +master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text 2000", 2000, '') +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; UPDATE nt_3, nt_4, tt_3, tt_4 SET nt_3.a= "new text 5", nt_4.a= "new text 5", tt_3.a= "new text 5", tt_4.a= "new text 5" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100 +master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text 2100", 2100, '') +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; UPDATE tt_3, tt_4, nt_3, nt_4 SET tt_3.a= "new text 6", tt_4.a= "new text 6", nt_3.a= "new text 6", nt_4.a = "new text 6" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100 +master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text 2200", 2200, '') +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; UPDATE tt_3, nt_3, nt_4, tt_4 SET tt_3.a= "new text 7", nt_3.a= "new text 7", nt_4.a= "new text 7", tt_4.a = "new text 7" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100 +master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text 2300", 2300, '') +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; UPDATE tt_3, nt_3, nt_4, tt_4 SET tt_3.a= "new text 8", nt_3.a= "new text 8", nt_4.a= "new text 8", tt_4.a = "new text 8" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100 +master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text 2400", 2400, '') +master-bin.000001 # Xid # # COMMIT /* XID */ + + + + +# +#12.e) "B M T C" with error in M generates in the binlog the "B M T C" entries. +# +# There is a bug in the slave that needs to be fixed before enabling +# this part of the test. A bug report will be filed referencing this +# test case. +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info + + + + +# +#13) "B M T R" generates in the binlog the "B M T R" entries +# +DELETE FROM nt_1; +BEGIN; +INSERT INTO nt_1 SELECT * FROM tt_1; +INSERT INTO tt_2 VALUES ("new text 17", 17, "new text 17"); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +DELETE FROM tt_1; +BEGIN; +INSERT INTO tt_1 SELECT * FROM nt_1; +INSERT INTO tt_2 VALUES ("new text 18", 18, "new text 18"); +ROLLBACK; +INSERT INTO tt_1 SELECT * FROM nt_1; +BEGIN; +INSERT INTO tt_3 VALUES ("new text 2500", 2500, ''); +INSERT INTO tt_1 VALUES ("new text 2600", 2600, ''); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +BEGIN; +INSERT INTO tt_3 VALUES("new text 2700", 2700, f1()); +INSERT INTO tt_1 VALUES ("new text 2800", 2800, ''); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +BEGIN; +INSERT INTO tt_3 VALUES(2900, 2900, f2()); +INSERT INTO tt_1 VALUES ("new text 3000", 3000, ''); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +BEGIN; +INSERT INTO nt_4 VALUES ("new text 3100", 3100, ''); +INSERT INTO tt_1 VALUES ("new text 3200", 3200, ''); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +BEGIN; +INSERT INTO nt_4 VALUES("new text 3300", 3300, f1()); +INSERT INTO tt_1 VALUES ("new text 3400", 3400, ''); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +BEGIN; +INSERT INTO nt_4 VALUES("new text 3500", 3500, f2()); +INSERT INTO tt_1 VALUES ("new text 3600", 3600, ''); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +BEGIN; +CALL pc_i_tt_3(3700, "Testing..."); +INSERT INTO tt_1 VALUES ("new text 3700", 3700, ''); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +BEGIN; +UPDATE nt_3, nt_4, tt_3, tt_4 SET nt_3.a= "new text 9", nt_4.a= "new text 9", tt_3.a= "new text 9", tt_4.a= "new text 9" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100; +INSERT INTO tt_1 VALUES ("new text 3800", 3800, ''); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +BEGIN; +UPDATE tt_3, tt_4, nt_3, nt_4 SET tt_3.a= "new text 10", tt_4.a= "new text 10", nt_3.a= "new text 10", nt_4.a = "new text 10" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100; +INSERT INTO tt_1 VALUES ("new text 3900", 3900, ''); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +BEGIN; +UPDATE tt_3, nt_3, nt_4, tt_4 SET tt_3.a= "new text 11", nt_3.a= "new text 11", nt_4.a= "new text 11", tt_4.a = "new text 11" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100; +INSERT INTO tt_1 VALUES ("new text 4000", 4000, ''); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +BEGIN; +UPDATE tt_3, nt_3, nt_4, tt_4 SET tt_3.a= "new text 12", nt_3.a= "new text 12", nt_4.a= "new text 12", tt_4.a = "new text 12" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100; +INSERT INTO tt_1 VALUES ("new text 4100", 4100, ''); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DELETE FROM nt_1 +master-bin.000001 # Query # # use `test`; INSERT INTO nt_1 SELECT * FROM tt_1 +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_2 VALUES ("new text 17", 17, "new text 17") +master-bin.000001 # Query # # ROLLBACK +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; DELETE FROM tt_1 +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 SELECT * FROM nt_1 +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_3 VALUES ("new text 2500", 2500, '') +master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text 2600", 2600, '') +master-bin.000001 # Query # # ROLLBACK +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_3 VALUES("new text 2700", 2700, f1()) +master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text 2800", 2800, '') +master-bin.000001 # Query # # ROLLBACK +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_3 VALUES(2900, 2900, f2()) +master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text 3000", 3000, '') +master-bin.000001 # Query # # ROLLBACK +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_4 VALUES ("new text 3100", 3100, '') +master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text 3200", 3200, '') +master-bin.000001 # Query # # ROLLBACK +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_4 VALUES("new text 3300", 3300, f1()) +master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text 3400", 3400, '') +master-bin.000001 # Query # # ROLLBACK +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO nt_4 VALUES("new text 3500", 3500, f2()) +master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text 3600", 3600, '') +master-bin.000001 # Query # # ROLLBACK +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_3 VALUES ( NAME_CONST('y',_latin1'Testing...' COLLATE 'latin1_swedish_ci'), NAME_CONST('x',3700), NAME_CONST('x',3700)) +master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text 3700", 3700, '') +master-bin.000001 # Query # # ROLLBACK +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; UPDATE nt_3, nt_4, tt_3, tt_4 SET nt_3.a= "new text 9", nt_4.a= "new text 9", tt_3.a= "new text 9", tt_4.a= "new text 9" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100 +master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text 3800", 3800, '') +master-bin.000001 # Query # # ROLLBACK +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; UPDATE tt_3, tt_4, nt_3, nt_4 SET tt_3.a= "new text 10", tt_4.a= "new text 10", nt_3.a= "new text 10", nt_4.a = "new text 10" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100 +master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text 3900", 3900, '') +master-bin.000001 # Query # # ROLLBACK +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; UPDATE tt_3, nt_3, nt_4, tt_4 SET tt_3.a= "new text 11", nt_3.a= "new text 11", nt_4.a= "new text 11", tt_4.a = "new text 11" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100 +master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text 4000", 4000, '') +master-bin.000001 # Query # # ROLLBACK +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; UPDATE tt_3, nt_3, nt_4, tt_4 SET tt_3.a= "new text 12", nt_3.a= "new text 12", nt_4.a= "new text 12", tt_4.a = "new text 12" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100 +master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text 4100", 4100, '') +master-bin.000001 # Query # # ROLLBACK + + + + +# +#13.e) "B M T R" with error in M generates in the binlog the "B M T R" entries. +# +BEGIN; +INSERT INTO nt_3 VALUES ("new text -30", -30, ''); +INSERT INTO tt_3 VALUES ("new text -29", -29, ''), ("new text -30", -30, ''); +ERROR 23000: Duplicate entry '-30' for key 'PRIMARY' +INSERT INTO tt_1 VALUES ("new text -30", -30, ''); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +BEGIN; +INSERT INTO tt_4 VALUES ("new text -30", -30, ''); +INSERT INTO nt_4 VALUES ("new text -29", -29, ''), ("new text -30", -30, ''); +ERROR 23000: Duplicate entry '-30' for key 'PRIMARY' +INSERT INTO tt_1 VALUES ("new text -31", -31, ''); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; INSERT INTO nt_3 VALUES ("new text -30", -30, '') +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_3 VALUES ("new text -29", -29, ''), ("new text -30", -30, '') +master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text -30", -30, '') +master-bin.000001 # Query # # ROLLBACK +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_4 VALUES ("new text -30", -30, '') +master-bin.000001 # Query # # use `test`; INSERT INTO nt_4 VALUES ("new text -29", -29, ''), ("new text -30", -30, '') +master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text -31", -31, '') +master-bin.000001 # Query # # ROLLBACK + + + + +# +#14) "B M T R" with error in M generates in the binlog the "B M T R" entries. +# +BEGIN; +INSERT INTO tt_4 VALUES ("new text -32", -32, ''); +TRUNCATE TABLE tt_4; +INSERT INTO tt_4 VALUES ("new text -33", -33, ''); +ROLLBACK; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_4 VALUES ("new text -32", -32, '') +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; TRUNCATE TABLE tt_4 +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_4 VALUES ("new text -33", -33, '') +master-bin.000001 # Xid # # COMMIT /* XID */ +################################################################################### +# CLEAN +################################################################################### +DROP TABLE tt_1; +DROP TABLE tt_2; +DROP TABLE tt_3; +DROP TABLE tt_4; +DROP TABLE nt_1; +DROP TABLE nt_2; +DROP TABLE nt_3; +DROP TABLE nt_4; +DROP PROCEDURE pc_i_tt_3; +DROP FUNCTION f1; +DROP FUNCTION f2; diff --git a/mysql-test/suite/rpl/t/rpl_stm_mixing_engines.test b/mysql-test/suite/rpl/t/rpl_stm_mixing_engines.test new file mode 100644 index 00000000000..0097fde874a --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_stm_mixing_engines.test @@ -0,0 +1,5 @@ +--source include/have_binlog_format_statement.inc +--source include/master-slave.inc +--source include/have_innodb.inc + +--source extra/rpl_tests/rpl_mixing_engines.test diff --git a/sql/log.cc b/sql/log.cc index bb81d0c723e..282312d28e2 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -1264,6 +1264,25 @@ int LOGGER::set_handlers(uint error_log_printer, return 0; } +/** + This function checks if a transactional talbe was updated by the + current statement. + + @param thd The client thread that executed the current statement. + @return + @c true if a transactional table was updated, @false otherwise. +*/ +static bool stmt_has_updated_trans_table(THD *thd) +{ + Ha_trx_info *ha_info; + + for (ha_info= thd->transaction.stmt.ha_list; ha_info; ha_info= ha_info->next()) + { + if (ha_info->is_trx_read_write() && ha_info->ht() != binlog_hton) + return (TRUE); + } + return (FALSE); +} /* Save position of binary log transaction cache. @@ -4060,7 +4079,8 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info) (binlog_trx_data*) thd_get_ha_data(thd, binlog_hton); IO_CACHE *trans_log= &trx_data->trans_log; my_off_t trans_log_pos= my_b_tell(trans_log); - if (event_info->get_cache_stmt() || trans_log_pos != 0) + if (event_info->get_cache_stmt() || trans_log_pos != 0 || + stmt_has_updated_trans_table(thd)) { DBUG_PRINT("info", ("Using trans_log: cache: %d, trans_log_pos: %lu", event_info->get_cache_stmt(), From 01eda6596d43687f3640dd75868db105c5c5c006 Mon Sep 17 00:00:00 2001 From: Alfranio Correia Date: Thu, 27 Aug 2009 10:32:27 +0100 Subject: [PATCH 08/68] Post-fix for BUG#28976. Updated main.mysqlbinlog_row_trans's result file as TRUNCATE statements are wrapped in BEGIN...COMMIT. --- mysql-test/r/mysqlbinlog_row_trans.result | 34 ++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/mysqlbinlog_row_trans.result b/mysql-test/r/mysqlbinlog_row_trans.result index d0180e4a7a3..9c3348a9e76 100644 --- a/mysql-test/r/mysqlbinlog_row_trans.result +++ b/mysql-test/r/mysqlbinlog_row_trans.result @@ -215,7 +215,7 @@ COMMIT/*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -TRUNCATE TABLE t1 +BEGIN /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -223,6 +223,22 @@ SET TIMESTAMP=1000000000/*!*/; TRUNCATE TABLE t1 /*!*/; # at # +#010909 4:46:40 server id 1 end_log_pos # Xid = # +COMMIT/*!*/; +# at # +#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=1000000000/*!*/; +BEGIN +/*!*/; +# at # +#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=1000000000/*!*/; +TRUNCATE TABLE t1 +/*!*/; +# at # +#010909 4:46:40 server id 1 end_log_pos # Xid = # +COMMIT/*!*/; +# at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; BEGIN @@ -331,9 +347,17 @@ COMMIT/*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; +BEGIN +/*!*/; +# at # +#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=1000000000/*!*/; TRUNCATE TABLE t1 /*!*/; # at # +#010909 4:46:40 server id 1 end_log_pos # Xid = # +COMMIT/*!*/; +# at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; TRUNCATE TABLE t2 @@ -449,9 +473,17 @@ ROLLBACK # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; +BEGIN +/*!*/; +# at # +#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=1000000000/*!*/; TRUNCATE TABLE t1 /*!*/; # at # +#010909 4:46:40 server id 1 end_log_pos # Xid = # +COMMIT/*!*/; +# at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; TRUNCATE TABLE t2 From d9d71d0f509b3a1610e63092306ba039115b752d Mon Sep 17 00:00:00 2001 From: Sergey Glukhov Date: Thu, 27 Aug 2009 15:22:19 +0500 Subject: [PATCH 09/68] Bug#46184 Crash, SELECT ... FROM derived table procedure analyze The crash happens because select_union object is used as result set for queries which have derived tables. select_union use temporary table as data storage and if fields count exceeds 10(count of values for procedure ANALYSE()) then we get a crash on fill_record() function. --- mysql-test/r/analyse.result | 9 ++++++--- mysql-test/r/subselect.result | 2 +- mysql-test/t/analyse.test | 10 ++++++++++ mysql-test/t/subselect.test | 2 +- sql/sql_yacc.yy | 3 ++- 5 files changed, 20 insertions(+), 6 deletions(-) diff --git a/mysql-test/r/analyse.result b/mysql-test/r/analyse.result index 49722d5b0ab..1e3a2985f74 100644 --- a/mysql-test/r/analyse.result +++ b/mysql-test/r/analyse.result @@ -28,9 +28,7 @@ test.t1.bool N Y 1 1 0 0 1.0000 NULL ENUM('N','Y') NOT NULL test.t1.d 2002-03-03 2002-03-05 10 10 0 0 10.0000 NULL ENUM('2002-03-03','2002-03-04','2002-03-05') NOT NULL drop table t1,t2; EXPLAIN SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE(); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY system NULL NULL NULL NULL 1 -2 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used +ERROR HY000: Incorrect usage of PROCEDURE and subquery create table t1 (a int not null); create table t2 select * from t1 where 0=1 procedure analyse(); show create table t2; @@ -153,4 +151,9 @@ select f3 from t1 procedure analyse(1, 1); Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype test.t1.f3 5.99999 9.55555 7 7 0 0 7.77777 1.77778 FLOAT(6,5) NOT NULL drop table t1; +CREATE TABLE t1(a INT,b INT,c INT,d INT,e INT,f INT,g INT,h INT,i INT,j INT,k INT); +INSERT INTO t1 VALUES (); +SELECT * FROM (SELECT * FROM t1) d PROCEDURE ANALYSE(); +ERROR HY000: Incorrect usage of PROCEDURE and subquery +DROP TABLE t1; End of 4.1 tests diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index 324a6073426..3f6e82fb57e 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -75,7 +75,7 @@ SELECT 1 FROM (SELECT 1 as a) b WHERE 1 IN (SELECT (SELECT a)); select (SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE(1)); ERROR HY000: Incorrect usage of PROCEDURE and subquery SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE((SELECT 1)); -ERROR HY000: Incorrect parameters to procedure 'ANALYSE' +ERROR HY000: Incorrect usage of PROCEDURE and subquery SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NULL; ERROR 42S22: Unknown column 'a' in 'field list' SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NOT NULL; diff --git a/mysql-test/t/analyse.test b/mysql-test/t/analyse.test index efcf5f6421c..d8466df14bf 100644 --- a/mysql-test/t/analyse.test +++ b/mysql-test/t/analyse.test @@ -14,6 +14,7 @@ create table t2 select * from t1 procedure analyse(); select * from t2; drop table t1,t2; +--error ER_WRONG_USAGE EXPLAIN SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE(); # @@ -102,4 +103,13 @@ select f2 from t1 procedure analyse(1, 1); select f3 from t1 procedure analyse(1, 1); drop table t1; +# +# Bug#46184 Crash, SELECT ... FROM derived table procedure analyze +# +CREATE TABLE t1(a INT,b INT,c INT,d INT,e INT,f INT,g INT,h INT,i INT,j INT,k INT); +INSERT INTO t1 VALUES (); +--error ER_WRONG_USAGE +SELECT * FROM (SELECT * FROM t1) d PROCEDURE ANALYSE(); +DROP TABLE t1; + --echo End of 4.1 tests diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index 9d4fc9030f2..36a885350f6 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -30,7 +30,7 @@ SELECT 1 IN (SELECT 1); SELECT 1 FROM (SELECT 1 as a) b WHERE 1 IN (SELECT (SELECT a)); -- error ER_WRONG_USAGE select (SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE(1)); --- error ER_WRONG_PARAMETERS_TO_PROCEDURE +-- error ER_WRONG_USAGE SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE((SELECT 1)); -- error ER_BAD_FIELD_ERROR SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NULL; diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index b38b6e96890..09a0a4b2f12 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -7334,7 +7334,8 @@ procedure_clause: MYSQL_YYABORT; } - if (&lex->select_lex != lex->current_select) + if (&lex->select_lex != lex->current_select || + lex->select_lex.get_table_list()->derived) { my_error(ER_WRONG_USAGE, MYF(0), "PROCEDURE", "subquery"); MYSQL_YYABORT; From 8ca8f70daacc1853528b40ccf4f7f3f122c88a65 Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Thu, 27 Aug 2009 14:40:42 +0300 Subject: [PATCH 10/68] Bug #46749: Segfault in add_key_fields() with outer subquery level field references This error requires a combination of factors : 1. An "impossible where" in the outermost SELECT 2. An aggregate in the outermost SELECT 3. A correlated subquery with a WHERE clause that includes an outer field reference as a top level WHERE sargable predicate When JOIN::optimize detects an "impossible WHERE" it will bail out without doing the rest of the work and initializations. It will not call make_join_statistics() as well. And make_join_statistics fills in various structures for each table referenced. When processing the result of the "impossible WHERE" the query must send a single row of data if there are aggregate functions in it. In this case the server marks all the aggregates as having received no rows and calls the relevant Item::val_xxx() method on the SELECT list. However if this SELECT list happens to contain a correlated subquery this subquery is evaluated in a normal evaluation mode. And if this correlated subquery has a reference to a field from the outermost "impossible where" SELECT the add_key_fields will mistakenly consider the outer field reference as a "local" field reference when looking for sargable predicates. But since the SELECT where the outer field reference refers to is not completely initialized due to the "impossible WHERE" in this level we'll get a NULL pointer reference. Fixed by making a better condition for discovering if a field is "local" to the SELECT level being processed. It's not enough to look for OUTER_REF_TABLE_BIT in this case since for outer references to constant tables the Item_field::used_tables() will return 0 regardless of whether the field reference is from the local SELECT or not. --- mysql-test/r/subselect.result | 28 ++++++++++++++++++++++++ mysql-test/t/subselect.test | 31 ++++++++++++++++++++++++++ sql/sql_select.cc | 41 +++++++++++++++++++++++++---------- 3 files changed, 88 insertions(+), 12 deletions(-) diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index 3f6e82fb57e..eacde19ab1c 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -4474,4 +4474,32 @@ id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY C ALL NULL NULL NULL NULL 20 Using where DROP TABLE C; # End of test for bug#45061. +# +# Bug #46749: Segfault in add_key_fields() with outer subquery level +# field references +# +CREATE TABLE t1 ( +a int, +b int, +UNIQUE (a), KEY (b) +); +INSERT INTO t1 VALUES (1,1), (2,1); +CREATE TABLE st1 like t1; +INSERT INTO st1 VALUES (1,1), (2,1); +CREATE TABLE st2 like t1; +INSERT INTO st2 VALUES (1,1), (2,1); +EXPLAIN +SELECT MAX(b), (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b) +FROM t1 +WHERE a = 230; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY st1 index NULL a 5 NULL 2 Using index +2 DEPENDENT SUBQUERY st2 index b b 5 NULL 2 Using where; Using index +SELECT MAX(b), (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b) +FROM t1 +WHERE a = 230; +MAX(b) (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b) +NULL 0 +DROP TABLE t1, st1, st2; End of 5.0 tests. diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index 36a885350f6..79918ca78a2 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -3450,4 +3450,35 @@ DROP TABLE C; --echo # End of test for bug#45061. +--echo # +--echo # Bug #46749: Segfault in add_key_fields() with outer subquery level +--echo # field references +--echo # + +CREATE TABLE t1 ( + a int, + b int, + UNIQUE (a), KEY (b) +); +INSERT INTO t1 VALUES (1,1), (2,1); + +CREATE TABLE st1 like t1; +INSERT INTO st1 VALUES (1,1), (2,1); + +CREATE TABLE st2 like t1; +INSERT INTO st2 VALUES (1,1), (2,1); + +# should have "impossible where" +EXPLAIN +SELECT MAX(b), (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b) +FROM t1 +WHERE a = 230; + +# should not crash +SELECT MAX(b), (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b) +FROM t1 +WHERE a = 230; + +DROP TABLE t1, st1, st2; + --echo End of 5.0 tests. diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 0a5706ee989..ff179c432a8 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -3207,6 +3207,28 @@ add_key_equal_fields(KEY_FIELD **key_fields, uint and_level, } } + +/** + Check if an expression is a non-outer field. + + Checks if an expression is a field and belongs to the current select. + + @param field Item expression to check + + @return boolean + @retval TRUE the expression is a local field + @retval FALSE it's something else +*/ + +inline static bool +is_local_field (Item *field) +{ + field= field->real_item(); + return field->type() == Item::FIELD_ITEM && + !((Item_field *)field)->depended_from; +} + + static void add_key_fields(JOIN *join, KEY_FIELD **key_fields, uint *and_level, COND *cond, table_map usable_tables, @@ -3282,13 +3304,12 @@ add_key_fields(JOIN *join, KEY_FIELD **key_fields, uint *and_level, { Item **values; // BETWEEN, IN, NE - if (cond_func->key_item()->real_item()->type() == Item::FIELD_ITEM && + if (is_local_field (cond_func->key_item()) && !(cond_func->used_tables() & OUTER_REF_TABLE_BIT)) { values= cond_func->arguments()+1; if (cond_func->functype() == Item_func::NE_FUNC && - cond_func->arguments()[1]->real_item()->type() == Item::FIELD_ITEM && - !(cond_func->arguments()[0]->used_tables() & OUTER_REF_TABLE_BIT)) + is_local_field (cond_func->arguments()[1])) values--; DBUG_ASSERT(cond_func->functype() != Item_func::IN_FUNC || cond_func->argument_count() != 2); @@ -3304,9 +3325,7 @@ add_key_fields(JOIN *join, KEY_FIELD **key_fields, uint *and_level, for (uint i= 1 ; i < cond_func->argument_count() ; i++) { Item_field *field_item; - if (cond_func->arguments()[i]->real_item()->type() == Item::FIELD_ITEM - && - !(cond_func->arguments()[i]->used_tables() & OUTER_REF_TABLE_BIT)) + if (is_local_field (cond_func->arguments()[i])) { field_item= (Item_field *) (cond_func->arguments()[i]->real_item()); add_key_equal_fields(key_fields, *and_level, cond_func, @@ -3322,8 +3341,7 @@ add_key_fields(JOIN *join, KEY_FIELD **key_fields, uint *and_level, bool equal_func=(cond_func->functype() == Item_func::EQ_FUNC || cond_func->functype() == Item_func::EQUAL_FUNC); - if (cond_func->arguments()[0]->real_item()->type() == Item::FIELD_ITEM && - !(cond_func->arguments()[0]->used_tables() & OUTER_REF_TABLE_BIT)) + if (is_local_field (cond_func->arguments()[0])) { add_key_equal_fields(key_fields, *and_level, cond_func, (Item_field*) (cond_func->arguments()[0])->real_item(), @@ -3331,9 +3349,8 @@ add_key_fields(JOIN *join, KEY_FIELD **key_fields, uint *and_level, cond_func->arguments()+1, 1, usable_tables, sargables); } - if (cond_func->arguments()[1]->real_item()->type() == Item::FIELD_ITEM && - cond_func->functype() != Item_func::LIKE_FUNC && - !(cond_func->arguments()[1]->used_tables() & OUTER_REF_TABLE_BIT)) + if (is_local_field (cond_func->arguments()[1]) && + cond_func->functype() != Item_func::LIKE_FUNC) { add_key_equal_fields(key_fields, *and_level, cond_func, (Item_field*) (cond_func->arguments()[1])->real_item(), @@ -3345,7 +3362,7 @@ add_key_fields(JOIN *join, KEY_FIELD **key_fields, uint *and_level, } case Item_func::OPTIMIZE_NULL: /* column_name IS [NOT] NULL */ - if (cond_func->arguments()[0]->real_item()->type() == Item::FIELD_ITEM && + if (is_local_field (cond_func->arguments()[0]) && !(cond_func->used_tables() & OUTER_REF_TABLE_BIT)) { Item *tmp=new Item_null; From c21fbff33886644b945337cd155184e80cfcbc93 Mon Sep 17 00:00:00 2001 From: Alfranio Correia Date: Thu, 27 Aug 2009 13:46:29 +0100 Subject: [PATCH 11/68] BUG#46864 Incorrect update of InnoDB table on slave when using trigger with myisam table Slave does not correctly handle "expected errors" leading to inconsistencies between the mater and slave. Specifically, when a statement changes both transactional and non-transactional tables, the transactional changes are automatically rolled back on the master but the slave ignores the error and does not roll them back thus leading to inconsistencies. To fix the problem, we automatically roll back a statement that fails on the slave but note that the transaction is not rolled back unless a "rollback" command is in the relay log file. --- .../extra/rpl_tests/rpl_mixing_engines.test | 47 ++++++------------- .../suite/rpl/r/rpl_stm_mixing_engines.result | 45 +++++++++--------- sql/log_event.cc | 9 ++++ 3 files changed, 46 insertions(+), 55 deletions(-) diff --git a/mysql-test/extra/rpl_tests/rpl_mixing_engines.test b/mysql-test/extra/rpl_tests/rpl_mixing_engines.test index 73713b7998b..cbda85527f1 100644 --- a/mysql-test/extra/rpl_tests/rpl_mixing_engines.test +++ b/mysql-test/extra/rpl_tests/rpl_mixing_engines.test @@ -562,21 +562,21 @@ let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1); --echo # There is a bug in the slave that needs to be fixed before enabling --echo # this part of the test. A bug report will be filed referencing this --echo # test case. -# -#BEGIN; -#INSERT INTO nt_3 VALUES ("new text -28", -28, ''); -#--error ER_DUP_ENTRY -#INSERT INTO tt_3 VALUES ("new text -27", -27, ''), ("new text -28", -28, ''); -#INSERT INTO tt_1 VALUES ("new text -27", -27, ''); -#COMMIT; -# -#BEGIN; -#INSERT INTO tt_4 VALUES ("new text -28", -28, ''); -#--error ER_DUP_ENTRY -#INSERT INTO nt_4 VALUES ("new text -27", -27, ''), ("new text -28", -28, ''); -#INSERT INTO tt_1 VALUES ("new text -28", -28, ''); -#COMMIT; -# + +BEGIN; +INSERT INTO nt_3 VALUES ("new text -28", -28, ''); +--error ER_DUP_ENTRY +INSERT INTO tt_3 VALUES ("new text -27", -27, ''), ("new text -28", -28, ''); +INSERT INTO tt_1 VALUES ("new text -27", -27, ''); +COMMIT; + +BEGIN; +INSERT INTO tt_4 VALUES ("new text -28", -28, ''); +--error ER_DUP_ENTRY +INSERT INTO nt_4 VALUES ("new text -27", -27, ''), ("new text -28", -28, ''); +INSERT INTO tt_1 VALUES ("new text -28", -28, ''); +COMMIT; + --source include/show_binlog_events.inc --echo @@ -683,23 +683,6 @@ ROLLBACK; --source include/show_binlog_events.inc ---echo ---echo ---echo ---echo -let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1); ---echo # ---echo #14) "B M T R" with error in M generates in the binlog the "B M T R" entries. ---echo # - -BEGIN; -INSERT INTO tt_4 VALUES ("new text -32", -32, ''); -TRUNCATE TABLE tt_4; -INSERT INTO tt_4 VALUES ("new text -33", -33, ''); -ROLLBACK; - ---source include/show_binlog_events.inc - connection master; sync_slave_with_master; diff --git a/mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result b/mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result index f8510b3a85e..03223166f44 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result +++ b/mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result @@ -652,8 +652,30 @@ master-bin.000001 # Xid # # COMMIT /* XID */ # There is a bug in the slave that needs to be fixed before enabling # this part of the test. A bug report will be filed referencing this # test case. +BEGIN; +INSERT INTO nt_3 VALUES ("new text -28", -28, ''); +INSERT INTO tt_3 VALUES ("new text -27", -27, ''), ("new text -28", -28, ''); +ERROR 23000: Duplicate entry '-28' for key 'PRIMARY' +INSERT INTO tt_1 VALUES ("new text -27", -27, ''); +COMMIT; +BEGIN; +INSERT INTO tt_4 VALUES ("new text -28", -28, ''); +INSERT INTO nt_4 VALUES ("new text -27", -27, ''), ("new text -28", -28, ''); +ERROR 23000: Duplicate entry '-28' for key 'PRIMARY' +INSERT INTO tt_1 VALUES ("new text -28", -28, ''); +COMMIT; show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; INSERT INTO nt_3 VALUES ("new text -28", -28, '') +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_3 VALUES ("new text -27", -27, ''), ("new text -28", -28, '') +master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text -27", -27, '') +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO tt_4 VALUES ("new text -28", -28, '') +master-bin.000001 # Query # # use `test`; INSERT INTO nt_4 VALUES ("new text -27", -27, ''), ("new text -28", -28, '') +master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text -28", -28, '') +master-bin.000001 # Xid # # COMMIT /* XID */ @@ -832,29 +854,6 @@ master-bin.000001 # Query # # use `test`; INSERT INTO tt_4 VALUES ("new text -30 master-bin.000001 # Query # # use `test`; INSERT INTO nt_4 VALUES ("new text -29", -29, ''), ("new text -30", -30, '') master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text -31", -31, '') master-bin.000001 # Query # # ROLLBACK - - - - -# -#14) "B M T R" with error in M generates in the binlog the "B M T R" entries. -# -BEGIN; -INSERT INTO tt_4 VALUES ("new text -32", -32, ''); -TRUNCATE TABLE tt_4; -INSERT INTO tt_4 VALUES ("new text -33", -33, ''); -ROLLBACK; -show binlog events from ; -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Query # # use `test`; INSERT INTO tt_4 VALUES ("new text -32", -32, '') -master-bin.000001 # Xid # # COMMIT /* XID */ -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Query # # use `test`; TRUNCATE TABLE tt_4 -master-bin.000001 # Xid # # COMMIT /* XID */ -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Query # # use `test`; INSERT INTO tt_4 VALUES ("new text -33", -33, '') -master-bin.000001 # Xid # # COMMIT /* XID */ ################################################################################### # CLEAN ################################################################################### diff --git a/sql/log_event.cc b/sql/log_event.cc index 375f9cf1859..0cda724b698 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -3202,6 +3202,15 @@ Default database: '%s'. Query: '%s'", DBUG_PRINT("info",("error ignored")); clear_all_errors(thd, const_cast(rli)); thd->killed= THD::NOT_KILLED; + /* + When an error is expected and matches the actual error the + slave does not report any error and by consequence changes + on transactional tables are not rolled back in the function + close_thread_tables(). For that reason, we explicitly roll + them back here. + */ + if (expected_error && expected_error == actual_error) + ha_autocommit_or_rollback(thd, TRUE); } /* If we expected a non-zero error code and get nothing and, it is a concurrency From fe03c7dce698a34072f4adf146c21c26432f4447 Mon Sep 17 00:00:00 2001 From: Alfranio Correia Date: Thu, 27 Aug 2009 17:28:09 +0100 Subject: [PATCH 12/68] BUG#46861 Auto-closing of temporary tables broken by replicate-rewrite-db When a connection is dropped any remaining temporary table is also automatically dropped and the SQL statement of this operation is written to the binary log in order to drop such tables on the slave and keep the slave in sync. Specifically, the current code base creates the following type of statement: DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `db`.`table`; Unfortunately, appending the database to the table name in this manner circumvents the replicate-rewrite-db option (and any options that check the current database). To solve the issue, we started writing the statement to the binary as follows: use `db`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `table`; --- mysql-test/r/drop_temp_table.result | 2 +- mysql-test/r/mix_innodb_myisam_binlog.result | 2 +- mysql-test/r/rpl_drop_temp.result | 7 + mysql-test/r/rpl_rewrite_db.result | 127 +++++++++++++++ mysql-test/t/rpl_drop_temp.test | 15 +- mysql-test/t/rpl_rewrite_db-slave.opt | 2 +- mysql-test/t/rpl_rewrite_db.test | 155 +++++++++++++++++++ sql/sql_base.cc | 19 ++- 8 files changed, 315 insertions(+), 14 deletions(-) diff --git a/mysql-test/r/drop_temp_table.result b/mysql-test/r/drop_temp_table.result index 96481341bd6..ff200d09de4 100644 --- a/mysql-test/r/drop_temp_table.result +++ b/mysql-test/r/drop_temp_table.result @@ -18,5 +18,5 @@ master-bin.000001 # Query 1 # create database `drop-temp+table-test` master-bin.000001 # Query 1 # use `drop-temp+table-test`; create temporary table shortn1 (a int) master-bin.000001 # Query 1 # use `drop-temp+table-test`; create temporary table `table:name` (a int) master-bin.000001 # Query 1 # use `drop-temp+table-test`; create temporary table shortn2 (a int) -master-bin.000001 # Query 1 # use `drop-temp+table-test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `drop-temp+table-test`.`shortn2`,`drop-temp+table-test`.`table:name`,`drop-temp+table-test`.`shortn1` +master-bin.000001 # Query 1 # use `drop-temp+table-test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `shortn2`,`table:name`,`shortn1` drop database `drop-temp+table-test`; diff --git a/mysql-test/r/mix_innodb_myisam_binlog.result b/mysql-test/r/mix_innodb_myisam_binlog.result index eda3ff41c89..21bc6501dac 100644 --- a/mysql-test/r/mix_innodb_myisam_binlog.result +++ b/mysql-test/r/mix_innodb_myisam_binlog.result @@ -260,7 +260,7 @@ master-bin.000001 # Query # # use `test`; create table t0 (n int) master-bin.000001 # Query # # use `test`; insert t0 select * from t1 master-bin.000001 # Query # # use `test`; insert into t0 select GET_LOCK("lock1",null) master-bin.000001 # Query # # use `test`; create table t2 (n int) engine=innodb -master-bin.000001 # Query # # use `test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `test`.`t1`,`test`.`ti` +master-bin.000001 # Query # # use `test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `t1`,`ti` do release_lock("lock1"); drop table t0,t2; reset master; diff --git a/mysql-test/r/rpl_drop_temp.result b/mysql-test/r/rpl_drop_temp.result index 04fe094ea26..fff179d7056 100644 --- a/mysql-test/r/rpl_drop_temp.result +++ b/mysql-test/r/rpl_drop_temp.result @@ -5,8 +5,15 @@ reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; create database if not exists mysqltest; +use mysqltest; create temporary table mysqltest.t1 (n int); create temporary table mysqltest.t2 (n int); +select get_lock("con_temp",10); +get_lock("con_temp",10) +1 +select get_lock("con_temp",10); +get_lock("con_temp",10) +1 show status like 'Slave_open_temp_tables'; Variable_name Value Slave_open_temp_tables 0 diff --git a/mysql-test/r/rpl_rewrite_db.result b/mysql-test/r/rpl_rewrite_db.result index 1b843bffdca..46e12bc166b 100644 --- a/mysql-test/r/rpl_rewrite_db.result +++ b/mysql-test/r/rpl_rewrite_db.result @@ -90,5 +90,132 @@ a b 2 row 2 3 row 3 0 +set sql_log_bin= 0; drop database rewrite; +set sql_log_bin= 1; +set sql_log_bin= 0; drop table t1; +set sql_log_bin= 1; + +**** +**** Bug #46861 Auto-closing of temporary tables broken by replicate-rewrite-db +**** + +**** +**** Preparing the environment +**** +SET sql_log_bin= 0; +CREATE DATABASE database_master_temp_01; +CREATE DATABASE database_master_temp_02; +CREATE DATABASE database_master_temp_03; +SET sql_log_bin= 1; +SET sql_log_bin= 0; +CREATE DATABASE database_slave_temp_01; +CREATE DATABASE database_slave_temp_02; +CREATE DATABASE database_slave_temp_03; +SET sql_log_bin= 1; + +**** +**** Creating temporary tables on different databases with different connections +**** +**** con_temp_01 --> creates +**** t_01_01_temp on database_master_temp_01 +**** +**** con_temp_02 --> creates +**** t_01_01_temp on database_master_temp_01 +**** t_02_01_temp, t_02_02_temp on database_master_temp_02 +**** +**** con_temp_02 --> creates +**** t_01_01_temp on database_master_temp_01 +**** t_02_01_temp, t_02_02_temp on database_master_temp_02 +**** t_03_01_temp, t_03_02_temp, t_03_03_temp on database_master_temp_03 +**** + +con_temp_01 + +USE database_master_temp_01; +CREATE TEMPORARY TABLE t_01_01_temp(a int); +INSERT INTO t_01_01_temp VALUES(1); + +con_temp_02 + +USE database_master_temp_01; +CREATE TEMPORARY TABLE t_01_01_temp(a int); +INSERT INTO t_01_01_temp VALUES(1); +USE database_master_temp_02; +CREATE TEMPORARY TABLE t_02_01_temp(a int); +INSERT INTO t_02_01_temp VALUES(1); +CREATE TEMPORARY TABLE t_02_02_temp(a int); +INSERT INTO t_02_02_temp VALUES(1); + +con_temp_03 + +USE database_master_temp_01; +CREATE TEMPORARY TABLE t_01_01_temp(a int); +INSERT INTO t_01_01_temp VALUES(1); +USE database_master_temp_02; +CREATE TEMPORARY TABLE t_02_01_temp(a int); +INSERT INTO t_02_01_temp VALUES(1); +CREATE TEMPORARY TABLE t_02_02_temp(a int); +INSERT INTO t_02_02_temp VALUES(1); +USE database_master_temp_03; +CREATE TEMPORARY TABLE t_03_01_temp(a int); +INSERT INTO t_03_01_temp VALUES(1); +CREATE TEMPORARY TABLE t_03_02_temp(a int); +INSERT INTO t_03_02_temp VALUES(1); +CREATE TEMPORARY TABLE t_03_03_temp(a int); +INSERT INTO t_03_03_temp VALUES(1); + +**** Dropping the connections +**** We want to SHOW BINLOG EVENTS, to know what was logged. But there is no +**** guarantee that logging of the terminated con1 has been done yet.a To be +**** sure that logging has been done, we use a user lock. + +show status like 'Slave_open_temp_tables'; +Variable_name Value +Slave_open_temp_tables 10 +select get_lock("con_01",10); +get_lock("con_01",10) +1 +select get_lock("con_01",10); +get_lock("con_01",10) +1 +select get_lock("con_02",10); +get_lock("con_02",10) +1 +select get_lock("con_02",10); +get_lock("con_02",10) +1 +select get_lock("con_03",10); +get_lock("con_03",10) +1 +select get_lock("con_03",10); +get_lock("con_03",10) +1 + +**** Checking the binary log and temporary tables + +show status like 'Slave_open_temp_tables'; +Variable_name Value +Slave_open_temp_tables 0 +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `database_master_temp_01`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `t_01_01_temp` +master-bin.000001 # Query # # use `database_master_temp_02`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `t_02_02_temp`,`t_02_01_temp` +master-bin.000001 # Query # # use `database_master_temp_01`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `t_01_01_temp` +master-bin.000001 # Query # # use `database_master_temp_03`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `t_03_03_temp`,`t_03_02_temp`,`t_03_01_temp` +master-bin.000001 # Query # # use `database_master_temp_02`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `t_02_02_temp`,`t_02_01_temp` +master-bin.000001 # Query # # use `database_master_temp_01`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `t_01_01_temp` +**** +**** Cleaning up the test case +**** +SET sql_log_bin= 0; +DROP DATABASE database_master_temp_01; +DROP DATABASE database_master_temp_02; +DROP DATABASE database_master_temp_03; +SET sql_log_bin= 1; +SET sql_log_bin= 0; +DROP DATABASE database_slave_temp_01; +DROP DATABASE database_slave_temp_02; +DROP DATABASE database_slave_temp_03; +SET sql_log_bin= 1; diff --git a/mysql-test/t/rpl_drop_temp.test b/mysql-test/t/rpl_drop_temp.test index 55a4e741d7c..c22bcbe63d0 100644 --- a/mysql-test/t/rpl_drop_temp.test +++ b/mysql-test/t/rpl_drop_temp.test @@ -3,15 +3,22 @@ source include/master-slave.inc; create database if not exists mysqltest; --enable_warnings +connect (con_temp,127.0.0.1,root,,test,$MASTER_MYPORT,); + +connection con_temp; +use mysqltest; create temporary table mysqltest.t1 (n int); create temporary table mysqltest.t2 (n int); -sync_slave_with_master; +select get_lock("con_temp",10); + connection master; -disconnect master; +disconnect con_temp; +select get_lock("con_temp",10); +sync_slave_with_master; + connection slave; ---real_sleep 3 # time for DROP to be written show status like 'Slave_open_temp_tables'; -connection default; +connection master; drop database mysqltest; # End of 4.1 tests diff --git a/mysql-test/t/rpl_rewrite_db-slave.opt b/mysql-test/t/rpl_rewrite_db-slave.opt index a462ad19ba0..290b92e0a3e 100644 --- a/mysql-test/t/rpl_rewrite_db-slave.opt +++ b/mysql-test/t/rpl_rewrite_db-slave.opt @@ -1 +1 @@ -"--replicate-rewrite-db=test->rewrite" "--replicate-rewrite-db=mysqltest1->test" +"--replicate-rewrite-db=test->rewrite" "--replicate-rewrite-db=mysqltest1->test" "--replicate-rewrite-db=database_master_temp_01->database_slave_temp_01" "--replicate-rewrite-db=database_master_temp_02->database_slave_temp_02" "--replicate-rewrite-db=database_master_temp_03->database_slave_temp_03" diff --git a/mysql-test/t/rpl_rewrite_db.test b/mysql-test/t/rpl_rewrite_db.test index 6b8624aff39..a9742f252be 100644 --- a/mysql-test/t/rpl_rewrite_db.test +++ b/mysql-test/t/rpl_rewrite_db.test @@ -73,9 +73,164 @@ connection slave; # The empty line last comes from the end line field in the file select * from rewrite.t1; +set sql_log_bin= 0; drop database rewrite; +set sql_log_bin= 1; connection master; +set sql_log_bin= 0; drop table t1; +set sql_log_bin= 1; # End of 4.1 tests + +--echo +--echo **** +--echo **** Bug #46861 Auto-closing of temporary tables broken by replicate-rewrite-db +--echo **** +--echo + +--echo **** +--echo **** Preparing the environment +--echo **** +connection master; + +connect (con_temp_03,127.0.0.1,root,,test,$MASTER_MYPORT,); +connect (con_temp_02,127.0.0.1,root,,test,$MASTER_MYPORT,); +connect (con_temp_01,127.0.0.1,root,,test,$MASTER_MYPORT,); + +connection master; +SET sql_log_bin= 0; +CREATE DATABASE database_master_temp_01; +CREATE DATABASE database_master_temp_02; +CREATE DATABASE database_master_temp_03; +SET sql_log_bin= 1; + +connection slave; +SET sql_log_bin= 0; +CREATE DATABASE database_slave_temp_01; +CREATE DATABASE database_slave_temp_02; +CREATE DATABASE database_slave_temp_03; +SET sql_log_bin= 1; + +--echo +--echo **** +--echo **** Creating temporary tables on different databases with different connections +--echo **** +--echo **** con_temp_01 --> creates +--echo **** t_01_01_temp on database_master_temp_01 +--echo **** +--echo **** con_temp_02 --> creates +--echo **** t_01_01_temp on database_master_temp_01 +--echo **** t_02_01_temp, t_02_02_temp on database_master_temp_02 +--echo **** +--echo **** con_temp_02 --> creates +--echo **** t_01_01_temp on database_master_temp_01 +--echo **** t_02_01_temp, t_02_02_temp on database_master_temp_02 +--echo **** t_03_01_temp, t_03_02_temp, t_03_03_temp on database_master_temp_03 +--echo **** + +--echo +--echo con_temp_01 +--echo +connection con_temp_01; +USE database_master_temp_01; +CREATE TEMPORARY TABLE t_01_01_temp(a int); +INSERT INTO t_01_01_temp VALUES(1); + +--echo +--echo con_temp_02 +--echo +connection con_temp_02; +USE database_master_temp_01; +CREATE TEMPORARY TABLE t_01_01_temp(a int); +INSERT INTO t_01_01_temp VALUES(1); +USE database_master_temp_02; +CREATE TEMPORARY TABLE t_02_01_temp(a int); +INSERT INTO t_02_01_temp VALUES(1); +CREATE TEMPORARY TABLE t_02_02_temp(a int); +INSERT INTO t_02_02_temp VALUES(1); + +--echo +--echo con_temp_03 +--echo +connection con_temp_03; +USE database_master_temp_01; +CREATE TEMPORARY TABLE t_01_01_temp(a int); +INSERT INTO t_01_01_temp VALUES(1); +USE database_master_temp_02; +CREATE TEMPORARY TABLE t_02_01_temp(a int); +INSERT INTO t_02_01_temp VALUES(1); +CREATE TEMPORARY TABLE t_02_02_temp(a int); +INSERT INTO t_02_02_temp VALUES(1); +USE database_master_temp_03; +CREATE TEMPORARY TABLE t_03_01_temp(a int); +INSERT INTO t_03_01_temp VALUES(1); +CREATE TEMPORARY TABLE t_03_02_temp(a int); +INSERT INTO t_03_02_temp VALUES(1); +CREATE TEMPORARY TABLE t_03_03_temp(a int); +INSERT INTO t_03_03_temp VALUES(1); + +--echo +--echo **** Dropping the connections +--echo **** We want to SHOW BINLOG EVENTS, to know what was logged. But there is no +--echo **** guarantee that logging of the terminated con1 has been done yet.a To be +--echo **** sure that logging has been done, we use a user lock. +--echo +connection master; +sync_slave_with_master; +connection slave; +show status like 'Slave_open_temp_tables'; + +connection master; +let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1); +connection con_temp_01; +select get_lock("con_01",10); +connection master; +disconnect con_temp_01; +select get_lock("con_01",10); + +connection con_temp_02; +select get_lock("con_02",10); +connection master; +disconnect con_temp_02; +select get_lock("con_02",10); + +connection con_temp_03; +select get_lock("con_03",10); +connection master; +disconnect con_temp_03; +select get_lock("con_03",10); + +--echo +--echo **** Checking the binary log and temporary tables +--echo +connection master; +sync_slave_with_master; +connection slave; +show status like 'Slave_open_temp_tables'; + +connection master; +--source include/show_binlog_events.inc + +--echo **** +--echo **** Cleaning up the test case +--echo **** +connection master; +SET sql_log_bin= 0; +DROP DATABASE database_master_temp_01; +DROP DATABASE database_master_temp_02; +DROP DATABASE database_master_temp_03; +SET sql_log_bin= 1; + +connection slave; +SET sql_log_bin= 0; +DROP DATABASE database_slave_temp_01; +DROP DATABASE database_slave_temp_02; +DROP DATABASE database_slave_temp_03; +SET sql_log_bin= 1; + +connection master; +sync_slave_with_master; + +# end of 5.0 tests diff --git a/sql/sql_base.cc b/sql/sql_base.cc index d969c837891..bc9aa50cb82 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -769,19 +769,23 @@ void close_temporary_tables(THD *thd) { /* Set pseudo_thread_id to be that of the processed table */ thd->variables.pseudo_thread_id= tmpkeyval(thd, table); - /* Loop forward through all tables within the sublist of - common pseudo_thread_id to create single DROP query */ + String db; + db.append(table->s->db); + /* Loop forward through all tables that belong to a common database + within the sublist of common pseudo_thread_id to create single + DROP query + */ for (s_query.length(stub_len); table && is_user_table(table) && - tmpkeyval(thd, table) == thd->variables.pseudo_thread_id; + tmpkeyval(thd, table) == thd->variables.pseudo_thread_id && + strlen(table->s->db) == db.length() && + strcmp(table->s->db, db.ptr()) == 0; table= next) { /* - We are going to add 4 ` around the db/table names and possible more - due to special characters in the names + We are going to add ` around the table names and possible more + due to special characters */ - append_identifier(thd, &s_query, table->s->db, strlen(table->s->db)); - s_query.q_append('.'); append_identifier(thd, &s_query, table->s->table_name, strlen(table->s->table_name)); s_query.q_append(','); @@ -794,6 +798,7 @@ void close_temporary_tables(THD *thd) Query_log_event qinfo(thd, s_query.ptr(), s_query.length() - 1 /* to remove trailing ',' */, 0, FALSE); + qinfo.db= db.ptr(); thd->variables.character_set_client= cs_save; /* Imagine the thread had created a temp table, then was doing a SELECT, and From a0e44ec1e8d2352df6dbf40c959e2115c9884c7e Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Fri, 28 Aug 2009 12:06:59 -0300 Subject: [PATCH 13/68] Fix for a few assorted compiler warnings. --- client/mysql.cc | 18 +- client/mysqldump.c | 6 +- mysys/array.c | 2 +- sql/item.cc | 3 +- storage/myisam/mi_check.c | 2 +- storage/ndb/include/mgmapi/ndb_logevent.h | 683 +++++++++++----------- tests/mysql_client_test.c | 2 +- 7 files changed, 371 insertions(+), 345 deletions(-) diff --git a/client/mysql.cc b/client/mysql.cc index dc7022a0ffa..1491ff1b059 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -86,7 +86,7 @@ extern "C" { #endif #undef bcmp // Fix problem with new readline -#if defined( __WIN__) +#if defined(__WIN__) #include #elif !defined(__NETWARE__) #include @@ -106,7 +106,7 @@ extern "C" { #define cmp_database(cs,A,B) strcmp((A),(B)) #endif -#if !defined( __WIN__) && !defined(__NETWARE__) && !defined(THREAD) +#if !defined(__WIN__) && !defined(__NETWARE__) && !defined(THREAD) #define USE_POPEN #endif @@ -1862,7 +1862,7 @@ static int read_and_execute(bool interactive) if (opt_outfile && glob_buffer.is_empty()) fflush(OUTFILE); -#if defined( __WIN__) || defined(__NETWARE__) +#if defined(__WIN__) || defined(__NETWARE__) tee_fputs(prompt, stdout); #if defined(__NETWARE__) line=fgets(linebuffer, sizeof(linebuffer)-1, stdin); @@ -1873,7 +1873,7 @@ static int read_and_execute(bool interactive) if (p != NULL) *p = '\0'; } -#else defined(__WIN__) +#else if (!tmpbuf.is_alloced()) tmpbuf.alloc(65535); tmpbuf.length(0); @@ -1899,7 +1899,7 @@ static int read_and_execute(bool interactive) if (opt_outfile) fputs(prompt, OUTFILE); line= readline(prompt); -#endif /* defined( __WIN__) || defined(__NETWARE__) */ +#endif /* defined(__WIN__) || defined(__NETWARE__) */ /* When Ctrl+d or Ctrl+z is pressed, the line may be NULL on some OS @@ -1947,10 +1947,10 @@ static int read_and_execute(bool interactive) } } -#if defined( __WIN__) || defined(__NETWARE__) +#if defined(__WIN__) || defined(__NETWARE__) buffer.free(); #endif -#if defined( __WIN__) +#if defined(__WIN__) tmpbuf.free(); #endif @@ -4602,7 +4602,7 @@ void tee_putc(int c, FILE *file) putc(c, OUTFILE); } -#if defined( __WIN__) || defined(__NETWARE__) +#if defined(__WIN__) || defined(__NETWARE__) #include #else #include @@ -4614,7 +4614,7 @@ void tee_putc(int c, FILE *file) static ulong start_timer(void) { -#if defined( __WIN__) || defined(__NETWARE__) +#if defined(__WIN__) || defined(__NETWARE__) return clock(); #else struct tms tms_tmp; diff --git a/client/mysqldump.c b/client/mysqldump.c index cac27424d6e..e9e3124b9cb 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -5008,7 +5008,7 @@ int main(int argc, char **argv) exit_code= get_options(&argc, &argv); if (exit_code) { - free_resources(0); + free_resources(); exit(exit_code); } @@ -5016,14 +5016,14 @@ int main(int argc, char **argv) { if(!(stderror_file= freopen(log_error_file, "a+", stderr))) { - free_resources(0); + free_resources(); exit(EX_MYSQLERR); } } if (connect_to_db(current_host, current_user, opt_password)) { - free_resources(0); + free_resources(); exit(EX_MYSQLERR); } if (!path) diff --git a/mysys/array.c b/mysys/array.c index b65bd28616d..a1c49c2589d 100644 --- a/mysys/array.c +++ b/mysys/array.c @@ -67,7 +67,7 @@ my_bool init_dynamic_array2(DYNAMIC_ARRAY *array, uint element_size, Since the dynamic array is usable even if allocation fails here malloc should not throw an error */ - if (!(array->buffer= (char*) my_malloc_ci(element_size*init_alloc, MYF(0)))) + if (!(array->buffer= (uchar*) my_malloc_ci(element_size*init_alloc, MYF(0)))) array->max_element=0; DBUG_RETURN(FALSE); } diff --git a/sql/item.cc b/sql/item.cc index 0ebb1d61a28..c1ba6fe77a3 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -3305,8 +3305,7 @@ Item_copy *Item_copy::create (Item *item) new Item_copy_uint (item) : new Item_copy_int (item); case DECIMAL_RESULT: return new Item_copy_decimal (item); - - case ROW_RESULT: + default: DBUG_ASSERT (0); } /* should not happen */ diff --git a/storage/myisam/mi_check.c b/storage/myisam/mi_check.c index 535b4f7f537..1cb0613331d 100644 --- a/storage/myisam/mi_check.c +++ b/storage/myisam/mi_check.c @@ -1549,7 +1549,7 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info, if (!param->using_global_keycache) VOID(init_key_cache(dflt_key_cache, param->key_cache_block_size, - param->use_buffers, 0, 0)); + (size_t) param->use_buffers, 0, 0)); if (init_io_cache(¶m->read_cache,info->dfile, (uint) param->read_buffer_length, diff --git a/storage/ndb/include/mgmapi/ndb_logevent.h b/storage/ndb/include/mgmapi/ndb_logevent.h index 70691f6fd28..519c13b2ca9 100644 --- a/storage/ndb/include/mgmapi/ndb_logevent.h +++ b/storage/ndb/include/mgmapi/ndb_logevent.h @@ -272,6 +272,300 @@ extern "C" { #endif }; + struct ndb_logevent_Connected { + unsigned node; + }; + + struct ndb_logevent_Disconnected { + unsigned node; + }; + + struct ndb_logevent_CommunicationClosed { + unsigned node; + }; + + struct ndb_logevent_CommunicationOpened { + unsigned node; + }; + + struct ndb_logevent_ConnectedApiVersion { + unsigned node; + unsigned version; + }; + + /* CHECKPOINT */ + struct ndb_logevent_GlobalCheckpointStarted { + unsigned gci; + }; + struct ndb_logevent_GlobalCheckpointCompleted { + unsigned gci; + }; + struct ndb_logevent_LocalCheckpointStarted { + unsigned lci; + unsigned keep_gci; + unsigned restore_gci; + }; + struct ndb_logevent_LocalCheckpointCompleted { + unsigned lci; + }; + struct ndb_logevent_LCPStoppedInCalcKeepGci { + unsigned data; + }; + struct ndb_logevent_LCPFragmentCompleted { + unsigned node; + unsigned table_id; + unsigned fragment_id; + }; + struct ndb_logevent_UndoLogBlocked { + unsigned acc_count; + unsigned tup_count; + }; + + /* STARTUP */ + struct ndb_logevent_NDBStartStarted { + unsigned version; + }; + struct ndb_logevent_NDBStartCompleted { + unsigned version; + }; + struct ndb_logevent_STTORRYRecieved { + }; + struct ndb_logevent_StartPhaseCompleted { + unsigned phase; + unsigned starttype; + }; + struct ndb_logevent_CM_REGCONF { + unsigned own_id; + unsigned president_id; + unsigned dynamic_id; + }; + struct ndb_logevent_CM_REGREF { + unsigned own_id; + unsigned other_id; + unsigned cause; + }; + struct ndb_logevent_FIND_NEIGHBOURS { + unsigned own_id; + unsigned left_id; + unsigned right_id; + unsigned dynamic_id; + }; + struct ndb_logevent_NDBStopStarted { + unsigned stoptype; + }; + struct ndb_logevent_NDBStopCompleted { + unsigned action; + unsigned signum; + }; + struct ndb_logevent_NDBStopForced { + unsigned action; + unsigned signum; + unsigned error; + unsigned sphase; + unsigned extra; + }; + struct ndb_logevent_NDBStopAborted { + }; + struct ndb_logevent_StartREDOLog { + unsigned node; + unsigned keep_gci; + unsigned completed_gci; + unsigned restorable_gci; + }; + struct ndb_logevent_StartLog { + unsigned log_part; + unsigned start_mb; + unsigned stop_mb; + unsigned gci; + }; + struct ndb_logevent_UNDORecordsExecuted { + unsigned block; + unsigned data1; + unsigned data2; + unsigned data3; + unsigned data4; + unsigned data5; + unsigned data6; + unsigned data7; + unsigned data8; + unsigned data9; + unsigned data10; + }; + + /* NODERESTART */ + struct ndb_logevent_NR_CopyDict { + }; + struct ndb_logevent_NR_CopyDistr { + }; + struct ndb_logevent_NR_CopyFragsStarted { + unsigned dest_node; + }; + struct ndb_logevent_NR_CopyFragDone { + unsigned dest_node; + unsigned table_id; + unsigned fragment_id; + }; + struct ndb_logevent_NR_CopyFragsCompleted { + unsigned dest_node; + }; + + struct ndb_logevent_NodeFailCompleted { + unsigned block; /* 0 = all */ + unsigned failed_node; + unsigned completing_node; /* 0 = all */ + }; + struct ndb_logevent_NODE_FAILREP { + unsigned failed_node; + unsigned failure_state; + }; + struct ndb_logevent_ArbitState { + unsigned code; /* code & state << 16 */ + unsigned arbit_node; + unsigned ticket_0; + unsigned ticket_1; + /* TODO */ + }; + struct ndb_logevent_ArbitResult { + unsigned code; /* code & state << 16 */ + unsigned arbit_node; + unsigned ticket_0; + unsigned ticket_1; + /* TODO */ + }; + struct ndb_logevent_GCP_TakeoverStarted { + }; + struct ndb_logevent_GCP_TakeoverCompleted { + }; + struct ndb_logevent_LCP_TakeoverStarted { + }; + struct ndb_logevent_LCP_TakeoverCompleted { + unsigned state; + }; + + /* STATISTIC */ + struct ndb_logevent_TransReportCounters { + unsigned trans_count; + unsigned commit_count; + unsigned read_count; + unsigned simple_read_count; + unsigned write_count; + unsigned attrinfo_count; + unsigned conc_op_count; + unsigned abort_count; + unsigned scan_count; + unsigned range_scan_count; + }; + struct ndb_logevent_OperationReportCounters { + unsigned ops; + }; + struct ndb_logevent_TableCreated { + unsigned table_id; + }; + struct ndb_logevent_JobStatistic { + unsigned mean_loop_count; + }; + struct ndb_logevent_SendBytesStatistic { + unsigned to_node; + unsigned mean_sent_bytes; + }; + struct ndb_logevent_ReceiveBytesStatistic { + unsigned from_node; + unsigned mean_received_bytes; + }; + struct ndb_logevent_MemoryUsage { + int gth; + /* union is for compatibility backward. + * page_size_kb member variable should be removed in the future + */ + union { + unsigned page_size_kb; + unsigned page_size_bytes; + }; + unsigned pages_used; + unsigned pages_total; + unsigned block; + }; + + /* ERROR */ + struct ndb_logevent_TransporterError { + unsigned to_node; + unsigned code; + }; + struct ndb_logevent_TransporterWarning { + unsigned to_node; + unsigned code; + }; + struct ndb_logevent_MissedHeartbeat { + unsigned node; + unsigned count; + }; + struct ndb_logevent_DeadDueToHeartbeat { + unsigned node; + }; + struct ndb_logevent_WarningEvent { + /* TODO */ + }; + + /* INFO */ + struct ndb_logevent_SentHeartbeat { + unsigned node; + }; + struct ndb_logevent_CreateLogBytes { + unsigned node; + }; + struct ndb_logevent_InfoEvent { + /* TODO */ + }; + struct ndb_logevent_EventBufferStatus { + unsigned usage; + unsigned alloc; + unsigned max; + unsigned apply_gci_l; + unsigned apply_gci_h; + unsigned latest_gci_l; + unsigned latest_gci_h; + }; + + /** Log event data for @ref NDB_LE_BackupStarted */ + struct ndb_logevent_BackupStarted { + unsigned starting_node; + unsigned backup_id; + }; + /** Log event data @ref NDB_LE_BackupFailedToStart */ + struct ndb_logevent_BackupFailedToStart { + unsigned starting_node; + unsigned error; + }; + /** Log event data @ref NDB_LE_BackupCompleted */ + struct ndb_logevent_BackupCompleted { + unsigned starting_node; + unsigned backup_id; + unsigned start_gci; + unsigned stop_gci; + unsigned n_records; + unsigned n_log_records; + unsigned n_bytes; + unsigned n_log_bytes; + }; + /** Log event data @ref NDB_LE_BackupAborted */ + struct ndb_logevent_BackupAborted { + unsigned starting_node; + unsigned backup_id; + unsigned error; + }; + /** Log event data @ref NDB_LE_SingleUser */ + struct ndb_logevent_SingleUser { + unsigned type; + unsigned node_id; + }; + /** Log even data @ref NDB_LE_StartReport */ + struct ndb_logevent_StartReport { + unsigned report_type; + unsigned remaining_time; + unsigned bitmask_size; + unsigned bitmask_data[1]; + }; + /** * Structure to store and retrieve log event information. * @see @ref secSLogEvents @@ -305,354 +599,87 @@ extern "C" { */ union { /* CONNECT */ - /** Log event specific data for for corresponding NDB_LE_ log event */ - struct { - unsigned node; - } Connected; - - /** Log event specific data for for corresponding NDB_LE_ log event */ - struct { - unsigned node; - } Disconnected; - - /** Log event specific data for for corresponding NDB_LE_ log event */ - struct { - unsigned node; - } CommunicationClosed; - - /** Log event specific data for for corresponding NDB_LE_ log event */ - struct { - unsigned node; - } CommunicationOpened; - - /** Log event specific data for for corresponding NDB_LE_ log event */ - struct { - unsigned node; - unsigned version; - } ConnectedApiVersion; + struct ndb_logevent_Connected Connected; + struct ndb_logevent_Disconnected Disconnected; + struct ndb_logevent_CommunicationClosed CommunicationClosed; + struct ndb_logevent_CommunicationOpened CommunicationOpened; + struct ndb_logevent_ConnectedApiVersion ConnectedApiVersion; /* CHECKPOINT */ - /** Log event specific data for for corresponding NDB_LE_ log event */ - struct { - unsigned gci; - } GlobalCheckpointStarted; - /** Log event specific data for for corresponding NDB_LE_ log event */ - struct { - unsigned gci; - } GlobalCheckpointCompleted; - /** Log event specific data for for corresponding NDB_LE_ log event */ - struct { - unsigned lci; - unsigned keep_gci; - unsigned restore_gci; - } LocalCheckpointStarted; - /** Log event specific data for for corresponding NDB_LE_ log event */ - struct { - unsigned lci; - } LocalCheckpointCompleted; - /** Log event specific data for for corresponding NDB_LE_ log event */ - struct { - unsigned data; - } LCPStoppedInCalcKeepGci; - /** Log event specific data for for corresponding NDB_LE_ log event */ - struct { - unsigned node; - unsigned table_id; - unsigned fragment_id; - } LCPFragmentCompleted; - /** Log event specific data for for corresponding NDB_LE_ log event */ - struct { - unsigned acc_count; - unsigned tup_count; - } UndoLogBlocked; + struct ndb_logevent_GlobalCheckpointStarted GlobalCheckpointStarted; + struct ndb_logevent_GlobalCheckpointCompleted GlobalCheckpointCompleted; + struct ndb_logevent_LocalCheckpointStarted LocalCheckpointStarted; + struct ndb_logevent_LocalCheckpointCompleted LocalCheckpointCompleted; + struct ndb_logevent_LCPStoppedInCalcKeepGci LCPStoppedInCalcKeepGci; + struct ndb_logevent_LCPFragmentCompleted LCPFragmentCompleted; + struct ndb_logevent_UndoLogBlocked UndoLogBlocked; /* STARTUP */ - /** Log event specific data for for corresponding NDB_LE_ log event */ - struct { - unsigned version; - } NDBStartStarted; - /** Log event specific data for for corresponding NDB_LE_ log event */ - struct { - unsigned version; - } NDBStartCompleted; - /** Log event specific data for for corresponding NDB_LE_ log event */ - struct { - } STTORRYRecieved; - /** Log event specific data for for corresponding NDB_LE_ log event */ - struct { - unsigned phase; - unsigned starttype; - } StartPhaseCompleted; - /** Log event specific data for for corresponding NDB_LE_ log event */ - struct { - unsigned own_id; - unsigned president_id; - unsigned dynamic_id; - } CM_REGCONF; - /** Log event specific data for for corresponding NDB_LE_ log event */ - struct { - unsigned own_id; - unsigned other_id; - unsigned cause; - } CM_REGREF; - /** Log event specific data for for corresponding NDB_LE_ log event */ - struct { - unsigned own_id; - unsigned left_id; - unsigned right_id; - unsigned dynamic_id; - } FIND_NEIGHBOURS; - /** Log event specific data for for corresponding NDB_LE_ log event */ - struct { - unsigned stoptype; - } NDBStopStarted; - /** Log event specific data for for corresponding NDB_LE_ log event */ - struct { - unsigned action; - unsigned signum; - } NDBStopCompleted; - /** Log event specific data for for corresponding NDB_LE_ log event */ - struct { - unsigned action; - unsigned signum; - unsigned error; - unsigned sphase; - unsigned extra; - } NDBStopForced; - /** Log event specific data for for corresponding NDB_LE_ log event */ - struct { - } NDBStopAborted; - /** Log event specific data for for corresponding NDB_LE_ log event */ - struct { - unsigned node; - unsigned keep_gci; - unsigned completed_gci; - unsigned restorable_gci; - } StartREDOLog; - /** Log event specific data for for corresponding NDB_LE_ log event */ - struct { - unsigned log_part; - unsigned start_mb; - unsigned stop_mb; - unsigned gci; - } StartLog; - /** Log event specific data for for corresponding NDB_LE_ log event */ - struct { - unsigned block; - unsigned data1; - unsigned data2; - unsigned data3; - unsigned data4; - unsigned data5; - unsigned data6; - unsigned data7; - unsigned data8; - unsigned data9; - unsigned data10; - } UNDORecordsExecuted; + struct ndb_logevent_NDBStartStarted NDBStartStarted; + struct ndb_logevent_NDBStartCompleted NDBStartCompleted; + struct ndb_logevent_STTORRYRecieved STTORRYRecieved; + struct ndb_logevent_StartPhaseCompleted StartPhaseCompleted; + struct ndb_logevent_CM_REGCONF CM_REGCONF; + struct ndb_logevent_CM_REGREF CM_REGREF; + struct ndb_logevent_FIND_NEIGHBOURS FIND_NEIGHBOURS; + struct ndb_logevent_NDBStopStarted NDBStopStarted; + struct ndb_logevent_NDBStopCompleted NDBStopCompleted; + struct ndb_logevent_NDBStopForced NDBStopForced; + struct ndb_logevent_NDBStopAborted NDBStopAborted; + struct ndb_logevent_StartREDOLog StartREDOLog; + struct ndb_logevent_StartLog StartLog; + struct ndb_logevent_UNDORecordsExecuted UNDORecordsExecuted; /* NODERESTART */ - /** Log event specific data for for corresponding NDB_LE_ log event */ - struct { - } NR_CopyDict; - /** Log event specific data for for corresponding NDB_LE_ log event */ - struct { - } NR_CopyDistr; - /** Log event specific data for for corresponding NDB_LE_ log event */ - struct { - unsigned dest_node; - } NR_CopyFragsStarted; - /** Log event specific data for for corresponding NDB_LE_ log event */ - struct { - unsigned dest_node; - unsigned table_id; - unsigned fragment_id; - } NR_CopyFragDone; - /** Log event specific data for for corresponding NDB_LE_ log event */ - struct { - unsigned dest_node; - } NR_CopyFragsCompleted; + struct ndb_logevent_NR_CopyDict NR_CopyDict; + struct ndb_logevent_NR_CopyDistr NR_CopyDistr; + struct ndb_logevent_NR_CopyFragsStarted NR_CopyFragsStarted; + struct ndb_logevent_NR_CopyFragDone NR_CopyFragDone; + struct ndb_logevent_NR_CopyFragsCompleted NR_CopyFragsCompleted; - /** Log event specific data for for corresponding NDB_LE_ log event */ - struct { - unsigned block; /* 0 = all */ - unsigned failed_node; - unsigned completing_node; /* 0 = all */ - } NodeFailCompleted; - /** Log event specific data for for corresponding NDB_LE_ log event */ - struct { - unsigned failed_node; - unsigned failure_state; - } NODE_FAILREP; - /** Log event specific data for for corresponding NDB_LE_ log event */ - struct { - unsigned code; /* code & state << 16 */ - unsigned arbit_node; - unsigned ticket_0; - unsigned ticket_1; - /* TODO */ - } ArbitState; - /** Log event specific data for for corresponding NDB_LE_ log event */ - struct { - unsigned code; /* code & state << 16 */ - unsigned arbit_node; - unsigned ticket_0; - unsigned ticket_1; - /* TODO */ - } ArbitResult; - /** Log event specific data for for corresponding NDB_LE_ log event */ - struct { - } GCP_TakeoverStarted; - /** Log event specific data for for corresponding NDB_LE_ log event */ - struct { - } GCP_TakeoverCompleted; - /** Log event specific data for for corresponding NDB_LE_ log event */ - struct { - } LCP_TakeoverStarted; - /** Log event specific data for for corresponding NDB_LE_ log event */ - struct { - unsigned state; - } LCP_TakeoverCompleted; + struct ndb_logevent_NodeFailCompleted NodeFailCompleted; + struct ndb_logevent_NODE_FAILREP NODE_FAILREP; + struct ndb_logevent_ArbitState ArbitState; + struct ndb_logevent_ArbitResult ArbitResult; + struct ndb_logevent_GCP_TakeoverStarted GCP_TakeoverStarted; + struct ndb_logevent_GCP_TakeoverCompleted GCP_TakeoverCompleted; + struct ndb_logevent_LCP_TakeoverStarted LCP_TakeoverStarted; + struct ndb_logevent_LCP_TakeoverCompleted LCP_TakeoverCompleted; /* STATISTIC */ - /** Log event specific data for for corresponding NDB_LE_ log event */ - struct { - unsigned trans_count; - unsigned commit_count; - unsigned read_count; - unsigned simple_read_count; - unsigned write_count; - unsigned attrinfo_count; - unsigned conc_op_count; - unsigned abort_count; - unsigned scan_count; - unsigned range_scan_count; - } TransReportCounters; - /** Log event specific data for for corresponding NDB_LE_ log event */ - struct { - unsigned ops; - } OperationReportCounters; - /** Log event specific data for for corresponding NDB_LE_ log event */ - struct { - unsigned table_id; - } TableCreated; - /** Log event specific data for for corresponding NDB_LE_ log event */ - struct { - unsigned mean_loop_count; - } JobStatistic; - /** Log event specific data for for corresponding NDB_LE_ log event */ - struct { - unsigned to_node; - unsigned mean_sent_bytes; - } SendBytesStatistic; - /** Log event specific data for for corresponding NDB_LE_ log event */ - struct { - unsigned from_node; - unsigned mean_received_bytes; - } ReceiveBytesStatistic; - /** Log event specific data for for corresponding NDB_LE_ log event */ - struct { - int gth; - /* union is for compatibility backward. - * page_size_kb member variable should be removed in the future - */ - union { - unsigned page_size_kb; - unsigned page_size_bytes; - }; - unsigned pages_used; - unsigned pages_total; - unsigned block; - } MemoryUsage; + struct ndb_logevent_TransReportCounters TransReportCounters; + struct ndb_logevent_OperationReportCounters OperationReportCounters; + struct ndb_logevent_TableCreated TableCreated; + struct ndb_logevent_JobStatistic JobStatistic; + struct ndb_logevent_SendBytesStatistic SendBytesStatistic; + struct ndb_logevent_ReceiveBytesStatistic ReceiveBytesStatistic; + struct ndb_logevent_MemoryUsage MemoryUsage; /* ERROR */ - /** Log event specific data for for corresponding NDB_LE_ log event */ - struct { - unsigned to_node; - unsigned code; - } TransporterError; - /** Log event specific data for for corresponding NDB_LE_ log event */ - struct { - unsigned to_node; - unsigned code; - } TransporterWarning; - /** Log event specific data for for corresponding NDB_LE_ log event */ - struct { - unsigned node; - unsigned count; - } MissedHeartbeat; - /** Log event specific data for for corresponding NDB_LE_ log event */ - struct { - unsigned node; - } DeadDueToHeartbeat; - /** Log event specific data for for corresponding NDB_LE_ log event */ - struct { - /* TODO */ - } WarningEvent; + struct ndb_logevent_TransporterError TransporterError; + struct ndb_logevent_TransporterWarning TransporterWarning; + struct ndb_logevent_MissedHeartbeat MissedHeartbeat; + struct ndb_logevent_DeadDueToHeartbeat DeadDueToHeartbeat; + struct ndb_logevent_WarningEvent WarningEvent; /* INFO */ - /** Log event specific data for for corresponding NDB_LE_ log event */ - struct { - unsigned node; - } SentHeartbeat; - /** Log event specific data for for corresponding NDB_LE_ log event */ - struct { - unsigned node; - } CreateLogBytes; - /** Log event specific data for for corresponding NDB_LE_ log event */ - struct { - /* TODO */ - } InfoEvent; - /** Log event specific data for for corresponding NDB_LE_ log event */ - struct { - unsigned usage; - unsigned alloc; - unsigned max; - unsigned apply_gci_l; - unsigned apply_gci_h; - unsigned latest_gci_l; - unsigned latest_gci_h; - } EventBufferStatus; + struct ndb_logevent_SentHeartbeat SentHeartbeat; + struct ndb_logevent_CreateLogBytes CreateLogBytes; + struct ndb_logevent_InfoEvent InfoEvent; + struct ndb_logevent_EventBufferStatus EventBufferStatus; /** Log event data for @ref NDB_LE_BackupStarted */ - struct { - unsigned starting_node; - unsigned backup_id; - } BackupStarted; + struct ndb_logevent_BackupStarted BackupStarted; /** Log event data @ref NDB_LE_BackupFailedToStart */ - struct { - unsigned starting_node; - unsigned error; - } BackupFailedToStart; + struct ndb_logevent_BackupFailedToStart BackupFailedToStart; /** Log event data @ref NDB_LE_BackupCompleted */ - struct { - unsigned starting_node; - unsigned backup_id; - unsigned start_gci; - unsigned stop_gci; - unsigned n_records; - unsigned n_log_records; - unsigned n_bytes; - unsigned n_log_bytes; - } BackupCompleted; + struct ndb_logevent_BackupCompleted BackupCompleted; /** Log event data @ref NDB_LE_BackupAborted */ - struct { - unsigned starting_node; - unsigned backup_id; - unsigned error; - } BackupAborted; + struct ndb_logevent_BackupAborted BackupAborted; /** Log event data @ref NDB_LE_SingleUser */ - struct { - unsigned type; - unsigned node_id; - } SingleUser; + struct ndb_logevent_SingleUser SingleUser; /** Log even data @ref NDB_LE_StartReport */ - struct { - unsigned report_type; - unsigned remaining_time; - unsigned bitmask_size; - unsigned bitmask_data[1]; - } StartReport; + struct ndb_logevent_StartReport StartReport; #ifndef DOXYGEN_FIX }; #else diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 9d61d6edd3e..300b0347233 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -4262,7 +4262,7 @@ static void test_fetch_date() myheader("test_fetch_date"); - /* Will not work if sql_mode is NO_ZERO_DATE (implicit if TRADITIONAL) /*/ + /* Will not work if sql_mode is NO_ZERO_DATE (implicit if TRADITIONAL) */ rc= mysql_query(mysql, "SET SQL_MODE=''"); myquery(rc); From 2217de25139f5994fc1c5c71f897ff0788813db0 Mon Sep 17 00:00:00 2001 From: Staale Smedseng Date: Fri, 28 Aug 2009 17:51:31 +0200 Subject: [PATCH 14/68] Bug #43414 Parenthesis (and other) warnings compiling MySQL with gcc 4.3.2 This patch fixes a number of GCC warnings about variables used before initialized. A new macro UNINIT_VAR() is introduced for use in the variable declaration, and LINT_INIT() usage will be gradually deprecated. (A workaround is used for g++, pending a patch for a g++ bug.) GCC warnings for unused results (attribute warn_unused_result) for a number of system calls (present at least in later Ubuntus, where the usual void cast trick doesn't work) are also fixed. --- client/mysql.cc | 3 ++- client/mysql_upgrade.c | 3 ++- client/mysqladmin.cc | 6 ++++-- client/mysqlmanager-pwgen.c | 19 ++++++++++++------- client/mysqltest.c | 15 +++++++-------- cmd-line-utils/readline/bind.c | 6 ++---- cmd-line-utils/readline/histfile.c | 7 ++++--- cmd-line-utils/readline/undo.c | 3 ++- heap/hp_test2.c | 3 +-- include/my_global.h | 13 +++++++++++++ libmysql/libmysql.c | 3 +-- myisam/ft_boolean_search.c | 4 +--- myisam/mi_check.c | 18 +++++++----------- myisam/mi_create.c | 2 +- myisam/mi_delete.c | 2 +- myisam/mi_dynrec.c | 9 +++------ myisam/mi_open.c | 2 +- myisam/mi_packrec.c | 2 +- myisam/mi_search.c | 5 ++--- myisam/mi_update.c | 5 +---- myisam/sort.c | 4 ++-- myisammrg/myrg_open.c | 4 +--- myisammrg/myrg_rkey.c | 9 +++------ mysys/mf_pack.c | 3 +-- mysys/my_copy.c | 5 +++-- mysys/my_getopt.c | 2 +- mysys/my_redel.c | 3 ++- mysys/typelib.c | 4 ++-- regex/regcomp.c | 6 +++--- sql-common/client.c | 5 ++--- sql-common/my_time.c | 3 +-- sql/field.cc | 19 ++++++------------- sql/ha_myisammrg.cc | 2 +- sql/item.cc | 7 ++----- sql/item_cmpfunc.cc | 17 +++++------------ sql/item_create.cc | 6 ++++-- sql/item_func.cc | 12 ++++-------- sql/lock.cc | 3 +-- sql/log.cc | 3 ++- sql/opt_range.cc | 8 ++++---- sql/spatial.cc | 13 +++---------- sql/sql_acl.cc | 10 +++------- sql/sql_base.cc | 6 ++---- sql/sql_parse.cc | 4 ++-- sql/sql_prepare.cc | 3 +-- sql/sql_show.cc | 7 ++----- sql/sql_update.cc | 4 +--- sql/sql_view.cc | 3 +-- strings/ctype-ucs2.c | 9 +++------ strings/ctype-utf8.c | 6 ++---- strings/decimal.c | 13 ++++--------- 51 files changed, 142 insertions(+), 191 deletions(-) diff --git a/client/mysql.cc b/client/mysql.cc index 0d61ed4ec88..d103a3eec17 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -3728,7 +3728,8 @@ com_edit(String *buffer,char *line __attribute__((unused))) !(editor = (char *)getenv("VISUAL"))) editor = "vi"; strxmov(buff,editor," ",filename,NullS); - (void) system(buff); + if(system(buff) == -1) + goto err; MY_STAT stat_arg; if (!my_stat(filename,&stat_arg,MYF(MY_WME))) diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c index ff414fff592..efa23610574 100644 --- a/client/mysql_upgrade.c +++ b/client/mysql_upgrade.c @@ -526,6 +526,7 @@ static int upgrade_already_done(void) FILE *in; char upgrade_info_file[FN_REFLEN]= {0}; char buf[sizeof(MYSQL_SERVER_VERSION)+1]; + char *res; if (get_upgrade_info_file_name(upgrade_info_file)) return 0; /* Could not get filename => not sure */ @@ -538,7 +539,7 @@ static int upgrade_already_done(void) will be detected by the strncmp */ bzero(buf, sizeof(buf)); - fgets(buf, sizeof(buf), in); + res= fgets(buf, sizeof(buf), in); my_fclose(in, MYF(0)); diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc index 24b95be8626..699c2081b86 100644 --- a/client/mysqladmin.cc +++ b/client/mysqladmin.cc @@ -1050,14 +1050,16 @@ static void usage(void) static int drop_db(MYSQL *mysql, const char *db) { char name_buff[FN_REFLEN+20], buf[10]; + char *input; + if (!option_force) { puts("Dropping the database is potentially a very bad thing to do."); puts("Any data stored in the database will be destroyed.\n"); printf("Do you really want to drop the '%s' database [y/N] ",db); fflush(stdout); - VOID(fgets(buf,sizeof(buf)-1,stdin)); - if ((*buf != 'y') && (*buf != 'Y')) + input= fgets(buf, sizeof(buf)-1, stdin); + if (!input || ((*input != 'y') && (*input != 'Y'))) { puts("\nOK, aborting database drop!"); return -1; diff --git a/client/mysqlmanager-pwgen.c b/client/mysqlmanager-pwgen.c index 568358b1cda..1be4d8b6970 100644 --- a/client/mysqlmanager-pwgen.c +++ b/client/mysqlmanager-pwgen.c @@ -104,29 +104,34 @@ void get_pass(char* pw, int len) { FILE* fp; char* pw_end=pw+len; + size_t elements_read= 0; /* /dev/random is more secure than rand() because the seed is easy to predict, so we resort to rand() only if /dev/random is not available */ if ((fp=fopen("/dev/random","r"))) { - fread(pw,len,1,fp); - fclose(fp); - while (pwmysql; for (;;) { - MYSQL_RES *res; + MYSQL_RES *UNINIT_VAR(res); MYSQL_ROW row; int done; - LINT_INIT(res); if (mysql_query(mysql,"show status like 'Slave_running'") || !(res=mysql_store_result(mysql))) @@ -4710,13 +4711,12 @@ my_bool end_of_query(int c) int read_line(char *buf, int size) { - char c, last_quote; + char c, UNINIT_VAR(last_quote); char *p= buf, *buf_end= buf + size - 1; int skip_char= 0; enum {R_NORMAL, R_Q, R_SLASH_IN_Q, R_COMMENT, R_LINE_START} state= R_LINE_START; DBUG_ENTER("read_line"); - LINT_INIT(last_quote); start_lineno= cur_file->lineno; DBUG_PRINT("info", ("Starting to read at lineno: %d", start_lineno)); @@ -5978,8 +5978,7 @@ void run_query_normal(struct st_connection *cn, struct st_command *command, if (!disable_result_log) { - ulonglong affected_rows; /* Ok to be undef if 'disable_info' is set */ - LINT_INIT(affected_rows); + ulonglong UNINIT_VAR(affected_rows); /* Ok to be undef if 'disable_info' is set */ if (res) { diff --git a/cmd-line-utils/readline/bind.c b/cmd-line-utils/readline/bind.c index aa5bd3d829a..85f6b432bf8 100644 --- a/cmd-line-utils/readline/bind.c +++ b/cmd-line-utils/readline/bind.c @@ -339,9 +339,7 @@ rl_generic_bind (type, keyseq, data, map) char *keys; int keys_len; register int i; - KEYMAP_ENTRY k; - - k.function = 0; + KEYMAP_ENTRY k= { 0, NULL }; /* If no keys to bind to, exit right away. */ if (keyseq == 0 || *keyseq == 0) @@ -776,7 +774,7 @@ _rl_read_file (filename, sizep) file_size = (size_t)finfo.st_size; /* check for overflow on very large files */ -if ((sizeof(off_t) > sizeof(size_t) && finfo.st_size > (off_t)(size_t)~0) || + if ((sizeof(off_t) > sizeof(size_t) && finfo.st_size > (off_t)(size_t)~0) || file_size + 1 < file_size) { if (file >= 0) diff --git a/cmd-line-utils/readline/histfile.c b/cmd-line-utils/readline/histfile.c index 118c5ebd328..cbd367542ce 100644 --- a/cmd-line-utils/readline/histfile.c +++ b/cmd-line-utils/readline/histfile.c @@ -186,7 +186,7 @@ read_history_range (filename, from, to) file_size = (size_t)finfo.st_size; /* check for overflow on very large files */ -if ((sizeof(off_t) > sizeof(size_t) && finfo.st_size > (off_t)(size_t)~0) || + if ((sizeof(off_t) > sizeof(size_t) && finfo.st_size > (off_t)(size_t)~0) || file_size + 1 < file_size) { errno = overflow_errno; @@ -311,6 +311,7 @@ history_truncate_file (fname, lines) int file, chars_read, rv; struct stat finfo; size_t file_size; + size_t bytes_written; buffer = (char *)NULL; filename = history_filename (fname); @@ -340,7 +341,7 @@ history_truncate_file (fname, lines) file_size = (size_t)finfo.st_size; /* check for overflow on very large files */ -if ((sizeof(off_t) > sizeof(size_t) && finfo.st_size > (off_t)(size_t)~0) || + if ((sizeof(off_t) > sizeof(size_t) && finfo.st_size > (off_t)(size_t)~0) || file_size + 1 < file_size) { close (file); @@ -400,7 +401,7 @@ if ((sizeof(off_t) > sizeof(size_t) && finfo.st_size > (off_t)(size_t)~0) || truncate to. */ if (bp > buffer && ((file = open (filename, O_WRONLY|O_TRUNC|O_BINARY, 0600)) != -1)) { - write (file, bp, chars_read - (bp - buffer)); + bytes_written= write (file, bp, chars_read - (bp - buffer)); #if defined (__BEOS__) /* BeOS ignores O_TRUNC. */ diff --git a/cmd-line-utils/readline/undo.c b/cmd-line-utils/readline/undo.c index 79846c26024..c6bd044c3a3 100644 --- a/cmd-line-utils/readline/undo.c +++ b/cmd-line-utils/readline/undo.c @@ -137,7 +137,8 @@ UNDO_LIST * _rl_copy_undo_list (head) UNDO_LIST *head; { - UNDO_LIST *list, *new, *roving, *c; + UNDO_LIST *list, *new, *c; + UNDO_LIST *roving= NULL; list = head; new = 0; diff --git a/heap/hp_test2.c b/heap/hp_test2.c index 73cad6c2043..dc4ad316d24 100644 --- a/heap/hp_test2.c +++ b/heap/hp_test2.c @@ -61,11 +61,10 @@ int main(int argc, char *argv[]) HP_INFO *file,*file2; HP_KEYDEF keyinfo[MAX_KEYS]; HA_KEYSEG keyseg[MAX_KEYS*5]; - HEAP_PTR position; + HEAP_PTR UNINIT_VAR(position); HP_CREATE_INFO hp_create_info; CHARSET_INFO *cs= &my_charset_latin1; MY_INIT(argv[0]); /* init my_sys library & pthreads */ - LINT_INIT(position); filename= "test2"; filename2= "test2_2"; diff --git a/include/my_global.h b/include/my_global.h index 5c07aa00b32..0b5458215c6 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -464,6 +464,19 @@ int __void__; #define PURIFY_OR_LINT_INIT(var) #endif +/* + Suppress uninitialized variable warning without generating code. + + The _cplusplus is a temporary workaround for C++ code pending a fix + for a g++ bug (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34772). +*/ +#if defined(_lint) || defined(FORCE_INIT_OF_VARS) || defined(__cplusplus) || \ + !defined(__GNUC__) +#define UNINIT_VAR(x) x= 0 +#else +#define UNINIT_VAR(x) x= x +#endif + /* Define some useful general macros */ #if !defined(max) #define max(a, b) ((a) > (b) ? (a) : (b)) diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index d18ed04e273..1fa3181b1be 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -1619,8 +1619,7 @@ myodbc_remove_escape(MYSQL *mysql,char *name) char *to; #ifdef USE_MB my_bool use_mb_flag=use_mb(mysql->charset); - char *end; - LINT_INIT(end); + char *UNINIT_VAR(end); if (use_mb_flag) for (end=name; *end ; end++) ; #endif diff --git a/myisam/ft_boolean_search.c b/myisam/ft_boolean_search.c index 255c51fd33a..50f2cd52b3d 100644 --- a/myisam/ft_boolean_search.c +++ b/myisam/ft_boolean_search.c @@ -218,11 +218,9 @@ static int _ft2_search(FTB *ftb, FTB_WORD *ftbw, my_bool init_search) int subkeys=1; my_bool can_go_down; MI_INFO *info=ftb->info; - uint off, extra=HA_FT_WLEN+info->s->base.rec_reflength; + uint UNINIT_VAR(off), extra=HA_FT_WLEN+info->s->base.rec_reflength; byte *lastkey_buf=ftbw->word+ftbw->off; - LINT_INIT(off); - LINT_INIT(off); if (ftbw->flags & FTB_FLAG_TRUNC) lastkey_buf+=ftbw->len; diff --git a/myisam/mi_check.c b/myisam/mi_check.c index 285a31d34c6..80a90977609 100644 --- a/myisam/mi_check.c +++ b/myisam/mi_check.c @@ -140,11 +140,10 @@ int chk_del(MI_CHECK *param, register MI_INFO *info, uint test_flag) { reg2 ha_rows i; uint delete_link_length; - my_off_t empty,next_link,old_link; + my_off_t empty,next_link,UNINIT_VAR(old_link); char buff[22],buff2[22]; DBUG_ENTER("chk_del"); - LINT_INIT(old_link); param->record_checksum=0; delete_link_length=((info->s->options & HA_OPTION_PACK_RECORD) ? 20 : info->s->rec_reflength+1); @@ -936,11 +935,11 @@ static uint isam_key_length(MI_INFO *info, register MI_KEYDEF *keyinfo) int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend) { int error,got_error,flag; - uint key,left_length,b_type,field; + uint key,UNINIT_VAR(left_length),b_type,field; ha_rows records,del_blocks; - my_off_t used,empty,pos,splits,start_recpos, + my_off_t used,empty,pos,splits,UNINIT_VAR(start_recpos), del_length,link_used,start_block; - byte *record= 0, *to; + byte *record= 0, *UNINIT_VAR(to); char llbuff[22],llbuff2[22],llbuff3[22]; ha_checksum intern_record_checksum; ha_checksum key_checksum[MI_MAX_POSSIBLE_KEY]; @@ -965,7 +964,6 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend) records=del_blocks=0; used=link_used=splits=del_length=0; intern_record_checksum=param->glob_crc=0; - LINT_INIT(left_length); LINT_INIT(start_recpos); LINT_INIT(to); got_error=error=0; empty=info->s->pack.header_length; @@ -2222,9 +2220,8 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info, ulong *rec_per_key_part; char llbuff[22]; SORT_INFO sort_info; - ulonglong key_map; + ulonglong UNINIT_VAR(key_map); DBUG_ENTER("mi_repair_by_sort"); - LINT_INIT(key_map); start_records=info->state->records; got_error=1; @@ -2620,11 +2617,10 @@ int mi_repair_parallel(MI_CHECK *param, register MI_INFO *info, IO_CACHE new_data_cache; /* For non-quick repair. */ IO_CACHE_SHARE io_share; SORT_INFO sort_info; - ulonglong key_map; + ulonglong UNINIT_VAR(key_map); pthread_attr_t thr_attr; ulong max_pack_reclength; DBUG_ENTER("mi_repair_parallel"); - LINT_INIT(key_map); start_records=info->state->records; got_error=1; @@ -3206,7 +3202,7 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param) int parallel_flag; uint found_record,b_type,left_length; my_off_t pos; - byte *to; + byte *UNINIT_VAR(to); MI_BLOCK_INFO block_info; SORT_INFO *sort_info=sort_param->sort_info; MI_CHECK *param=sort_info->param; diff --git a/myisam/mi_create.c b/myisam/mi_create.c index bb53393c345..43639409014 100644 --- a/myisam/mi_create.c +++ b/myisam/mi_create.c @@ -37,7 +37,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs, MI_CREATE_INFO *ci,uint flags) { register uint i,j; - File dfile,file; + File UNINIT_VAR(dfile),file; int errpos,save_errno, create_mode= O_RDWR | O_TRUNC; myf create_flag; uint fields,length,max_key_length,packed,pointer,real_length_diff, diff --git a/myisam/mi_delete.c b/myisam/mi_delete.c index e08e5097e33..327a977dcca 100644 --- a/myisam/mi_delete.c +++ b/myisam/mi_delete.c @@ -220,7 +220,7 @@ static int d_search(register MI_INFO *info, register MI_KEYDEF *keyinfo, uint length,nod_flag,search_key_length; my_bool last_key; uchar *leaf_buff,*keypos; - my_off_t leaf_page,next_block; + my_off_t UNINIT_VAR(leaf_page),next_block; uchar lastkey[MI_MAX_KEY_BUFF]; DBUG_ENTER("d_search"); DBUG_DUMP("page",(uchar*) anc_buff,mi_getint(anc_buff)); diff --git a/myisam/mi_dynrec.c b/myisam/mi_dynrec.c index 3542a82be59..af911428d11 100644 --- a/myisam/mi_dynrec.c +++ b/myisam/mi_dynrec.c @@ -1234,16 +1234,14 @@ void _my_store_blob_length(byte *pos,uint pack_length,uint length) int _mi_read_dynamic_record(MI_INFO *info, my_off_t filepos, byte *buf) { int block_of_record; - uint b_type,left_length; - byte *to; + uint b_type,UNINIT_VAR(left_length); + byte *UNINIT_VAR(to); MI_BLOCK_INFO block_info; File file; DBUG_ENTER("mi_read_dynamic_record"); if (filepos != HA_OFFSET_ERROR) { - LINT_INIT(to); - LINT_INIT(left_length); file=info->dfile; block_of_record= 0; /* First block of record is numbered as zero. */ block_info.second_read= 0; @@ -1506,13 +1504,12 @@ int _mi_read_rnd_dynamic_record(MI_INFO *info, byte *buf, { int block_of_record, info_read, save_errno; uint left_len,b_type; - byte *to; + byte *UNINIT_VAR(to); MI_BLOCK_INFO block_info; MYISAM_SHARE *share=info->s; DBUG_ENTER("_mi_read_rnd_dynamic_record"); info_read=0; - LINT_INIT(to); if (info->lock_type == F_UNLCK) { diff --git a/myisam/mi_open.c b/myisam/mi_open.c index d9b7f6453db..285e295d999 100644 --- a/myisam/mi_open.c +++ b/myisam/mi_open.c @@ -678,7 +678,7 @@ err: byte *mi_alloc_rec_buff(MI_INFO *info, ulong length, byte **buf) { uint extra; - uint32 old_length; + uint32 UNINIT_VAR(old_length); LINT_INIT(old_length); if (! *buf || length > (old_length=mi_get_rec_buff_len(info, *buf))) diff --git a/myisam/mi_packrec.c b/myisam/mi_packrec.c index 68911d7f129..75cf45d5434 100644 --- a/myisam/mi_packrec.c +++ b/myisam/mi_packrec.c @@ -1362,7 +1362,7 @@ uint _mi_pack_get_block_info(MI_INFO *myisam, MI_BIT_BUFF *bit_buff, File file, my_off_t filepos) { uchar *header=info->header; - uint head_length,ref_length; + uint head_length, UNINIT_VAR(ref_length); LINT_INIT(ref_length); if (file >= 0) diff --git a/myisam/mi_search.c b/myisam/mi_search.c index 795c7ee55c3..3b1cd6158f2 100644 --- a/myisam/mi_search.c +++ b/myisam/mi_search.c @@ -240,12 +240,11 @@ int _mi_seq_search(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page, uchar *key, uint key_len, uint comp_flag, uchar **ret_pos, uchar *buff, my_bool *last_key) { - int flag; - uint nod_flag,length,not_used[2]; + int UNINIT_VAR(flag); + uint nod_flag,UNINIT_VAR(length),not_used[2]; uchar t_buff[MI_MAX_KEY_BUFF],*end; DBUG_ENTER("_mi_seq_search"); - LINT_INIT(flag); LINT_INIT(length); end= page+mi_getint(page); nod_flag=mi_test_if_nod(page); page+=2+nod_flag; diff --git a/myisam/mi_update.c b/myisam/mi_update.c index bea457d2e9a..fa0797b1d61 100644 --- a/myisam/mi_update.c +++ b/myisam/mi_update.c @@ -27,11 +27,8 @@ int mi_update(register MI_INFO *info, const byte *oldrec, byte *newrec) bool auto_key_changed=0; ulonglong changed; MYISAM_SHARE *share=info->s; - ha_checksum old_checksum; + ha_checksum UNINIT_VAR(old_checksum); DBUG_ENTER("mi_update"); - LINT_INIT(new_key); - LINT_INIT(changed); - LINT_INIT(old_checksum); DBUG_EXECUTE_IF("myisam_pretend_crashed_table_on_usage", mi_print_error(info->s, HA_ERR_CRASHED); diff --git a/myisam/sort.c b/myisam/sort.c index 2465227a449..f418be6a72d 100644 --- a/myisam/sort.c +++ b/myisam/sort.c @@ -489,7 +489,7 @@ int thr_write_keys(MI_SORT_PARAM *sort_param) { SORT_INFO *sort_info=sort_param->sort_info; MI_CHECK *param=sort_info->param; - ulong length, keys; + ulong UNINIT_VAR(length), keys; ulong *rec_per_key_part=param->rec_per_key_part; int got_error=sort_info->got_error; uint i; @@ -896,7 +896,7 @@ merge_buffers(MI_SORT_PARAM *info, uint keys, IO_CACHE *from_file, int error; uint sort_length,maxcount; ha_rows count; - my_off_t to_start_filepos; + my_off_t UNINIT_VAR(to_start_filepos); uchar *strpos; BUFFPEK *buffpek,**refpek; QUEUE queue; diff --git a/myisammrg/myrg_open.c b/myisammrg/myrg_open.c index 4e61f42efce..8cccb81f6c7 100644 --- a/myisammrg/myrg_open.c +++ b/myisammrg/myrg_open.c @@ -32,7 +32,7 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking) { int save_errno,errpos=0; - uint files= 0, i, dir_length, length, key_parts, min_keys= 0; + uint files= 0, i, dir_length, length, UNINIT_VAR(key_parts), min_keys= 0; ulonglong file_offset=0; char name_buff[FN_REFLEN*2],buff[FN_REFLEN],*end; MYRG_INFO *m_info=0; @@ -43,8 +43,6 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking) my_bool bad_children= FALSE; DBUG_ENTER("myrg_open"); - LINT_INIT(key_parts); - bzero((char*) &file,sizeof(file)); if ((fd=my_open(fn_format(name_buff,name,"",MYRG_NAME_EXT,4), O_RDONLY | O_SHARE,MYF(0))) < 0) diff --git a/myisammrg/myrg_rkey.c b/myisammrg/myrg_rkey.c index 627839331c6..2b8091cb43a 100644 --- a/myisammrg/myrg_rkey.c +++ b/myisammrg/myrg_rkey.c @@ -38,16 +38,13 @@ int myrg_rkey(MYRG_INFO *info,byte *buf,int inx, const byte *key, uint key_len, enum ha_rkey_function search_flag) { - byte *key_buff; - uint pack_key_length; - uint16 last_used_keyseg; + byte *UNINIT_VAR(key_buff); + uint UNINIT_VAR(pack_key_length); + uint16 UNINIT_VAR(last_used_keyseg); MYRG_TABLE *table; MI_INFO *mi; int err; DBUG_ENTER("myrg_rkey"); - LINT_INIT(key_buff); - LINT_INIT(pack_key_length); - LINT_INIT(last_used_keyseg); if (_myrg_init_queue(info,inx,search_flag)) DBUG_RETURN(my_errno); diff --git a/mysys/mf_pack.c b/mysys/mf_pack.c index 0157a65311a..d2bac95b391 100644 --- a/mysys/mf_pack.c +++ b/mysys/mf_pack.c @@ -33,12 +33,11 @@ static my_string NEAR_F expand_tilde(my_string *path); void pack_dirname(my_string to, const char *from) { int cwd_err; - uint d_length,length,buff_length; + uint d_length,length,UNINIT_VAR(buff_length); my_string start; char buff[FN_REFLEN]; DBUG_ENTER("pack_dirname"); - LINT_INIT(buff_length); (void) intern_filename(to,from); /* Change to intern name */ #ifdef FN_DEVCHAR diff --git a/mysys/my_copy.c b/mysys/my_copy.c index ec642b4083c..b6bb925e898 100644 --- a/mysys/my_copy.c +++ b/mysys/my_copy.c @@ -57,6 +57,7 @@ int my_copy(const char *from, const char *to, myf MyFlags) File from_file,to_file; char buff[IO_SIZE]; MY_STAT stat_buff,new_stat_buff; + int res; DBUG_ENTER("my_copy"); DBUG_PRINT("my",("from %s to %s MyFlags %d", from, to, MyFlags)); @@ -93,9 +94,9 @@ int my_copy(const char *from, const char *to, myf MyFlags) if (MyFlags & MY_HOLD_ORIGINAL_MODES && !new_file_stat) DBUG_RETURN(0); /* File copyed but not stat */ - VOID(chmod(to, stat_buff.st_mode & 07777)); /* Copy modes */ + res= chmod(to, stat_buff.st_mode & 07777); /* Copy modes */ #if !defined(MSDOS) && !defined(__WIN__) && !defined(__EMX__) && !defined(OS2) && !defined(__NETWARE__) - VOID(chown(to, stat_buff.st_uid,stat_buff.st_gid)); /* Copy ownership */ + res= chown(to, stat_buff.st_uid,stat_buff.st_gid); /* Copy ownership */ #endif #if !defined(VMS) && !defined(__ZTC__) if (MyFlags & MY_COPYTIME) diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c index 3bb500616a1..22b404bdd25 100644 --- a/mysys/my_getopt.c +++ b/mysys/my_getopt.c @@ -100,7 +100,7 @@ int handle_options(int *argc, char ***argv, uint opt_found, argvpos= 0, length, i; my_bool end_of_options= 0, must_be_var, set_maximum_value, option_is_loose; - char **pos, **pos_end, *optend, *prev_found, + char **pos, **pos_end, *optend, *UNINIT_VAR(prev_found), *opt_str, key_name[FN_REFLEN]; const struct my_option *optp; gptr *value; diff --git a/mysys/my_redel.c b/mysys/my_redel.c index 0aec395cf65..03c1021a954 100644 --- a/mysys/my_redel.c +++ b/mysys/my_redel.c @@ -77,6 +77,7 @@ end: int my_copystat(const char *from, const char *to, int MyFlags) { struct stat statbuf; + int res; if (stat((char*) from, &statbuf)) { @@ -95,7 +96,7 @@ int my_copystat(const char *from, const char *to, int MyFlags) if (MyFlags & MY_LINK_WARNING) my_error(EE_LINK_WARNING,MYF(ME_BELL+ME_WAITTANG),from,statbuf.st_nlink); } - VOID(chown(to, statbuf.st_uid, statbuf.st_gid)); /* Copy ownership */ + res= chown(to, statbuf.st_uid, statbuf.st_gid); /* Copy ownership */ #endif /* MSDOS */ #ifndef VMS diff --git a/mysys/typelib.c b/mysys/typelib.c index 4fab6f20493..7416738ece7 100644 --- a/mysys/typelib.c +++ b/mysys/typelib.c @@ -44,7 +44,8 @@ int find_type(my_string x, TYPELIB *typelib, uint full_name) { - int find,pos,findpos; + int find,pos; + int UNINIT_VAR(findpos); /* guarded by find */ reg1 my_string i; reg2 const char *j; DBUG_ENTER("find_type"); @@ -55,7 +56,6 @@ int find_type(my_string x, TYPELIB *typelib, uint full_name) DBUG_PRINT("exit",("no count")); DBUG_RETURN(0); } - LINT_INIT(findpos); find=0; for (pos=0 ; (j=typelib->type_names[pos]) ; pos++) { diff --git a/regex/regcomp.c b/regex/regcomp.c index 9cba56a97dd..0a65c5021fb 100644 --- a/regex/regcomp.c +++ b/regex/regcomp.c @@ -213,11 +213,11 @@ register struct parse *p; int stop; /* character this ERE should end at */ { register char c; - register sopno prevback; - register sopno prevfwd; + register sopno UNINIT_VAR(prevback); + register sopno UNINIT_VAR(prevfwd); register sopno conc; register int first = 1; /* is this the first alternative? */ - LINT_INIT(prevback); LINT_INIT(prevfwd); + for (;;) { /* do a bunch of concatenated expressions */ conc = HERE(); diff --git a/sql-common/client.c b/sql-common/client.c index 0cd7ef78478..8f1f4a1fd5a 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -1633,7 +1633,7 @@ mysql_ssl_free(MYSQL *mysql __attribute__((unused))) */ const char * STDCALL -mysql_get_ssl_cipher(MYSQL *mysql) +mysql_get_ssl_cipher(MYSQL *mysql __attribute__((unused))) { DBUG_ENTER("mysql_get_ssl_cipher"); #ifdef HAVE_OPENSSL @@ -1829,7 +1829,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, uint port, const char *unix_socket,ulong client_flag) { char buff[NAME_LEN+USERNAME_LENGTH+100]; - char *end,*host_info; + char *end,*host_info= NULL; my_socket sock; in_addr_t ip_addr; struct sockaddr_in sock_addr; @@ -1847,7 +1847,6 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, #endif init_sigpipe_variables DBUG_ENTER("mysql_real_connect"); - LINT_INIT(host_info); DBUG_PRINT("enter",("host: %s db: %s user: %s", host ? host : "(Null)", diff --git a/sql-common/my_time.c b/sql-common/my_time.c index 16a64ebd947..d2ef9da25f5 100644 --- a/sql-common/my_time.c +++ b/sql-common/my_time.c @@ -160,7 +160,7 @@ enum enum_mysql_timestamp_type str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time, uint flags, int *was_cut) { - uint field_length, year_length, digits, i, number_of_fields; + uint field_length, UNINIT_VAR(year_length), digits, i, number_of_fields; uint date[MAX_DATE_PARTS], date_len[MAX_DATE_PARTS]; uint add_hours= 0, start_loop; ulong not_zero_date, allow_space; @@ -174,7 +174,6 @@ str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time, DBUG_PRINT("ENTER",("str: %.*s",length,str)); LINT_INIT(field_length); - LINT_INIT(year_length); LINT_INIT(last_field_pos); *was_cut= 0; diff --git a/sql/field.cc b/sql/field.cc index 2322c5d7b9d..b61e5fd2d79 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -1736,16 +1736,16 @@ int Field_decimal::store(const char *from, uint len, CHARSET_INFO *cs) Pointers used when digits move from the left of the '.' to the right of the '.' (explained below) */ - const char *int_digits_tail_from; + const char *UNINIT_VAR(int_digits_tail_from); /* Number of 0 that need to be added at the left of the '.' (1E3: 3 zeros) */ - uint int_digits_added_zeros; + uint UNINIT_VAR(int_digits_added_zeros); /* Pointer used when digits move from the right of the '.' to the left of the '.' */ - const char *frac_digits_head_end; + const char *UNINIT_VAR(frac_digits_head_end); /* Number of 0 that need to be added at the right of the '.' (for 1E-3) */ - uint frac_digits_added_zeros; + uint UNINIT_VAR(frac_digits_added_zeros); char *pos,*tmp_left_pos,*tmp_right_pos; /* Pointers that are used as limits (begin and end of the field buffer) */ char *left_wall,*right_wall; @@ -1756,11 +1756,6 @@ int Field_decimal::store(const char *from, uint len, CHARSET_INFO *cs) */ bool is_cuted_fields_incr=0; - LINT_INIT(int_digits_tail_from); - LINT_INIT(int_digits_added_zeros); - LINT_INIT(frac_digits_head_end); - LINT_INIT(frac_digits_added_zeros); - /* There are three steps in this function : - parse the input string @@ -8854,10 +8849,8 @@ Field *make_field(char *ptr, uint32 field_length, const char *field_name, struct st_table *table) { - uchar *bit_ptr; - uchar bit_offset; - LINT_INIT(bit_ptr); - LINT_INIT(bit_offset); + uchar *UNINIT_VAR(bit_ptr); + uchar UNINIT_VAR(bit_offset); if (field_type == FIELD_TYPE_BIT && !f_bit_as_char(pack_flag)) { bit_ptr= null_pos; diff --git a/sql/ha_myisammrg.cc b/sql/ha_myisammrg.cc index fef2e21d271..7983ffbc6c8 100644 --- a/sql/ha_myisammrg.cc +++ b/sql/ha_myisammrg.cc @@ -78,7 +78,7 @@ static void split_file_name(const char *file_name, extern "C" void myrg_print_wrong_table(const char *table_name) { - LEX_STRING db, name; + LEX_STRING db= {NULL, 0}, name; char buf[FN_REFLEN]; split_file_name(table_name, &db, &name); memcpy(buf, db.str, db.length); diff --git a/sql/item.cc b/sql/item.cc index eecb48aa16f..03d752a85d9 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -1635,7 +1635,7 @@ bool agg_item_collations_for_comparison(DTCollation &c, const char *fname, bool agg_item_set_converter(DTCollation &coll, const char *fname, Item **args, uint nargs, uint flags, int item_sep) { - Item **arg, *safe_args[2]; + Item **arg, *safe_args[2]= {NULL, NULL}; /* For better error reporting: save the first and the second argument. @@ -1644,8 +1644,6 @@ bool agg_item_set_converter(DTCollation &coll, const char *fname, doesn't display each argument's characteristics. - if nargs is 1, then this error cannot happen. */ - LINT_INIT(safe_args[0]); - LINT_INIT(safe_args[1]); if (nargs >=2 && nargs <= 3) { safe_args[0]= args[0]; @@ -5122,9 +5120,8 @@ bool Item_null::send(Protocol *protocol, String *packet) bool Item::send(Protocol *protocol, String *buffer) { - bool result; + bool UNINIT_VAR(result); // Will be set if null_value == 0 enum_field_types f_type; - LINT_INIT(result); // Will be set if null_value == 0 switch ((f_type=field_type())) { default: diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index c940c4ab3c0..8c655cdc369 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -352,8 +352,7 @@ static bool convert_constant_item(THD *thd, Item_field *field_item, /* For comparison purposes allow invalid dates like 2000-01-32 */ ulong orig_sql_mode= thd->variables.sql_mode; enum_check_fields orig_count_cuted_fields= thd->count_cuted_fields; - ulonglong orig_field_val; /* original field value if valid */ - LINT_INIT(orig_field_val); + ulonglong UNINIT_VAR(orig_field_val); /* original field value if valid */ thd->variables.sql_mode= (orig_sql_mode & ~MODE_NO_ZERO_DATE) | MODE_INVALID_DATES; thd->count_cuted_fields= CHECK_FIELD_IGNORE; @@ -2453,19 +2452,13 @@ Item_func_nullif::is_null() Item *Item_func_case::find_item(String *str) { - String *first_expr_str, *tmp; - my_decimal *first_expr_dec, first_expr_dec_val; - longlong first_expr_int; - double first_expr_real; + String *UNINIT_VAR(first_expr_str), *tmp; + my_decimal *UNINIT_VAR(first_expr_dec), first_expr_dec_val; + longlong UNINIT_VAR(first_expr_int); + double UNINIT_VAR(first_expr_real); char buff[MAX_FIELD_WIDTH]; String buff_str(buff,sizeof(buff),default_charset()); - /* These will be initialized later */ - LINT_INIT(first_expr_str); - LINT_INIT(first_expr_int); - LINT_INIT(first_expr_real); - LINT_INIT(first_expr_dec); - if (first_expr_num != -1) { switch (cmp_type) diff --git a/sql/item_create.cc b/sql/item_create.cc index c897b7aef79..cbd015f300b 100644 --- a/sql/item_create.cc +++ b/sql/item_create.cc @@ -451,10 +451,9 @@ Item *create_func_cast(Item *a, Cast_target cast_type, const char *c_len, const char *c_dec, CHARSET_INFO *cs) { - Item *res; + Item *UNINIT_VAR(res); ulong len; uint dec; - LINT_INIT(res); switch (cast_type) { case ITEM_CAST_BINARY: res= new Item_func_binary(a); break; @@ -542,6 +541,9 @@ Item *create_func_cast(Item *a, Cast_target cast_type, res= new Item_char_typecast(a, len, cs ? cs : current_thd->variables.collation_connection); break; + + default: + DBUG_ASSERT(0); } return res; } diff --git a/sql/item_func.cc b/sql/item_func.cc index 6193ab285f2..3c1e2126008 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -2275,9 +2275,8 @@ void Item_func_min_max::fix_length_and_dec() uint Item_func_min_max::cmp_datetimes(ulonglong *value) { - longlong min_max; + longlong UNINIT_VAR(min_max); uint min_max_idx= 0; - LINT_INIT(min_max); for (uint i=0; i < arg_count ; i++) { @@ -2345,8 +2344,7 @@ String *Item_func_min_max::val_str(String *str) } case STRING_RESULT: { - String *res; - LINT_INIT(res); + String *UNINIT_VAR(res); for (uint i=0; i < arg_count ; i++) { if (i == 0) @@ -2435,8 +2433,7 @@ longlong Item_func_min_max::val_int() my_decimal *Item_func_min_max::val_decimal(my_decimal *dec) { DBUG_ASSERT(fixed == 1); - my_decimal tmp_buf, *tmp, *res; - LINT_INIT(res); + my_decimal tmp_buf, *tmp, *UNINIT_VAR(res); if (compare_as_dates) { @@ -4974,8 +4971,7 @@ void Item_func_match::init_search(bool no_order) bool Item_func_match::fix_fields(THD *thd, Item **ref) { DBUG_ASSERT(fixed == 0); - Item *item; - LINT_INIT(item); // Safe as arg_count is > 1 + Item *UNINIT_VAR(item); // Safe as arg_count is > 1 maybe_null=1; join_key=0; diff --git a/sql/lock.cc b/sql/lock.cc index 3102497576f..97abd76b7c2 100644 --- a/sql/lock.cc +++ b/sql/lock.cc @@ -1216,11 +1216,10 @@ void unlock_global_read_lock(THD *thd) bool wait_if_global_read_lock(THD *thd, bool abort_on_refresh, bool is_not_commit) { - const char *old_message; + const char *UNINIT_VAR(old_message); bool result= 0, need_exit_cond; DBUG_ENTER("wait_if_global_read_lock"); - LINT_INIT(old_message); /* Assert that we do not own LOCK_open. If we would own it, other threads could not close their tables. This would make a pretty diff --git a/sql/log.cc b/sql/log.cc index ec8f5fe820b..c042651216c 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -2635,9 +2635,10 @@ bool flush_error_log() else result= 1; #else + FILE *reopen; my_rename(log_error_file,err_renamed,MYF(0)); if (freopen(log_error_file,"a+",stdout)) - freopen(log_error_file,"a+",stderr); + reopen= freopen(log_error_file,"a+",stderr); else result= 1; #endif diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 778fc418392..fdf6cc03a44 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -3514,11 +3514,10 @@ static TRP_RANGE *get_key_scans_params(PARAM *param, SEL_TREE *tree, { int idx; SEL_ARG **key,**end, **key_to_read= NULL; - ha_rows best_records; + ha_rows UNINIT_VAR(best_records); /* protected by key_to_read */ TRP_RANGE* read_plan= NULL; bool pk_is_clustered= param->table->file->primary_key_is_clustered(); DBUG_ENTER("get_key_scans_params"); - LINT_INIT(best_records); /* protected by key_to_read */ /* Note that there may be trees that have type SEL_TREE::KEY but contain no key reads at all, e.g. tree for expression "key1 is not null" where key1 @@ -5370,8 +5369,7 @@ static bool eq_tree(SEL_ARG* a,SEL_ARG *b) SEL_ARG * SEL_ARG::insert(SEL_ARG *key) { - SEL_ARG *element,**par,*last_element; - LINT_INIT(par); LINT_INIT(last_element); + SEL_ARG *element,**UNINIT_VAR(par),*UNINIT_VAR(last_element); for (element= this; element != &null_element ; ) { @@ -7918,7 +7916,9 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree) goto next_index; } else + { DBUG_ASSERT(FALSE); + } /* Check (SA2). */ if (min_max_arg_item) diff --git a/sql/spatial.cc b/sql/spatial.cc index 80506f16d0f..6e1da589527 100644 --- a/sql/spatial.cc +++ b/sql/spatial.cc @@ -935,13 +935,10 @@ int Gis_polygon::interior_ring_n(uint32 num, String *result) const int Gis_polygon::centroid_xy(double *x, double *y) const { uint32 n_linear_rings; - double res_area; - double res_cx, res_cy; + double UNINIT_VAR(res_area); + double UNINIT_VAR(res_cx), UNINIT_VAR(res_cy); const char *data= m_data; bool first_loop= 1; - LINT_INIT(res_area); - LINT_INIT(res_cx); - LINT_INIT(res_cy); if (no_data(data, 4)) return 1; @@ -1634,14 +1631,10 @@ int Gis_multi_polygon::centroid(String *result) const uint32 n_polygons; bool first_loop= 1; Gis_polygon p; - double res_area, res_cx, res_cy; + double UNINIT_VAR(res_area), UNINIT_VAR(res_cx), UNINIT_VAR(res_cy); double cur_area, cur_cx, cur_cy; const char *data= m_data; - LINT_INIT(res_area); - LINT_INIT(res_cx); - LINT_INIT(res_cy); - if (no_data(data, 4)) return 1; n_polygons= uint4korr(data); diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index ab4e518d5dd..ea17a4227ef 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -5067,17 +5067,13 @@ static int handle_grant_struct(uint struct_no, bool drop, uint elements; const char *user; const char *host; - ACL_USER *acl_user; - ACL_DB *acl_db; - GRANT_NAME *grant_name; + ACL_USER *UNINIT_VAR(acl_user); + ACL_DB *UNINIT_VAR(acl_db); + GRANT_NAME *UNINIT_VAR(grant_name); DBUG_ENTER("handle_grant_struct"); DBUG_PRINT("info",("scan struct: %u search: '%s'@'%s'", struct_no, user_from->user.str, user_from->host.str)); - LINT_INIT(acl_user); - LINT_INIT(acl_db); - LINT_INIT(grant_name); - safe_mutex_assert_owner(&acl_cache->lock); /* Get the number of elements in the in-memory structure. */ diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 6a99d5d1541..db4ab29d6de 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -706,7 +706,7 @@ void close_temporary_tables(THD *thd) return; } - TABLE *next, + TABLE *UNINIT_VAR(next), *prev_table /* prev link is not maintained in TABLE's double-linked list */; bool was_quote_show= true; /* to assume thd->options has OPTION_QUOTE_SHOW_CREATE */ // Better add "if exists", in case a RESET MASTER has been done @@ -716,7 +716,6 @@ void close_temporary_tables(THD *thd) memcpy(buf, stub, stub_len); String s_query= String(buf, sizeof(buf), system_charset_info); bool found_user_tables= false; - LINT_INIT(next); /* insertion sort of temp tables by pseudo_thread_id to build ordered list @@ -4142,8 +4141,7 @@ find_item_in_list(Item *find, List &items, uint *counter, (and not an item that happens to have a name). */ bool is_ref_by_name= 0; - uint unaliased_counter; - LINT_INIT(unaliased_counter); // Dependent on found_unaliased + uint UNINIT_VAR(unaliased_counter); // Dependent on found_unaliased *resolution= NOT_RESOLVED; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 45f70964f50..65b2a9d60b0 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1325,7 +1325,7 @@ pthread_handler_t handle_bootstrap(void *arg) thd->init_for_queries(); while (fgets(buff, thd->net.max_packet, file)) { - char *query; + char *query, *res; ulong length= (ulong) strlen(buff); while (buff[length-1] != '\n' && !feof(file)) { @@ -1340,7 +1340,7 @@ pthread_handler_t handle_bootstrap(void *arg) break; } buff= (char*) thd->net.buff; - fgets(buff + length, thd->net.max_packet - length, file); + res= fgets(buff + length, thd->net.max_packet - length, file); length+= (ulong) strlen(buff + length); } if (thd->is_fatal_error) diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index d14f14b526e..06f77f9689c 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -2072,10 +2072,9 @@ void mysql_sql_stmt_prepare(THD *thd) LEX_STRING *name= &lex->prepared_stmt_name; Prepared_statement *stmt; const char *query; - uint query_len; + uint UNINIT_VAR(query_len); DBUG_ENTER("mysql_sql_stmt_prepare"); DBUG_ASSERT(thd->protocol == &thd->protocol_simple); - LINT_INIT(query_len); if ((stmt= (Prepared_statement*) thd->stmt_map.find_by_name(name))) { diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 9eac750c22e..13045280c5f 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -2172,8 +2172,8 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond) ST_SCHEMA_TABLE *schema_table= tables->schema_table; SELECT_LEX sel; INDEX_FIELD_VALUES idx_field_vals; - char path[FN_REFLEN], *end, *base_name, *orig_base_name, *file_name; - uint len; + char path[FN_REFLEN], *UNINIT_VAR(end), *base_name, *orig_base_name, *file_name; + uint UNINIT_VAR(len); bool with_i_schema; enum enum_schema_tables schema_table_idx; List bases; @@ -2190,9 +2190,6 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond) #endif DBUG_ENTER("get_all_tables"); - LINT_INIT(end); - LINT_INIT(len); - lex->view_prepare_mode= TRUE; lex->reset_n_backup_query_tables_list(&query_tables_list_backup); diff --git a/sql/sql_update.cc b/sql/sql_update.cc index c18c34fc1d1..06d1bcaa8fb 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -125,7 +125,7 @@ int mysql_update(THD *thd, uint want_privilege; #endif uint table_count= 0; - query_id_t query_id=thd->query_id, timestamp_query_id; + query_id_t query_id=thd->query_id, UNINIT_VAR(timestamp_query_id); ha_rows updated, found; key_map old_used_keys; TABLE *table; @@ -137,8 +137,6 @@ int mysql_update(THD *thd, THD::killed_state killed_status= THD::NOT_KILLED; DBUG_ENTER("mysql_update"); - LINT_INIT(timestamp_query_id); - for ( ; ; ) { if (open_tables(thd, &table_list, &table_count, 0)) diff --git a/sql/sql_view.cc b/sql/sql_view.cc index 96077aeeb12..8cf25e9d88c 100644 --- a/sql/sql_view.cc +++ b/sql/sql_view.cc @@ -955,7 +955,7 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table, TABLE_LIST *top_view= table->top_table(); int res; bool result, view_is_mergeable; - TABLE_LIST *view_main_select_tables; + TABLE_LIST *UNINIT_VAR(view_main_select_tables); DBUG_ENTER("mysql_make_view"); DBUG_PRINT("info", ("table: 0x%lx (%s)", (ulong) table, table->table_name)); @@ -1218,7 +1218,6 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table, view_is_mergeable= (table->algorithm != VIEW_ALGORITHM_TMPTABLE && lex->can_be_merged()); - LINT_INIT(view_main_select_tables); if (view_is_mergeable) { diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c index 65e4182d564..6657ef01785 100644 --- a/strings/ctype-ucs2.c +++ b/strings/ctype-ucs2.c @@ -202,11 +202,10 @@ static int my_strnncoll_ucs2(CHARSET_INFO *cs, my_bool t_is_prefix) { int s_res,t_res; - my_wc_t s_wc,t_wc; + my_wc_t UNINIT_VAR(s_wc),t_wc; const uchar *se=s+slen; const uchar *te=t+tlen; MY_UNICASE_INFO **uni_plane= cs->caseinfo; - LINT_INIT(s_wc); while ( s < se && t < te ) { @@ -317,11 +316,10 @@ static int my_strncasecmp_ucs2(CHARSET_INFO *cs, const char *s, const char *t, uint len) { int s_res,t_res; - my_wc_t s_wc,t_wc; + my_wc_t UNINIT_VAR(s_wc),t_wc; const char *se=s+len; const char *te=t+len; MY_UNICASE_INFO **uni_plane= cs->caseinfo; - LINT_INIT(s_wc); while ( s < se && t < te ) { @@ -1385,10 +1383,9 @@ int my_strnncoll_ucs2_bin(CHARSET_INFO *cs, my_bool t_is_prefix) { int s_res,t_res; - my_wc_t s_wc,t_wc; + my_wc_t UNINIT_VAR(s_wc),t_wc; const uchar *se=s+slen; const uchar *te=t+tlen; - LINT_INIT(s_wc); while ( s < se && t < te ) { diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c index 4682868562f..3fcde4aca64 100644 --- a/strings/ctype-utf8.c +++ b/strings/ctype-utf8.c @@ -2306,11 +2306,10 @@ static int my_strnncoll_utf8(CHARSET_INFO *cs, my_bool t_is_prefix) { int s_res,t_res; - my_wc_t s_wc,t_wc; + my_wc_t UNINIT_VAR(s_wc), t_wc; const uchar *se=s+slen; const uchar *te=t+tlen; MY_UNICASE_INFO **uni_plane= cs->caseinfo; - LINT_INIT(s_wc); while ( s < se && t < te ) { @@ -2377,10 +2376,9 @@ static int my_strnncollsp_utf8(CHARSET_INFO *cs, my_bool diff_if_only_endspace_difference) { int s_res, t_res, res; - my_wc_t s_wc,t_wc; + my_wc_t UNINIT_VAR(s_wc),t_wc; const uchar *se= s+slen, *te= t+tlen; MY_UNICASE_INFO **uni_plane= cs->caseinfo; - LINT_INIT(s_wc); #ifndef VARCHAR_WITH_DIFF_ENDSPACE_ARE_DIFFERENT_FOR_UNIQUE diff_if_only_endspace_difference= 0; diff --git a/strings/decimal.c b/strings/decimal.c index c535d0f73dc..7c2c2999fb8 100644 --- a/strings/decimal.c +++ b/strings/decimal.c @@ -1359,8 +1359,7 @@ int bin2decimal(char *from, decimal_t *to, int precision, int scale) if (intg0x) { int i=dig2bytes[intg0x]; - dec1 x; - LINT_INIT(x); + dec1 UNINIT_VAR(x); switch (i) { case 1: x=mi_sint1korr(from); break; @@ -1401,8 +1400,7 @@ int bin2decimal(char *from, decimal_t *to, int precision, int scale) if (frac0x) { int i=dig2bytes[frac0x]; - dec1 x; - LINT_INIT(x); + dec1 UNINIT_VAR(x); switch (i) { case 1: x=mi_sint1korr(from); break; @@ -1480,7 +1478,7 @@ decimal_round(decimal_t *from, decimal_t *to, int scale, decimal_round_mode mode) { int frac0=scale>0 ? ROUND_UP(scale) : scale/DIG_PER_DEC1, - frac1=ROUND_UP(from->frac), round_digit, + frac1=ROUND_UP(from->frac), UNINIT_VAR(round_digit), intg0=ROUND_UP(from->intg), error=E_DEC_OK, len=to->len, intg1=ROUND_UP(from->intg + (((intg0 + frac0)>0) && (from->buf[0] == DIG_MAX))); @@ -1489,7 +1487,6 @@ decimal_round(decimal_t *from, decimal_t *to, int scale, sanity(to); - LINT_INIT(round_digit); switch (mode) { case HALF_UP: case HALF_EVEN: round_digit=5; break; @@ -2117,13 +2114,11 @@ static int do_div_mod(decimal_t *from1, decimal_t *from2, { int frac1=ROUND_UP(from1->frac)*DIG_PER_DEC1, prec1=from1->intg+frac1, frac2=ROUND_UP(from2->frac)*DIG_PER_DEC1, prec2=from2->intg+frac2, - error, i, intg0, frac0, len1, len2, dintg, div_mod=(!mod); + UNINIT_VAR(error), i, intg0, frac0, len1, len2, dintg, div_mod=(!mod); dec1 *buf0, *buf1=from1->buf, *buf2=from2->buf, *tmp1, *start2, *stop2, *stop1, *stop0, norm2, carry, *start1, dcarry; dec2 norm_factor, x, guess, y; - LINT_INIT(error); - if (mod) to=mod; From 2d6c97e0e67b357c75fffa5e95559befafab5c90 Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Fri, 28 Aug 2009 18:49:16 -0300 Subject: [PATCH 15/68] Reduce test case runtime. --- mysql-test/r/lock_multi_bug38499.result | 3 +++ mysql-test/r/lock_multi_bug38691.result | 3 +++ mysql-test/t/lock_multi_bug38499.test | 5 +++++ mysql-test/t/lock_multi_bug38691.test | 5 +++++ 4 files changed, 16 insertions(+) diff --git a/mysql-test/r/lock_multi_bug38499.result b/mysql-test/r/lock_multi_bug38499.result index fd0f2138a8d..9b3f57c8e53 100644 --- a/mysql-test/r/lock_multi_bug38499.result +++ b/mysql-test/r/lock_multi_bug38499.result @@ -1,3 +1,5 @@ +SET @odl_sync_frm = @@global.sync_frm; +SET @@global.sync_frm = OFF; DROP TABLE IF EXISTS t1; CREATE TABLE t1( a INT, b INT ); INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4); @@ -17,3 +19,4 @@ ALTER TABLE t1 ADD COLUMN a INT; # 2.2.1. normal mode # 2.2.2. PS mode DROP TABLE t1; +SET @@global.sync_frm = @odl_sync_frm; diff --git a/mysql-test/r/lock_multi_bug38691.result b/mysql-test/r/lock_multi_bug38691.result index 74b9603d8e3..d0aa1c0277c 100644 --- a/mysql-test/r/lock_multi_bug38691.result +++ b/mysql-test/r/lock_multi_bug38691.result @@ -1,3 +1,5 @@ +SET @odl_sync_frm = @@global.sync_frm; +SET @@global.sync_frm = OFF; DROP TABLE IF EXISTS t1,t2,t3; CREATE TABLE t1 ( a int(11) unsigned default NULL, @@ -15,3 +17,4 @@ CREATE TABLE t3 SELECT * FROM t1; # normal mode # PS mode DROP TABLE t1, t2, t3; +SET @@global.sync_frm = @odl_sync_frm; diff --git a/mysql-test/t/lock_multi_bug38499.test b/mysql-test/t/lock_multi_bug38499.test index 8178987e802..3d3f084ba5f 100644 --- a/mysql-test/t/lock_multi_bug38499.test +++ b/mysql-test/t/lock_multi_bug38499.test @@ -5,6 +5,9 @@ # Save the initial number of concurrent sessions --source include/count_sessions.inc +SET @odl_sync_frm = @@global.sync_frm; +SET @@global.sync_frm = OFF; + connect (locker,localhost,root,,); connect (writer,localhost,root,,); @@ -214,6 +217,8 @@ DROP TABLE t1; --disconnect locker --disconnect writer +SET @@global.sync_frm = @odl_sync_frm; + # End of 5.0 tests # Wait till all disconnects are completed diff --git a/mysql-test/t/lock_multi_bug38691.test b/mysql-test/t/lock_multi_bug38691.test index 0458f31579e..881a0d8e502 100644 --- a/mysql-test/t/lock_multi_bug38691.test +++ b/mysql-test/t/lock_multi_bug38691.test @@ -8,6 +8,9 @@ # Save the initial number of concurrent sessions --source include/count_sessions.inc +SET @odl_sync_frm = @@global.sync_frm; +SET @@global.sync_frm = OFF; + # Test to see if select will get the lock ahead of low priority update connect (locker,localhost,root,,); @@ -136,6 +139,8 @@ DROP TABLE t1, t2, t3; --disconnect locker --disconnect writer +SET @@global.sync_frm = @odl_sync_frm; + # Wait till all disconnects are completed --source include/wait_until_count_sessions.inc From 90e25c6fb09350fb048f7c50762c050d68ce3c1f Mon Sep 17 00:00:00 2001 From: Date: Sat, 29 Aug 2009 16:52:22 +0800 Subject: [PATCH 16/68] Bug #44331 Restore of database with events produces warning in replication If an EVENT is created without the DEFINER clause set explicitly or with it set to CURRENT_USER, the master and slaves become inconsistent. This issue stems from the fact that in both cases, the DEFINER is set to the CURRENT_USER of the current thread. On the master, the CURRENT_USER is the mysqld's user, while on the slave, the CURRENT_USER is empty for the SQL Thread which is responsible for executing the statement. To fix the problem, we do what follows. If the definer is not set explicitly, a DEFINER clause is added when writing the query into binlog; if 'CURRENT_USER' is used as the DEFINER, it is replaced with the value of the current user before writing to binlog. --- .../rpl/r/rpl_create_if_not_exists.result | 2 +- .../suite/rpl/r/rpl_drop_if_exists.result | 4 +- mysql-test/suite/rpl/r/rpl_events.result | 42 +++++++++++++++++ .../suite/rpl/r/rpl_innodb_mixed_dml.result | 4 +- mysql-test/suite/rpl/t/rpl_events.test | 46 +++++++++++++++++-- sql/events.cc | 38 ++++++++++++++- sql/sql_yacc.yy | 7 +-- 7 files changed, 131 insertions(+), 12 deletions(-) diff --git a/mysql-test/suite/rpl/r/rpl_create_if_not_exists.result b/mysql-test/suite/rpl/r/rpl_create_if_not_exists.result index 536f40dc7f1..12a956a6ce6 100644 --- a/mysql-test/suite/rpl/r/rpl_create_if_not_exists.result +++ b/mysql-test/suite/rpl/r/rpl_create_if_not_exists.result @@ -29,5 +29,5 @@ t1 t2 SHOW EVENTS in mysqltest; Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation -mysqltest e @ SYSTEM ONE TIME # NULL NULL NULL NULL SLAVESIDE_DISABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci +mysqltest e root@localhost SYSTEM ONE TIME # NULL NULL NULL NULL SLAVESIDE_DISABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci DROP DATABASE IF EXISTS mysqltest; diff --git a/mysql-test/suite/rpl/r/rpl_drop_if_exists.result b/mysql-test/suite/rpl/r/rpl_drop_if_exists.result index 59a2470cfdb..e2d4c727c98 100644 --- a/mysql-test/suite/rpl/r/rpl_drop_if_exists.result +++ b/mysql-test/suite/rpl/r/rpl_drop_if_exists.result @@ -43,7 +43,7 @@ master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS db_bug_13684.t master-bin.000001 # Query # # DROP DATABASE IF EXISTS db_bug_13684 master-bin.000001 # Query # # CREATE DATABASE db_bug_13684 master-bin.000001 # Query # # use `test`; CREATE TABLE db_bug_13684.t (a int) -master-bin.000001 # Query # # use `test`; CREATE EVENT db_bug_13684.e +master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` EVENT db_bug_13684.e ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO UPDATE db_bug_13684.t SET a = a + 1 @@ -75,7 +75,7 @@ master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS db_bug_13684.t master-bin.000001 # Query # # DROP DATABASE IF EXISTS db_bug_13684 master-bin.000001 # Query # # CREATE DATABASE db_bug_13684 master-bin.000001 # Query # # use `test`; CREATE TABLE db_bug_13684.t (a int) -master-bin.000001 # Query # # use `test`; CREATE EVENT db_bug_13684.e +master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` EVENT db_bug_13684.e ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO UPDATE db_bug_13684.t SET a = a + 1 diff --git a/mysql-test/suite/rpl/r/rpl_events.result b/mysql-test/suite/rpl/r/rpl_events.result index b797183f9d2..8538d2ca373 100644 --- a/mysql-test/suite/rpl/r/rpl_events.result +++ b/mysql-test/suite/rpl/r/rpl_events.result @@ -191,5 +191,47 @@ select * from t28953; END;| ALTER EVENT event1 RENAME TO event2; DROP EVENT event2; +CREATE TABLE test.t1(details CHAR(30)); +CREATE EVENT /*!50000 event44331_1 */ +ON SCHEDULE AT CURRENT_TIMESTAMP +ON COMPLETION PRESERVE DISABLE +DO INSERT INTO test.t1 VALUES('event event44331_1 fired - no definer'); +CREATE DEFINER=CURRENT_USER /*!50000 EVENT event44331_2 */ +ON SCHEDULE AT CURRENT_TIMESTAMP +ON COMPLETION PRESERVE DISABLE +DO INSERT INTO test.t1 VALUES('event event44331_2 fired - DEFINER=CURRENT_USER'); +CREATE DEFINER=CURRENT_USER() EVENT event44331_3 +ON SCHEDULE AT CURRENT_TIMESTAMP +ON COMPLETION PRESERVE DISABLE +DO INSERT INTO test.t1 VALUES('event event44331_3 fired - DEFINER=CURRENT_USER() function'); +CREATE /*!50000 DEFINER='user44331' */ EVENT event44331_4 +ON SCHEDULE AT CURRENT_TIMESTAMP +ON COMPLETION PRESERVE DISABLE +DO INSERT INTO test.t1 VALUES('event event44331_4 fired - DEFINER=user1'); +Warnings: +Note 1449 The user specified as a definer ('user44331'@'%') does not exist +#on master +select EVENT_SCHEMA, EVENT_NAME, DEFINER from information_schema.events +where EVENT_NAME='event44331_1' || EVENT_NAME='event44331_2' || +EVENT_NAME='event44331_3' || EVENT_NAME='event44331_4'; +EVENT_SCHEMA EVENT_NAME DEFINER +test event44331_1 root@localhost +test event44331_2 root@localhost +test event44331_3 root@localhost +test event44331_4 user44331@% +#on slave +select EVENT_SCHEMA, EVENT_NAME, DEFINER from information_schema.events +where EVENT_NAME='event44331_1' || EVENT_NAME='event44331_2' || +EVENT_NAME='event44331_3' || EVENT_NAME='event44331_4'; +EVENT_SCHEMA EVENT_NAME DEFINER +test event44331_1 root@localhost +test event44331_2 root@localhost +test event44331_3 root@localhost +test event44331_4 user44331@% SET @@global.event_scheduler= @old_event_scheduler; DROP TABLE t28953; +DROP TABLE t1; +DROP EVENT event44331_1; +DROP EVENT event44331_2; +DROP EVENT event44331_3; +DROP EVENT event44331_4; diff --git a/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result b/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result index 6c5ab43da5f..81c486cb43c 100644 --- a/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result +++ b/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result @@ -690,7 +690,7 @@ test_rpl e1 root@localhost SYSTEM RECURRING NULL 1 # # NULL ENABLED 1 latin1 lat USE test_rpl; SHOW EVENTS; Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation -test_rpl e1 @ SYSTEM RECURRING NULL 1 # # NULL SLAVESIDE_DISABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci +test_rpl e1 root@localhost SYSTEM RECURRING NULL 1 # # NULL SLAVESIDE_DISABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci ==========MASTER========== SELECT COUNT(*) FROM t1; COUNT(*) @@ -1078,7 +1078,7 @@ master-bin.000001 # Query 1 # use `test_rpl`; GRANT EVENT ON *.* TO 'root'@'loca master-bin.000001 # Query 1 # BEGIN master-bin.000001 # Query 1 # use `test_rpl`; INSERT INTO t1 VALUES(1, 'test1') master-bin.000001 # Xid 1 # # -master-bin.000001 # Query 1 # use `test_rpl`; CREATE EVENT e1 ON SCHEDULE EVERY '1' SECOND COMMENT 'e_second_comment' DO DELETE FROM t1 +master-bin.000001 # Query 1 # use `test_rpl`; CREATE DEFINER=`root`@`localhost` EVENT e1 ON SCHEDULE EVERY '1' SECOND COMMENT 'e_second_comment' DO DELETE FROM t1 master-bin.000001 # Query 1 # use `test_rpl`; ALTER EVENT e1 RENAME TO e2 master-bin.000001 # Query 1 # use `test_rpl`; DROP EVENT e2 master-bin.000001 # Query 1 # BEGIN diff --git a/mysql-test/suite/rpl/t/rpl_events.test b/mysql-test/suite/rpl/t/rpl_events.test index d06a3118389..f306fb10972 100644 --- a/mysql-test/suite/rpl/t/rpl_events.test +++ b/mysql-test/suite/rpl/t/rpl_events.test @@ -46,12 +46,52 @@ connection master; DROP EVENT event2; -sync_slave_with_master; +# +# BUG#44331 +# This test verifies if the definer is consistent between master and slave, +# when the event is created without the DEFINER clause set explicitly or the +# DEFINER is set to CURRENT_USER +# +CREATE TABLE test.t1(details CHAR(30)); -# Doing cleanup of the table referred to in the event to guarantee -# that there is no bad timing cauing it to try to access the table. +CREATE EVENT /*!50000 event44331_1 */ + ON SCHEDULE AT CURRENT_TIMESTAMP + ON COMPLETION PRESERVE DISABLE + DO INSERT INTO test.t1 VALUES('event event44331_1 fired - no definer'); + +CREATE DEFINER=CURRENT_USER /*!50000 EVENT event44331_2 */ + ON SCHEDULE AT CURRENT_TIMESTAMP + ON COMPLETION PRESERVE DISABLE + DO INSERT INTO test.t1 VALUES('event event44331_2 fired - DEFINER=CURRENT_USER'); + +CREATE DEFINER=CURRENT_USER() EVENT event44331_3 + ON SCHEDULE AT CURRENT_TIMESTAMP + ON COMPLETION PRESERVE DISABLE + DO INSERT INTO test.t1 VALUES('event event44331_3 fired - DEFINER=CURRENT_USER() function'); + +CREATE /*!50000 DEFINER='user44331' */ EVENT event44331_4 + ON SCHEDULE AT CURRENT_TIMESTAMP + ON COMPLETION PRESERVE DISABLE + DO INSERT INTO test.t1 VALUES('event event44331_4 fired - DEFINER=user1'); + +--echo #on master +select EVENT_SCHEMA, EVENT_NAME, DEFINER from information_schema.events + where EVENT_NAME='event44331_1' || EVENT_NAME='event44331_2' || + EVENT_NAME='event44331_3' || EVENT_NAME='event44331_4'; + +sync_slave_with_master; +connection slave; +--echo #on slave +select EVENT_SCHEMA, EVENT_NAME, DEFINER from information_schema.events + where EVENT_NAME='event44331_1' || EVENT_NAME='event44331_2' || + EVENT_NAME='event44331_3' || EVENT_NAME='event44331_4'; connection master; SET @@global.event_scheduler= @old_event_scheduler; DROP TABLE t28953; +DROP TABLE t1; +DROP EVENT event44331_1; +DROP EVENT event44331_2; +DROP EVENT event44331_3; +DROP EVENT event44331_4; sync_slave_with_master; diff --git a/sql/events.cc b/sql/events.cc index 10edfff2402..34da0e185b7 100644 --- a/sql/events.cc +++ b/sql/events.cc @@ -341,6 +341,33 @@ common_1_lev_code: } +/** + Create a new query string for removing executable comments + for avoiding leak and keeping consistency of the execution + on master and slave. + + @param[in] thd Thread handler + @param[in] buf Query string + + @return + 0 ok + 1 error +*/ +static int +create_query_string(THD *thd, String *buf) +{ + /* Append the "CREATE" part of the query */ + if (buf->append(STRING_WITH_LEN("CREATE "))) + return 1; + /* Append definer */ + append_definer(thd, buf, &(thd->lex->definer->user), &(thd->lex->definer->host)); + /* Append the left part of thd->query after "DEFINER" part */ + if (buf->append(thd->lex->stmt_definition_begin)) + return 1; + + return 0; +} + /** Create a new event. @@ -439,7 +466,16 @@ Events::create_event(THD *thd, Event_parse_data *parse_data, { /* Binlog the create event. */ DBUG_ASSERT(thd->query && thd->query_length); - write_bin_log(thd, TRUE, thd->query, thd->query_length); + String log_query; + if (create_query_string(thd, &log_query)) + { + sql_print_error("Event Error: An error occurred while creating query string, " + "before writing it into binary log."); + DBUG_RETURN(TRUE); + } + /* If the definer is not set or set to CURRENT_USER, the value of CURRENT_USER + will be written into the binary log as the definer for the SQL thread. */ + write_bin_log(thd, TRUE, log_query.c_ptr(), log_query.length()); } } pthread_mutex_unlock(&LOCK_event_metadata); diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index c7e955d122d..a18f57bf9cf 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1809,15 +1809,16 @@ server_option: ; event_tail: - EVENT_SYM opt_if_not_exists sp_name + remember_name EVENT_SYM opt_if_not_exists sp_name { THD *thd= YYTHD; LEX *lex=Lex; - lex->create_info.options= $2; + lex->stmt_definition_begin= $1; + lex->create_info.options= $3; if (!(lex->event_parse_data= Event_parse_data::new_instance(thd))) MYSQL_YYABORT; - lex->event_parse_data->identifier= $3; + lex->event_parse_data->identifier= $4; lex->event_parse_data->on_completion= Event_parse_data::ON_COMPLETION_DROP; From 62b95b90df8ab3bf29838fcd89b7a662006ebcec Mon Sep 17 00:00:00 2001 From: Alexey Kopytov Date: Sun, 30 Aug 2009 11:03:37 +0400 Subject: [PATCH 17/68] Bug #46607: Assertion failed: (cond_type == Item::FUNC_ITEM) results in server crash check_group_min_max_predicates() assumed the input condition item to be one of COND_ITEM, SUBSELECT_ITEM, or FUNC_ITEM. Since a condition of the form "field" is also a valid condition equivalent to "field <> 0", using such a condition in a query where the loose index scan was chosen resulted in a debug assertion failure. Fixed by handling conditions of the FIELD_ITEM type in check_group_min_max_predicates(). --- mysql-test/r/group_min_max.result | 12 ++++++++++++ mysql-test/t/group_min_max.test | 15 +++++++++++++++ sql/opt_range.cc | 12 +++++++++++- 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/group_min_max.result b/mysql-test/r/group_min_max.result index 27448d3e949..ac9a53ca238 100644 --- a/mysql-test/r/group_min_max.result +++ b/mysql-test/r/group_min_max.result @@ -2502,3 +2502,15 @@ a MAX(b) 2 1 DROP TABLE t; End of 5.0 tests +# +# Bug #46607: Assertion failed: (cond_type == Item::FUNC_ITEM) results in +# server crash +# +CREATE TABLE t (a INT, b INT, INDEX (a,b)); +INSERT INTO t VALUES (2,0), (2,0), (2,1), (2,1); +INSERT INTO t SELECT * FROM t; +SELECT a, MAX(b) FROM t WHERE b GROUP BY a; +a MAX(b) +2 1 +DROP TABLE t; +End of 5.1 tests diff --git a/mysql-test/t/group_min_max.test b/mysql-test/t/group_min_max.test index 981be3efece..c09a4fbf490 100644 --- a/mysql-test/t/group_min_max.test +++ b/mysql-test/t/group_min_max.test @@ -1018,3 +1018,18 @@ DROP TABLE t; --echo End of 5.0 tests + +--echo # +--echo # Bug #46607: Assertion failed: (cond_type == Item::FUNC_ITEM) results in +--echo # server crash +--echo # + +CREATE TABLE t (a INT, b INT, INDEX (a,b)); +INSERT INTO t VALUES (2,0), (2,0), (2,1), (2,1); +INSERT INTO t SELECT * FROM t; + +SELECT a, MAX(b) FROM t WHERE b GROUP BY a; + +DROP TABLE t; + +--echo End of 5.1 tests diff --git a/sql/opt_range.cc b/sql/opt_range.cc index e3aef02637f..d7438b7b9cc 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -9628,7 +9628,17 @@ check_group_min_max_predicates(COND *cond, Item_field *min_max_arg_item, */ if (cond_type == Item::SUBSELECT_ITEM) DBUG_RETURN(FALSE); - + + /* + Condition of the form 'field' is equivalent to 'field <> 0' and thus + satisfies the SA3 condition. + */ + if (cond_type == Item::FIELD_ITEM) + { + DBUG_PRINT("info", ("Analyzing: %s", cond->full_name())); + DBUG_RETURN(TRUE); + } + /* We presume that at this point there are no other Items than functions. */ DBUG_ASSERT(cond_type == Item::FUNC_ITEM); From f37a5879b4f19aab5be3e6d4ab69d2da60f443b4 Mon Sep 17 00:00:00 2001 From: Date: Mon, 31 Aug 2009 10:26:01 +0800 Subject: [PATCH 18/68] Bug #44331 Restore of database with events produces warning in replication Update the test case for BUG#44331 to fix the push build failure. --- mysql-test/suite/rpl/r/rpl_events.result | 24 ++++++++++++++++++++---- mysql-test/suite/rpl/t/rpl_events.test | 18 ++++++++++++++---- 2 files changed, 34 insertions(+), 8 deletions(-) diff --git a/mysql-test/suite/rpl/r/rpl_events.result b/mysql-test/suite/rpl/r/rpl_events.result index 8538d2ca373..b3fd85d7e28 100644 --- a/mysql-test/suite/rpl/r/rpl_events.result +++ b/mysql-test/suite/rpl/r/rpl_events.result @@ -212,21 +212,37 @@ Warnings: Note 1449 The user specified as a definer ('user44331'@'%') does not exist #on master select EVENT_SCHEMA, EVENT_NAME, DEFINER from information_schema.events -where EVENT_NAME='event44331_1' || EVENT_NAME='event44331_2' || -EVENT_NAME='event44331_3' || EVENT_NAME='event44331_4'; +where EVENT_NAME='event44331_1'; EVENT_SCHEMA EVENT_NAME DEFINER test event44331_1 root@localhost +select EVENT_SCHEMA, EVENT_NAME, DEFINER from information_schema.events +where EVENT_NAME='event44331_2'; +EVENT_SCHEMA EVENT_NAME DEFINER test event44331_2 root@localhost +select EVENT_SCHEMA, EVENT_NAME, DEFINER from information_schema.events +where EVENT_NAME='event44331_3'; +EVENT_SCHEMA EVENT_NAME DEFINER test event44331_3 root@localhost +select EVENT_SCHEMA, EVENT_NAME, DEFINER from information_schema.events +where EVENT_NAME='event44331_4'; +EVENT_SCHEMA EVENT_NAME DEFINER test event44331_4 user44331@% #on slave select EVENT_SCHEMA, EVENT_NAME, DEFINER from information_schema.events -where EVENT_NAME='event44331_1' || EVENT_NAME='event44331_2' || -EVENT_NAME='event44331_3' || EVENT_NAME='event44331_4'; +where EVENT_NAME='event44331_1'; EVENT_SCHEMA EVENT_NAME DEFINER test event44331_1 root@localhost +select EVENT_SCHEMA, EVENT_NAME, DEFINER from information_schema.events +where EVENT_NAME='event44331_2'; +EVENT_SCHEMA EVENT_NAME DEFINER test event44331_2 root@localhost +select EVENT_SCHEMA, EVENT_NAME, DEFINER from information_schema.events +where EVENT_NAME='event44331_3'; +EVENT_SCHEMA EVENT_NAME DEFINER test event44331_3 root@localhost +select EVENT_SCHEMA, EVENT_NAME, DEFINER from information_schema.events +where EVENT_NAME='event44331_4'; +EVENT_SCHEMA EVENT_NAME DEFINER test event44331_4 user44331@% SET @@global.event_scheduler= @old_event_scheduler; DROP TABLE t28953; diff --git a/mysql-test/suite/rpl/t/rpl_events.test b/mysql-test/suite/rpl/t/rpl_events.test index f306fb10972..7720ad6658c 100644 --- a/mysql-test/suite/rpl/t/rpl_events.test +++ b/mysql-test/suite/rpl/t/rpl_events.test @@ -76,15 +76,25 @@ CREATE /*!50000 DEFINER='user44331' */ EVENT event44331_4 --echo #on master select EVENT_SCHEMA, EVENT_NAME, DEFINER from information_schema.events - where EVENT_NAME='event44331_1' || EVENT_NAME='event44331_2' || - EVENT_NAME='event44331_3' || EVENT_NAME='event44331_4'; + where EVENT_NAME='event44331_1'; +select EVENT_SCHEMA, EVENT_NAME, DEFINER from information_schema.events + where EVENT_NAME='event44331_2'; +select EVENT_SCHEMA, EVENT_NAME, DEFINER from information_schema.events + where EVENT_NAME='event44331_3'; +select EVENT_SCHEMA, EVENT_NAME, DEFINER from information_schema.events + where EVENT_NAME='event44331_4'; sync_slave_with_master; connection slave; --echo #on slave select EVENT_SCHEMA, EVENT_NAME, DEFINER from information_schema.events - where EVENT_NAME='event44331_1' || EVENT_NAME='event44331_2' || - EVENT_NAME='event44331_3' || EVENT_NAME='event44331_4'; + where EVENT_NAME='event44331_1'; +select EVENT_SCHEMA, EVENT_NAME, DEFINER from information_schema.events + where EVENT_NAME='event44331_2'; +select EVENT_SCHEMA, EVENT_NAME, DEFINER from information_schema.events + where EVENT_NAME='event44331_3'; +select EVENT_SCHEMA, EVENT_NAME, DEFINER from information_schema.events + where EVENT_NAME='event44331_4'; connection master; SET @@global.event_scheduler= @old_event_scheduler; From c3aac11c088b375b0bbeabacb4d27e40261dabaf Mon Sep 17 00:00:00 2001 From: "Tatiana A. Nurnberg" Date: Mon, 31 Aug 2009 10:01:13 -0700 Subject: [PATCH 19/68] Bug#35132: MySQLadmin --wait ping always crashes on Windows systems Failing to connect would release parts of the MYSQL struct. We would then proceed to try again to connect without re- initializing the struct. We prevent the unwanted freeing of data we'll still need now. --- client/mysqladmin.cc | 128 +++++++++++++++++++++++++++++++++---------- sql-common/client.c | 9 +++ 2 files changed, 108 insertions(+), 29 deletions(-) diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc index 699c2081b86..1ff9012780e 100644 --- a/client/mysqladmin.cc +++ b/client/mysqladmin.cc @@ -22,6 +22,7 @@ #endif #include #include +#include #ifdef LATER_HAVE_NDBCLUSTER_DB #include "../ndb/src/mgmclient/ndb_mgmclient.h" @@ -358,6 +359,11 @@ int main(int argc,char *argv[]) mysql_options(&mysql, MYSQL_SET_CHARSET_NAME, default_charset); if (sql_connect(&mysql, option_wait)) { + /* + We couldn't get an initial connection and will definitely exit. + The following just determines the exit-code we'll give. + */ + unsigned int err= mysql_errno(&mysql); if (err >= CR_MIN_ERROR && err <= CR_MAX_ERROR) error= 1; @@ -376,30 +382,69 @@ int main(int argc,char *argv[]) } else { + /* + --count=0 aborts right here. Otherwise iff --sleep=t ("interval") + is given a t!=0, we get an endless loop, or n iterations if --count=n + was given an n!=0. If --sleep wasn't given, we get one iteration. + + To wit, --wait loops the connection-attempts, while --sleep loops + the command execution (endlessly if no --count is given). + */ + while (!interrupted && (!opt_count_iterations || nr_iterations)) { new_line = 0; - if ((error=execute_commands(&mysql,argc,commands))) + + if ((error= execute_commands(&mysql,argc,commands))) { + /* + Unknown/malformed command always aborts and can't be --forced. + If the user got confused about the syntax, proceeding would be + dangerous ... + */ if (error > 0) - break; /* Wrong command error */ - if (!option_force) + break; + + /* + Command was well-formed, but failed on the server. Might succeed + on retry (if conditions on server change etc.), but needs --force + to retry. + */ + if (!option_force) + break; + } /* if((error= ... */ + + if (interval) /* --sleep=interval given */ + { + /* + If connection was dropped (unintentionally, or due to SHUTDOWN), + re-establish it if --wait ("retry-connect") was given and user + didn't signal for us to die. Otherwise, signal failure. + */ + + if (mysql.net.vio == 0) { if (option_wait && !interrupted) { - mysql_close(&mysql); - if (!sql_connect(&mysql, option_wait)) - { - sleep(1); /* Don't retry too rapidly */ - continue; /* Retry */ - } + sleep(1); + sql_connect(&mysql, option_wait); + /* + continue normally and decrease counters so that + "mysqladmin --count=1 --wait=1 shutdown" + cannot loop endlessly. + */ } - error=1; - break; - } - } - if (interval) - { + else + { + /* + connexion broke, and we have no order to re-establish it. fail. + */ + if (!option_force) + error= 1; + break; + } + } /* lost connection */ + sleep(interval); if (new_line) puts(""); @@ -407,10 +452,11 @@ int main(int argc,char *argv[]) nr_iterations--; } else - break; - } - mysql_close(&mysql); - } + break; /* no --sleep, done looping */ + } /* command-loop */ + } /* got connection */ + + mysql_close(&mysql); my_free(opt_password,MYF(MY_ALLOW_ZERO_PTR)); my_free(user,MYF(MY_ALLOW_ZERO_PTR)); #ifdef HAVE_SMEM @@ -428,6 +474,17 @@ static sig_handler endprog(int signal_number __attribute__((unused))) interrupted=1; } +/** + @brief connect to server, optionally waiting for same to come up + + @param mysql connection struct + @param wait wait for server to come up? + (0: no, ~0: forever, n: cycles) + + @return Operation result + @retval 0 success + @retval 1 failure +*/ static my_bool sql_connect(MYSQL *mysql, uint wait) { @@ -436,7 +493,7 @@ static my_bool sql_connect(MYSQL *mysql, uint wait) for (;;) { if (mysql_real_connect(mysql,host,user,opt_password,NullS,tcp_port, - unix_port, 0)) + unix_port, CLIENT_REMEMBER_OPTIONS)) { mysql->reconnect= 1; if (info) @@ -447,9 +504,9 @@ static my_bool sql_connect(MYSQL *mysql, uint wait) return 0; } - if (!wait) + if (!wait) // was or reached 0, fail { - if (!option_silent) + if (!option_silent) // print diagnostics { if (!host) host= (char*) LOCAL_HOST; @@ -473,11 +530,18 @@ static my_bool sql_connect(MYSQL *mysql, uint wait) } return 1; } + if (wait != (uint) ~0) - wait--; /* One less retry */ + wait--; /* count down, one less retry */ + if ((mysql_errno(mysql) != CR_CONN_HOST_ERROR) && (mysql_errno(mysql) != CR_CONNECTION_ERROR)) { + /* + Error is worse than "server doesn't answer (yet?)"; + fail even if we still have "wait-coins" unless --force + was also given. + */ fprintf(stderr,"Got error: %s\n", mysql_error(mysql)); if (!option_force) return 1; @@ -501,11 +565,18 @@ static my_bool sql_connect(MYSQL *mysql, uint wait) } -/* - Execute a command. - Return 0 on ok - -1 on retryable error - 1 on fatal error +/** + @brief Execute all commands + + @details We try to execute all commands we were given, in the order + given, but return with non-zero as soon as we encounter trouble. + By that token, individual commands can be considered a conjunction + with boolean short-cut. + + @return success? + @retval 0 Yes! ALL commands worked! + @retval 1 No, one failed and will never work (malformed): fatal error! + @retval -1 No, one failed on the server, may work next time! */ static int execute_commands(MYSQL *mysql,int argc, char **argv) @@ -575,7 +646,6 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv) mysql_error(mysql)); return -1; } - mysql_close(mysql); /* Close connection to avoid error messages */ argc=1; /* force SHUTDOWN to be the last command */ if (got_pidfile) { diff --git a/sql-common/client.c b/sql-common/client.c index 8f1f4a1fd5a..89de74ebd58 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -416,6 +416,15 @@ HANDLE create_shared_memory(MYSQL *mysql,NET *net, uint connect_timeout) const char *prefix; int i; + /* + If this is NULL, somebody freed the MYSQL* options. mysql_close() + is a good candidate. We don't just silently (re)set it to + def_shared_memory_base_name as that would create really confusing/buggy + behavior if the user passed in a different name on the command-line or + in a my.cnf. + */ + DBUG_ASSERT(shared_memory_base_name != NULL); + /* get enough space base-name + '_' + longest suffix we might ever send */ From 35ba36d13d5583e05a540ec27d0cfd2588cd055a Mon Sep 17 00:00:00 2001 From: Mattias Jonsson Date: Tue, 1 Sep 2009 13:04:56 +0200 Subject: [PATCH 20/68] Post fix patch for bug#20577 and bug#46362. On 64-bits machines the calculation gets the wrong types and results in very large numbers. Fixed by explicitly cast month to (int) --- sql-common/my_time.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sql-common/my_time.c b/sql-common/my_time.c index 18358519023..2ec1fc253a7 100644 --- a/sql-common/my_time.c +++ b/sql-common/my_time.c @@ -775,11 +775,12 @@ long calc_daynr(uint year,uint month,uint day) if (y == 0 && month == 0 && day == 0) DBUG_RETURN(0); /* Skip errors */ - delsum= (long) (365L * y+ 31*(month-1) +day); + /* Cast to int to be able to handle month == 0 */ + delsum= (long) (365 * y + 31 *((int) month - 1) + (int) day); if (month <= 2) y--; else - delsum-= (long) (month*4+23)/10; + delsum-= (long) ((int) month * 4 + 23) / 10; temp=(int) ((y/100+1)*3)/4; DBUG_PRINT("exit",("year: %d month: %d day: %d -> daynr: %ld", y+(month <= 2),month,day,delsum+y/4-temp)); From 004427a9bb80fd949b931bf14665e7d4f51c387e Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Tue, 1 Sep 2009 09:32:26 -0300 Subject: [PATCH 21/68] Bug#45611: Minor code cleanup Remove a self assignment. Rework a few constructs to avoid a potential overflow. Based upon patch contributed by Michal Hrusecky --- storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp | 4 ++-- storage/ndb/src/mgmsrv/InitConfigFileParser.cpp | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp b/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp index a61a5bc035c..8f8d4aad9ab 100644 --- a/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp +++ b/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp @@ -7521,8 +7521,8 @@ void Dbdict::execGET_TABINFOREQ(Signal* signal) return; } releaseSections(signal); - - DictObject * old_ptr_p = old_ptr_p = get_object(tableName, len); + + DictObject * old_ptr_p = get_object(tableName, len); if(old_ptr_p) obj_id = old_ptr_p->m_id; } else { diff --git a/storage/ndb/src/mgmsrv/InitConfigFileParser.cpp b/storage/ndb/src/mgmsrv/InitConfigFileParser.cpp index 569cb1eb654..560a9559999 100644 --- a/storage/ndb/src/mgmsrv/InitConfigFileParser.cpp +++ b/storage/ndb/src/mgmsrv/InitConfigFileParser.cpp @@ -208,11 +208,10 @@ InitConfigFileParser::run_config_rules(Context& ctx) ctx.m_config->put("NoOfNodes", nNodes); char tmpLine[MAX_LINE_LENGTH]; - BaseString::snprintf(tmpLine, MAX_LINE_LENGTH, "EXTERNAL SYSTEM_"); - strncat(tmpLine, system, MAX_LINE_LENGTH); - strncat(tmpLine, ":NoOfConnections", MAX_LINE_LENGTH); + BaseString::snprintf(tmpLine, MAX_LINE_LENGTH, + "EXTERNAL SYSTEM_%s:NoOfConnections", system); ctx.m_config->put(tmpLine, nExtConnections); - + Config * ret = new Config(); ret->m_configValues = (struct ndb_mgm_configuration*)ctx.m_configValues.getConfigValues(); ret->m_oldConfig = ctx.m_config; ctx.m_config = 0; From 02585b608a0edcb5feddaac7aca724d6b407be32 Mon Sep 17 00:00:00 2001 From: Mattias Jonsson Date: Tue, 1 Sep 2009 14:53:27 +0200 Subject: [PATCH 22/68] post push fix for bug#20577 and bug#46362, disabling warnings --- mysql-test/include/partition_date_range.inc | 6 ++++++ mysql-test/r/partition_pruning.result | 12 ++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/mysql-test/include/partition_date_range.inc b/mysql-test/include/partition_date_range.inc index c54396af9cb..5093cb3701d 100644 --- a/mysql-test/include/partition_date_range.inc +++ b/mysql-test/include/partition_date_range.inc @@ -21,6 +21,8 @@ SELECT * FROM t1 WHERE a >= '1001-00-00'; SELECT * FROM t1 WHERE a > '1001-00-00'; --sorted_result SELECT * FROM t1 WHERE a = '1001-00-00'; +--echo # Disabling warnings for the invalid date +--disable_warnings --sorted_result SELECT * FROM t1 WHERE a < '1999-02-31'; --sorted_result @@ -31,6 +33,7 @@ SELECT * FROM t1 WHERE a >= '1999-02-31'; SELECT * FROM t1 WHERE a > '1999-02-31'; --sorted_result SELECT * FROM t1 WHERE a = '1999-02-31'; +--enable_warnings --sorted_result SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1002-00-00'; --sorted_result @@ -51,11 +54,14 @@ EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1001-00-00'; EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1001-00-00'; EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > '1001-00-00'; EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1001-00-00'; +--echo # Disabling warnings for the invalid date +--disable_warnings EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1999-02-31'; EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1999-02-31'; EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1999-02-31'; EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > '1999-02-31'; EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1999-02-31'; +--enable_warnings EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1002-00-00'; EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1001-01-01'; EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0001-01-02' AND '1002-00-00'; diff --git a/mysql-test/r/partition_pruning.result b/mysql-test/r/partition_pruning.result index 86aa89be8a7..769d499fc0a 100644 --- a/mysql-test/r/partition_pruning.result +++ b/mysql-test/r/partition_pruning.result @@ -58,6 +58,7 @@ a SELECT * FROM t1 WHERE a = '1001-00-00'; a 1001-00-00 +# Disabling warnings for the invalid date SELECT * FROM t1 WHERE a < '1999-02-31'; a 0000-00-00 @@ -82,8 +83,6 @@ a 2001-01-01 SELECT * FROM t1 WHERE a = '1999-02-31'; a -Warning 1292 Incorrect date value: '1999-02-31' for column 'a' at row 1 -Warnings: SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1002-00-00'; a 0000-00-00 @@ -139,6 +138,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1001-00-00'; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 pNULL ref a a 4 const 1 Using where; Using index +# Disabling warnings for the invalid date EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1999-02-31'; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01,p2001-01-01 range a a 4 NULL 5 Using where; Using index @@ -218,6 +218,7 @@ a SELECT * FROM t1 WHERE a = '1001-00-00'; a 1001-00-00 +# Disabling warnings for the invalid date SELECT * FROM t1 WHERE a < '1999-02-31'; a 0000-00-00 @@ -297,6 +298,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1001-00-00'; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 pNULL ALL NULL NULL NULL NULL 7 Using where +# Disabling warnings for the invalid date EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1999-02-31'; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01,p2001-01-01 ALL NULL NULL NULL NULL 7 Using where @@ -385,6 +387,7 @@ a SELECT * FROM t1 WHERE a = '1001-00-00'; a 1001-00-00 +# Disabling warnings for the invalid date SELECT * FROM t1 WHERE a < '1999-02-31'; a 0000-00-00 @@ -409,8 +412,6 @@ a 2001-01-01 SELECT * FROM t1 WHERE a = '1999-02-31'; a -Warning 1292 Incorrect date value: '1999-02-31' for column 'a' at row 1 -Warnings: SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1002-00-00'; a 0000-00-00 @@ -466,6 +467,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1001-00-00'; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 pNULL ref a a 4 const 1 Using where; Using index +# Disabling warnings for the invalid date EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1999-02-31'; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 5 Using where; Using index @@ -545,6 +547,7 @@ a SELECT * FROM t1 WHERE a = '1001-00-00'; a 1001-00-00 +# Disabling warnings for the invalid date SELECT * FROM t1 WHERE a < '1999-02-31'; a 0000-00-00 @@ -624,6 +627,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1001-00-00'; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 pNULL ALL NULL NULL NULL NULL 7 Using where +# Disabling warnings for the invalid date EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1999-02-31'; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 ALL NULL NULL NULL NULL 7 Using where From dfcbeee1b4c9bec0de2ee86209f6f25c55760f2f Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Tue, 1 Sep 2009 16:39:13 +0300 Subject: [PATCH 23/68] Fixed a problem in how BUILD/check_cpu handles Core 2 Duo processors. This fixes the regression introduced in 5.1 that prevents 64 bit builds on Intel while still keeping the core2 hack operational so the cluster can build. --- BUILD/check-cpu | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/BUILD/check-cpu b/BUILD/check-cpu index 9fa48adfb5f..c0e87a675cb 100755 --- a/BUILD/check-cpu +++ b/BUILD/check-cpu @@ -70,6 +70,11 @@ check_cpu () { Alpha*EV6*) cpu_arg="ev6"; ;; + #Core 2 Duo + *Intel*Core\(TM\)2*) + cpu_arg="nocona" + core2="yes" + ;; # Intel ia32 *Intel*Core*|*X[eE][oO][nN]*) # a Xeon is just another pentium4 ... @@ -134,10 +139,6 @@ check_cpu () { *i386*) cpu_arg="i386" ;; - #Core 2 Duo - *Intel*Core\(TM\)2*) - cpu_arg="nocona" - ;; # Intel ia64 *Itanium*) cpu_arg="itanium" From f7fa5d5a02611a2d604af0dd3584238503d27fbb Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Wed, 2 Sep 2009 13:09:01 +0300 Subject: [PATCH 24/68] fixed compilation warnings --- tests/mysql_client_test.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 300b0347233..9394b0df40b 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -16997,7 +16997,7 @@ static void test_bug20023() { MYSQL con; - int sql_big_selects_orig; + int sql_big_selects_orig= 0; /* Type of max_join_size is ha_rows, which might be ulong or off_t depending on the platform or configure options. Preserve the string @@ -17005,10 +17005,10 @@ static void test_bug20023() */ char max_join_size_orig[32]; - int sql_big_selects_2; - int sql_big_selects_3; - int sql_big_selects_4; - int sql_big_selects_5; + int sql_big_selects_2= 0; + int sql_big_selects_3= 0; + int sql_big_selects_4= 0; + int sql_big_selects_5= 0; char query_buffer[MAX_TEST_QUERY_LENGTH]; @@ -17147,7 +17147,7 @@ static void bug31418_impl() MYSQL con; my_bool is_null; - int rc; + int rc= 0; /* Create a new connection. */ From 8f5b17f5291088ac9e011859351971c1bfe9210a Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Wed, 2 Sep 2009 13:22:47 +0300 Subject: [PATCH 25/68] Fixed win32 compilation warnings --- mysys/my_redel.c | 2 ++ sql/sql_table.cc | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/mysys/my_redel.c b/mysys/my_redel.c index c03d1bc7c25..6521253f949 100644 --- a/mysys/my_redel.c +++ b/mysys/my_redel.c @@ -76,7 +76,9 @@ end: int my_copystat(const char *from, const char *to, int MyFlags) { struct stat statbuf; +#if !defined(__WIN__) && !defined(__NETWARE__) int res; +#endif if (stat((char*) from, &statbuf)) { diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 9f88fa93c06..4ec104aedc3 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -117,7 +117,7 @@ static char* add_identifier(char *to_p, const char * end_p, *(to_p++)= '`'; *(to_p++)= *(conv_name++); } - else if (length < (end_p - to_p)) + else if (((long) length) < (end_p - to_p)) { to_p= strnmov(to_p, conv_name, length); conv_name+= length; From 6cfe48d7270ec6de3247b011ddb84b41417a6a02 Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Wed, 2 Sep 2009 13:23:37 +0300 Subject: [PATCH 26/68] moved version to 5.0-main --- .bzr-mysql/default.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.bzr-mysql/default.conf b/.bzr-mysql/default.conf index 557df1b1ffe..f79c1cd6319 100644 --- a/.bzr-mysql/default.conf +++ b/.bzr-mysql/default.conf @@ -1,4 +1,4 @@ [MYSQL] post_commit_to = "commits@lists.mysql.com" post_push_to = "commits@lists.mysql.com" -tree_name = "mysql-5.0-bugteam" +tree_name = "mysql-5.0" From f30480a695b313cbd7bcaea4fca1dfc638e8e5a1 Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Wed, 2 Sep 2009 16:19:28 +0500 Subject: [PATCH 27/68] BUG#46483 - drop table of partitioned table may leave extraneous file Online/fast ALTER TABLE of a partitioned table may leave temporary file in database directory. Fixed by removing unnecessary call to handler::ha_create_handler_files(), which was creating partitioning definition file. --- mysql-test/r/partition_innodb.result | 4 ++++ mysql-test/t/partition_innodb.test | 12 ++++++++++++ sql/unireg.cc | 8 ++++---- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/mysql-test/r/partition_innodb.result b/mysql-test/r/partition_innodb.result index ad4d08e89ff..8af9133ab3f 100644 --- a/mysql-test/r/partition_innodb.result +++ b/mysql-test/r/partition_innodb.result @@ -256,3 +256,7 @@ SUBPARTITION BY KEY (char_column) SUBPARTITIONS 2 (PARTITION p1 VALUES LESS THAN (5) ENGINE = MyISAM) */ drop table t1; +CREATE TABLE t1 (a INT) ENGINE=InnoDB +PARTITION BY list(a) (PARTITION p1 VALUES IN (1)); +CREATE INDEX i1 ON t1 (a); +DROP TABLE t1; diff --git a/mysql-test/t/partition_innodb.test b/mysql-test/t/partition_innodb.test index 2abbceffbb0..c2e98ab59b8 100644 --- a/mysql-test/t/partition_innodb.test +++ b/mysql-test/t/partition_innodb.test @@ -270,3 +270,15 @@ PARTITION BY RANGE (int_column) (PARTITION p1 VALUES LESS THAN (5)); show create table t1; drop table t1; + +# +# BUG#46483 - drop table of partitioned table may leave extraneous file +# Note: was only repeatable with InnoDB plugin +# +CREATE TABLE t1 (a INT) ENGINE=InnoDB + PARTITION BY list(a) (PARTITION p1 VALUES IN (1)); +CREATE INDEX i1 ON t1 (a); +DROP TABLE t1; +let $MYSQLD_DATADIR= `SELECT @@datadir`; +# Before the fix it should show extra file like #sql-2405_2.par +--list_files $MYSQLD_DATADIR/test/ * diff --git a/sql/unireg.cc b/sql/unireg.cc index 68a352e4a44..60674b8390b 100644 --- a/sql/unireg.cc +++ b/sql/unireg.cc @@ -412,10 +412,10 @@ int rea_create_table(THD *thd, const char *path, DBUG_ASSERT(*fn_rext(frm_name)); if (thd->variables.keep_files_on_create) create_info->options|= HA_CREATE_KEEP_FILES; - if (file->ha_create_handler_files(path, NULL, CHF_CREATE_FLAG, create_info)) - goto err_handler; - if (!create_info->frm_only && ha_create_table(thd, path, db, table_name, - create_info,0)) + if (!create_info->frm_only && + (file->ha_create_handler_files(path, NULL, CHF_CREATE_FLAG, + create_info) || + ha_create_table(thd, path, db, table_name, create_info, 0))) goto err_handler; DBUG_RETURN(0); From 5109313e664edb0e99fcf2d7afcba5cfc00f6b66 Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Wed, 2 Sep 2009 08:45:48 -0300 Subject: [PATCH 28/68] Increase thread stack size on HP-UX when built with debug. --- storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp b/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp index 5300d5bbfd9..c107baca39f 100644 --- a/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp +++ b/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp @@ -106,8 +106,13 @@ void AsyncFile::doStart() { // Stacksize for filesystem threads - // An 8k stack should be enough +#if !defined(DBUG_OFF) && defined (__hpux) + // Empirical evidence indicates at least 32k + const NDB_THREAD_STACKSIZE stackSize = 32768; +#else + // Otherwise an 8k stack should be enough const NDB_THREAD_STACKSIZE stackSize = 8192; +#endif char buf[16]; numAsyncFiles++; From ca96ac53518f97655e34b590463887a3e166a266 Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Wed, 2 Sep 2009 09:02:22 -0300 Subject: [PATCH 29/68] Post-merge fix. Observe C declaration placement rules. --- mysys/mf_iocache.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/mysys/mf_iocache.c b/mysys/mf_iocache.c index 3aab904a6e0..c4c48f9c121 100644 --- a/mysys/mf_iocache.c +++ b/mysys/mf_iocache.c @@ -228,18 +228,20 @@ int init_io_cache(IO_CACHE *info, File file, uint cachesize, for (;;) { uint buffer_block; + /* + Unset MY_WAIT_IF_FULL bit if it is set, to prevent conflict with + MY_ZEROFILL. + */ + myf flags= (myf) (cache_myflags & ~(MY_WME | MY_WAIT_IF_FULL)); + if (cachesize < min_cache) cachesize = min_cache; buffer_block = cachesize; if (type == SEQ_READ_APPEND) buffer_block *= 2; - /* - Unset MY_WAIT_IF_FULL bit if it is set, to prevent conflict with - MY_ZEROFILL. - */ - myf flag = MYF((cache_myflags & ~ (MY_WME | MY_WAIT_IF_FULL)) | - (cachesize == min_cache ? MY_WME : 0)); - if ((info->buffer= (byte*) my_malloc(buffer_block, flag)) != 0) + if (cachesize == min_cache) + flags|= (myf) MY_WME; + if ((info->buffer= (byte*) my_malloc(buffer_block, flags)) != 0) { info->write_buffer=info->buffer; if (type == SEQ_READ_APPEND) From 7d9f97f5eee580131515d01ae5f62bde27d6bff5 Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Wed, 2 Sep 2009 15:20:47 +0300 Subject: [PATCH 30/68] fixed a valgrind warning in partitioning code --- sql/sql_partition.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index d433ba0b0cc..08ff2daacb9 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -6909,6 +6909,7 @@ int get_part_iter_for_interval_via_walking(partition_info *part_info, Field *field; uint total_parts; partition_iter_func get_next_func; + part_iter->ret_null_part= part_iter->ret_null_part_orig= FALSE; if (is_subpart) { field= part_info->subpart_field_array[0]; From db8471aa857e911bd7f20b5c67161cd3274f6974 Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Wed, 2 Sep 2009 16:36:52 +0300 Subject: [PATCH 31/68] Backported the --parallel=str option from mtr2 for backward compatibility with the newer pb2 testing environments --- mysql-test/mysql-test-run.pl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index f60701b7b49..e98e05eadb1 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -302,6 +302,7 @@ our $debug_compiled_binaries; our %mysqld_variables; +our $opt_parallel; my $source_dist= 0; our $opt_max_save_core= 5; @@ -645,6 +646,7 @@ sub command_line_setup () { 'testcase-timeout=i' => \$opt_testcase_timeout, 'suite-timeout=i' => \$opt_suite_timeout, 'warnings|log-warnings' => \$opt_warnings, + 'parallel=s' => \$opt_parallel, # Options which are no longer used (map { $_ => \&warn_about_removed_option } @removed_options), @@ -5278,6 +5280,7 @@ Misc options the specified test case (if any) fast Don't try to clean up from earlier runs reorder Reorder tests to get fewer server restarts + parallel=STR Compatibility slot. Ignored. help Get this help text testcase-timeout=MINUTES Max test case run time (default $default_testcase_timeout) From 21a01bd60e79cc6a39ab28e5db8e216344c86eb9 Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Wed, 2 Sep 2009 18:42:08 +0300 Subject: [PATCH 32/68] fixed a valgrind warning in partition_pruning --- sql/partition_info.h | 1 + 1 file changed, 1 insertion(+) diff --git a/sql/partition_info.h b/sql/partition_info.h index 8832b6ee409..9f438e8260b 100644 --- a/sql/partition_info.h +++ b/sql/partition_info.h @@ -311,5 +311,6 @@ void init_all_partitions_iterator(partition_info *part_info, { part_iter->part_nums.start= part_iter->part_nums.cur= 0; part_iter->part_nums.end= part_info->no_parts; + part_iter->ret_null_part= part_iter->ret_null_part_orig= FALSE; part_iter->get_next= get_next_partition_id_range; } From 80d872bd9dde4c0078a4a2cec53de3f1e7f49999 Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Wed, 2 Sep 2009 19:42:46 +0300 Subject: [PATCH 33/68] back to -bugteam --- .bzr-mysql/default.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.bzr-mysql/default.conf b/.bzr-mysql/default.conf index f044f8e62da..e613cefc614 100644 --- a/.bzr-mysql/default.conf +++ b/.bzr-mysql/default.conf @@ -1,4 +1,4 @@ [MYSQL] post_commit_to = "commits@lists.mysql.com" post_push_to = "commits@lists.mysql.com" -tree_name = "mysql-5.1" +tree_name = "mysql-5.1-bugteam" From cae61b1ce435366e05b52cc9251257163bf4846a Mon Sep 17 00:00:00 2001 From: Kristofer Pettersson Date: Thu, 3 Sep 2009 12:08:55 +0200 Subject: [PATCH 34/68] Bug#46486 warnings produced when running mysql_install_db During start up some plugins are disabled by default. This caused an additional warning level message to be emitted as a result of a previous bug patch. Since there is risk of unnecessary confusion regarding the operation level of the server the redundant information is removed. --- sql/sql_plugin.cc | 3 --- 1 file changed, 3 deletions(-) diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index da168d36429..f00e1f72390 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -1565,9 +1565,6 @@ void plugin_shutdown(void) } } - if (count > free_slots) - sql_print_warning("Forcing shutdown of %d plugins", count - free_slots); - plugins= (struct st_plugin_int **) my_alloca(sizeof(void*) * (count+1)); /* From 4a9e7e8e25192fda25a71bbb4d7f9b5b6088e0c6 Mon Sep 17 00:00:00 2001 From: Satya B Date: Thu, 3 Sep 2009 16:02:03 +0530 Subject: [PATCH 35/68] Fix for BUG#46591 - .frm file isn't sync'd with sync_frm enabled for CREATE TABLE...LIKE... The mysql server option 'sync_frm' is ignored when table is created with syntax CREATE TABLE .. LIKE.. Fixed by adding the MY_SYNC flag and calling my_sync() from my_copy() when the flag is set. In mysql_create_table(), when the 'sync_frm' is set, MY_SYNC flag is passed to my_copy(). Note: TestCase is not attached and can be tested manually using debugger. --- client/Makefile.am | 1 + include/my_sys.h | 1 + mysys/my_copy.c | 7 +++++++ sql/sql_table.cc | 7 ++++++- 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/client/Makefile.am b/client/Makefile.am index e77d294b0ac..192b89f8a2c 100644 --- a/client/Makefile.am +++ b/client/Makefile.am @@ -35,6 +35,7 @@ mysql_LDADD = @readline_link@ @TERMCAP_LIB@ $(LDADD) $(CXXLDFLAGS) mysqltest_SOURCES= mysqltest.c \ $(top_srcdir)/mysys/my_getsystime.c \ $(top_srcdir)/mysys/my_copy.c \ + $(top_srcdir)/mysys/my_sync.c \ $(top_srcdir)/mysys/my_mkdir.c mysqltest_LDADD = $(top_builddir)/regex/libregex.a $(LDADD) diff --git a/include/my_sys.h b/include/my_sys.h index 4254ec3dbcb..4ec4846f528 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -68,6 +68,7 @@ extern int NEAR my_errno; /* Last error in mysys */ #define MY_HOLD_ON_ERROR 256 /* my_realloc() ; Return old ptr on error */ #define MY_DONT_OVERWRITE_FILE 1024 /* my_copy: Don't overwrite file */ #define MY_THREADSAFE 2048 /* my_seek(): lock fd mutex */ +#define MY_SYNC 4096 /* my_copy(): sync dst file */ #define MY_CHECK_ERROR 1 /* Params to my_end; Check open-close */ #define MY_GIVE_INFO 2 /* Give time info about process*/ diff --git a/mysys/my_copy.c b/mysys/my_copy.c index b6bb925e898..f44a497fbc8 100644 --- a/mysys/my_copy.c +++ b/mysys/my_copy.c @@ -87,6 +87,13 @@ int my_copy(const char *from, const char *to, myf MyFlags) my_write(to_file,buff,Count,MYF(MyFlags | MY_NABP))) goto err; + /* sync the destination file */ + if (MyFlags & MY_SYNC) + { + if (my_sync(to_file, MyFlags)) + goto err; + } + if (my_close(from_file,MyFlags) | my_close(to_file,MyFlags)) DBUG_RETURN(-1); /* Error on close */ diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 84370873054..5a3100685e0 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -2773,6 +2773,7 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, TABLE_LIST *src_table, int err; bool res= TRUE; db_type not_used; + myf flags= MY_DONT_OVERWRITE_FILE; DBUG_ENTER("mysql_create_like_table"); /* @@ -2859,10 +2860,14 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, TABLE_LIST *src_table, DBUG_EXECUTE_IF("sleep_create_like_before_copy", my_sleep(6000000);); + if (opt_sync_frm && !(create_info->options & HA_LEX_CREATE_TMP_TABLE)) + flags|= MY_SYNC; + /* Create a new table by copying from source table + and sync the new table if the flag MY_SYNC is set */ - if (my_copy(src_path, dst_path, MYF(MY_DONT_OVERWRITE_FILE))) + if (my_copy(src_path, dst_path, flags)) { if (my_errno == ENOENT) my_error(ER_BAD_DB_ERROR,MYF(0),db); From acc76a97a01214ce67a61535b773e9a2a2a08b79 Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Thu, 3 Sep 2009 18:03:46 +0300 Subject: [PATCH 36/68] Bug #46791: Assertion failed:(table->key_read==0),function unknown function,file sql_base.cc When uncacheable queries are written to a temp table the optimizer must preserve the original JOIN structure, because it is re-using the JOIN structure to read from the resulting temporary table. This was done only for uncacheable sub-queries. But top level queries can also benefit from this mechanism, specially if they're using index access and need a reset. Fixed by not limiting the saving of JOIN structure to subqueries exclusively. Added a new test file to extend the existing (large) subquery.test. --- mysql-test/r/subselect4.result | 30 ++++++++++++++++++++++++++++++ mysql-test/t/subselect4.test | 32 ++++++++++++++++++++++++++++++++ sql/sql_select.cc | 8 ++------ 3 files changed, 64 insertions(+), 6 deletions(-) create mode 100644 mysql-test/r/subselect4.result create mode 100644 mysql-test/t/subselect4.test diff --git a/mysql-test/r/subselect4.result b/mysql-test/r/subselect4.result new file mode 100644 index 00000000000..68577cb2a4c --- /dev/null +++ b/mysql-test/r/subselect4.result @@ -0,0 +1,30 @@ +# +# Bug #46791: Assertion failed:(table->key_read==0),function unknown +# function,file sql_base.cc +# +CREATE TABLE t1 (a INT, b INT, KEY(a)); +INSERT INTO t1 VALUES (1,1),(2,2); +CREATE TABLE t2 LIKE t1; +INSERT INTO t2 VALUES (1,1),(2,2); +CREATE TABLE t3 LIKE t1; +# should have 1 impossible where and 2 dependent subqueries +EXPLAIN +SELECT 1 FROM t1 +WHERE NOT EXISTS (SELECT 1 FROM t2 WHERE 1 = (SELECT MIN(t2.b) FROM t3)) +ORDER BY count(*); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 index NULL a 5 NULL 2 Using index; Using temporary +2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where +3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table +# should not crash the next statement +SELECT 1 FROM t1 +WHERE NOT EXISTS (SELECT 1 FROM t2 WHERE 1 = (SELECT MIN(t2.b) FROM t3)) +ORDER BY count(*); +1 +1 +# should not crash: the crash is caused by the previous statement +SELECT 1; +1 +1 +DROP TABLE t1,t2,t3; +End of 5.0 tests. diff --git a/mysql-test/t/subselect4.test b/mysql-test/t/subselect4.test new file mode 100644 index 00000000000..ff4cdf3c439 --- /dev/null +++ b/mysql-test/t/subselect4.test @@ -0,0 +1,32 @@ +# General purpose bug fix tests go here : subselect.test too large + + +--echo # +--echo # Bug #46791: Assertion failed:(table->key_read==0),function unknown +--echo # function,file sql_base.cc +--echo # + +CREATE TABLE t1 (a INT, b INT, KEY(a)); +INSERT INTO t1 VALUES (1,1),(2,2); +CREATE TABLE t2 LIKE t1; +INSERT INTO t2 VALUES (1,1),(2,2); +CREATE TABLE t3 LIKE t1; + +--echo # should have 1 impossible where and 2 dependent subqueries +EXPLAIN +SELECT 1 FROM t1 +WHERE NOT EXISTS (SELECT 1 FROM t2 WHERE 1 = (SELECT MIN(t2.b) FROM t3)) +ORDER BY count(*); + +--echo # should not crash the next statement +SELECT 1 FROM t1 +WHERE NOT EXISTS (SELECT 1 FROM t2 WHERE 1 = (SELECT MIN(t2.b) FROM t3)) +ORDER BY count(*); + +--echo # should not crash: the crash is caused by the previous statement +SELECT 1; + +DROP TABLE t1,t2,t3; + + +--echo End of 5.0 tests. diff --git a/sql/sql_select.cc b/sql/sql_select.cc index b670e6e3637..9d5e67c9532 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -1474,12 +1474,8 @@ JOIN::optimize() } } - /* - If this join belongs to an uncacheable subquery save - the original join - */ - if (select_lex->uncacheable && !is_top_level_join() && - init_save_join_tab()) + /* If this join belongs to an uncacheable query save the original join */ + if (select_lex->uncacheable && init_save_join_tab()) DBUG_RETURN(-1); /* purecov: inspected */ } From 5a41fb5ce0fa17b804eea508c26e4d179dd3d373 Mon Sep 17 00:00:00 2001 From: Satya B Date: Thu, 3 Sep 2009 23:34:42 +0530 Subject: [PATCH 37/68] Fix for Bug#33785 - myisamchk show warning message myisamchk tool generates warnings when run on an myisam files (.MYI or .MYD) This is because of the conversion of max_value for certain options in myisamchk from singed long to unsigned long The max value for the options key_buffer_size, read_buffer_size, write_buffer _size and sort_buffer_size is given as (long) ~0L which becomes -1 when casted from signed long to longlong and then casted to ulonglong. When (ulonglong) -1 is compared with maximal value for GET_ULONG data type, we adjust it to (ulonglong) ULONG_MAX and throw the warning. Fixed by using the right max size. Max values for the variables (from mysqld.cc) ---------------------------- 1. key_buffer_size 5.0: ULONG_MAX 5.1: SIZE_T_MAX 6.0: SIZE_T_MAX 2. read_buffer_size and write_buffer_size 5.0: INT_MAX32 5.1: INT_MAX32 6.0: INT_MAX32 3. sort_buffer_size (aka myisam_sort_buffer_size) 5.0: UINT_MAX32 5.1: ULONG_MAX 6.0: ULONG_MAX Note: testcase not attached --- myisam/myisamchk.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/myisam/myisamchk.c b/myisam/myisamchk.c index b1a61f2f373..11d3ac2e430 100644 --- a/myisam/myisamchk.c +++ b/myisam/myisamchk.c @@ -295,7 +295,7 @@ static struct my_option my_long_options[] = { "key_buffer_size", OPT_KEY_BUFFER_SIZE, "", (gptr*) &check_param.use_buffers, (gptr*) &check_param.use_buffers, 0, GET_ULONG, REQUIRED_ARG, (long) USE_BUFFER_INIT, (long) MALLOC_OVERHEAD, - (long) ~0L, (long) MALLOC_OVERHEAD, (long) IO_SIZE, 0}, + ULONG_MAX, (long) MALLOC_OVERHEAD, (long) IO_SIZE, 0}, { "key_cache_block_size", OPT_KEY_CACHE_BLOCK_SIZE, "", (gptr*) &opt_key_cache_block_size, (gptr*) &opt_key_cache_block_size, 0, @@ -309,17 +309,17 @@ static struct my_option my_long_options[] = (gptr*) &check_param.read_buffer_length, (gptr*) &check_param.read_buffer_length, 0, GET_ULONG, REQUIRED_ARG, (long) READ_BUFFER_INIT, (long) MALLOC_OVERHEAD, - (long) ~0L, (long) MALLOC_OVERHEAD, (long) 1L, 0}, + INT_MAX32, (long) MALLOC_OVERHEAD, (long) 1L, 0}, { "write_buffer_size", OPT_WRITE_BUFFER_SIZE, "", (gptr*) &check_param.write_buffer_length, (gptr*) &check_param.write_buffer_length, 0, GET_ULONG, REQUIRED_ARG, (long) READ_BUFFER_INIT, (long) MALLOC_OVERHEAD, - (long) ~0L, (long) MALLOC_OVERHEAD, (long) 1L, 0}, + INT_MAX32, (long) MALLOC_OVERHEAD, (long) 1L, 0}, { "sort_buffer_size", OPT_SORT_BUFFER_SIZE, "", (gptr*) &check_param.sort_buffer_length, (gptr*) &check_param.sort_buffer_length, 0, GET_ULONG, REQUIRED_ARG, (long) SORT_BUFFER_INIT, (long) (MIN_SORT_BUFFER + MALLOC_OVERHEAD), - (long) ~0L, (long) MALLOC_OVERHEAD, (long) 1L, 0}, + UINT_MAX32, (long) MALLOC_OVERHEAD, (long) 1L, 0}, { "sort_key_blocks", OPT_SORT_KEY_BLOCKS, "", (gptr*) &check_param.sort_key_blocks, (gptr*) &check_param.sort_key_blocks, 0, GET_ULONG, REQUIRED_ARG, From 73a5527e466c77fbd494337336ce3cac0c0e8c44 Mon Sep 17 00:00:00 2001 From: Date: Fri, 4 Sep 2009 09:33:45 +0800 Subject: [PATCH 38/68] BUG#45581 Test rpl_row_sp006_InnoDB fails randomly: Unknown database 'mysqltest1' Essentially, Bug#45574 results in this bug. The 'CREATE DATABASE IF NOT EXISTS' statement was not binlogged, when the database has existed. Sometimes, the master and slaves become inconsistent. The "CREATE DATABASE IF NOT EXISTS mysqltest1" statement is not binlogged if the db 'mysqltest1' existed before the test case is executed. So the db 'mysqltest1' can't be created on slave. Patch of Bug#45574 has resolved this problem. But I think it is better to replace 'mysqltest1' by default db 'test'. --- mysql-test/extra/rpl_tests/rpl_row_sp006.test | 41 +++++++++---------- .../suite/rpl/r/rpl_row_sp006_InnoDB.result | 36 ++++++++-------- 2 files changed, 36 insertions(+), 41 deletions(-) diff --git a/mysql-test/extra/rpl_tests/rpl_row_sp006.test b/mysql-test/extra/rpl_tests/rpl_row_sp006.test index 897d7e492bf..16a8374ae7f 100644 --- a/mysql-test/extra/rpl_tests/rpl_row_sp006.test +++ b/mysql-test/extra/rpl_tests/rpl_row_sp006.test @@ -9,29 +9,27 @@ ############################################################################# # Begin clean up test section -connection master; --disable_warnings -create database if not exists mysqltest1; -DROP PROCEDURE IF EXISTS mysqltest1.p1; -DROP PROCEDURE IF EXISTS mysqltest1.p2; -DROP TABLE IF EXISTS mysqltest1.t2; -DROP TABLE IF EXISTS mysqltest1.t1; +DROP TABLE IF EXISTS t1; +DROP TABLE IF EXISTS t2; +DROP PROCEDURE IF EXISTS p1; +DROP PROCEDURE IF EXISTS p2; --enable_warnings # End of cleanup # Begin test section 1 -eval CREATE TABLE IF NOT EXISTS mysqltest1.t1(name CHAR(16), birth DATE,PRIMARY KEY(name))ENGINE=$engine_type; -eval CREATE TABLE IF NOT EXISTS mysqltest1.t2(name CHAR(16), age INT ,PRIMARY KEY(name))ENGINE=$engine_type; +eval CREATE TABLE IF NOT EXISTS t1(name CHAR(16), birth DATE,PRIMARY KEY(name))ENGINE=$engine_type; +eval CREATE TABLE IF NOT EXISTS t2(name CHAR(16), age INT ,PRIMARY KEY(name))ENGINE=$engine_type; delimiter |; -CREATE PROCEDURE mysqltest1.p1() +CREATE PROCEDURE p1() BEGIN DECLARE done INT DEFAULT 0; DECLARE spa CHAR(16); DECLARE spb INT; DECLARE cur1 CURSOR FOR SELECT name, (YEAR(CURDATE())-YEAR(birth))-(RIGHT(CURDATE(),5) $MYSQLTEST_VARDIR/tmp/sp006_master.sql ---exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/sp006_slave.sql +--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/sp006_master.sql +--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/sp006_slave.sql -DROP PROCEDURE IF EXISTS mysqltest1.p1; -DROP PROCEDURE IF EXISTS mysqltest1.p2; -DROP TABLE IF EXISTS mysqltest1.t1; -DROP TABLE IF EXISTS mysqltest1.t2; -DROP DATABASE mysqltest1; +DROP TABLE t1; +DROP TABLE t2; +DROP PROCEDURE p1; +DROP PROCEDURE p2; # Lets compare. Note: If they match test will pass, if they do not match # the test will show that the diff statement failed and not reject file diff --git a/mysql-test/suite/rpl/r/rpl_row_sp006_InnoDB.result b/mysql-test/suite/rpl/r/rpl_row_sp006_InnoDB.result index 8339e77d3a0..6792a701577 100644 --- a/mysql-test/suite/rpl/r/rpl_row_sp006_InnoDB.result +++ b/mysql-test/suite/rpl/r/rpl_row_sp006_InnoDB.result @@ -4,21 +4,20 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; -create database if not exists mysqltest1; -DROP PROCEDURE IF EXISTS mysqltest1.p1; -DROP PROCEDURE IF EXISTS mysqltest1.p2; -DROP TABLE IF EXISTS mysqltest1.t2; -DROP TABLE IF EXISTS mysqltest1.t1; -CREATE TABLE IF NOT EXISTS mysqltest1.t1(name CHAR(16), birth DATE,PRIMARY KEY(name))ENGINE=InnoDB; -CREATE TABLE IF NOT EXISTS mysqltest1.t2(name CHAR(16), age INT ,PRIMARY KEY(name))ENGINE=InnoDB; -CREATE PROCEDURE mysqltest1.p1() +DROP TABLE IF EXISTS t1; +DROP TABLE IF EXISTS t2; +DROP PROCEDURE IF EXISTS p1; +DROP PROCEDURE IF EXISTS p2; +CREATE TABLE IF NOT EXISTS t1(name CHAR(16), birth DATE,PRIMARY KEY(name))ENGINE=InnoDB; +CREATE TABLE IF NOT EXISTS t2(name CHAR(16), age INT ,PRIMARY KEY(name))ENGINE=InnoDB; +CREATE PROCEDURE p1() BEGIN DECLARE done INT DEFAULT 0; DECLARE spa CHAR(16); DECLARE spb INT; DECLARE cur1 CURSOR FOR SELECT name, (YEAR(CURDATE())-YEAR(birth))-(RIGHT(CURDATE(),5) Date: Fri, 4 Sep 2009 09:27:11 +0530 Subject: [PATCH 39/68] Bug#45823 Assertion failure in file row/row0mysql.c line 1386 Inserting a negative value in the autoincrement column of a partitioned innodb table was causing the value of the auto increment counter to wrap around into a very large positive value. The consequences are the same as if a very large positive value was inserted into a column, e.g. reduced autoincrement range, failure to read autoincrement counter. The current patch ensures that before calculating the next auto increment value, the current value is within the positive maximum allowed limit. --- .../parts/inc/partition_auto_increment.inc | 192 ++++++++++++++++++ .../r/partition_auto_increment_innodb.result | 191 +++++++++++++++++ .../r/partition_auto_increment_memory.result | 191 +++++++++++++++++ .../r/partition_auto_increment_myisam.result | 191 +++++++++++++++++ .../r/partition_auto_increment_ndb.result | 191 +++++++++++++++++ .../t/partition_auto_increment_archive.test | 3 + .../t/partition_auto_increment_blackhole.test | 3 + sql/ha_partition.cc | 4 +- sql/ha_partition.h | 4 +- 9 files changed, 967 insertions(+), 3 deletions(-) diff --git a/mysql-test/suite/parts/inc/partition_auto_increment.inc b/mysql-test/suite/parts/inc/partition_auto_increment.inc index 6963de90c83..2c615e58ef9 100644 --- a/mysql-test/suite/parts/inc/partition_auto_increment.inc +++ b/mysql-test/suite/parts/inc/partition_auto_increment.inc @@ -623,3 +623,195 @@ SHOW CREATE TABLE t1; SELECT * FROM t1 ORDER BY c1; DROP TABLE t1; +if (!$skip_negative_auto_inc) +{ +--echo ############################################################################# +--echo # Bug #45823 - Assertion failure in file row/row0mysql.c line 1386 +--echo # Bug #43988 - AUTO_INCREMENT errors with partitioned InnoDB tables in 5.1.31 +--echo ############################################################################## + +--echo # Inserting negative autoincrement values into a partition table (partitions >= 4) + +eval CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1), + c2 INT) ENGINE=$engine PARTITION BY HASH(c1) PARTITIONS 4; + +INSERT INTO t(c2) VALUES (10); +INSERT INTO t(c2) VALUES (20); +INSERT INTO t VALUES (-1,-10); +INSERT INTO t(c2) VALUES (30); +INSERT INTO t(c2) VALUES (40); + +SELECT * FROM t ORDER BY c1 ASC; + +DROP TABLE t; + +--echo # Reading from a partition table (partitions >= 2 ) after inserting a negative +--echo # value into the auto increment column + + +eval CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1), + c2 INT) ENGINE=$engine PARTITION BY HASH(c1) PARTITIONS 2; + +INSERT INTO t VALUES (-2,-20); +INSERT INTO t(c2) VALUES (30); + +SELECT * FROM t ORDER BY c1 ASC; + +DROP TABLE t; + +--echo # Inserting negative auto increment value into a partition table (partitions >= 2) +--echo # auto increment value > 2. + +eval CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1), + c2 INT) ENGINE=$engine PARTITION BY HASH(c1) PARTITIONS 2; + +INSERT INTO t VALUES (-4,-20); +INSERT INTO t(c2) VALUES (30); +INSERT INTO t(c2) VALUES (40); + +SELECT * FROM t ORDER BY c1 ASC; + +DROP TABLE t; + +--echo # Inserting -1 into autoincrement column of a partition table (partition >= 4) + +eval CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1), + c2 INT) ENGINE=$engine PARTITION BY HASH(c1) PARTITIONS 4; + +INSERT INTO t(c2) VALUES (10); +INSERT INTO t(c2) VALUES (20); +INSERT INTO t VALUES (-1,-10); + +SELECT * FROM t ORDER BY c1 ASC; + +INSERT INTO t(c2) VALUES (30); + +SELECT * FROM t ORDER BY c1 ASC; + +DROP TABLE t; + +--echo # Deleting from an auto increment table after inserting negative values + +eval CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1), + c2 INT) ENGINE=$engine PARTITION BY HASH(c1) PARTITIONS 4; + +INSERT INTO t(c2) VALUES (10); +INSERT INTO t(c2) VALUES (20); +INSERT INTO t VALUES (-1,-10); +INSERT INTO t(c2) VALUES (30); +INSERT INTO t VALUES (-3,-20); +INSERT INTO t(c2) VALUES (40); + +SELECT * FROM t ORDER BY c1 ASC; + +if (!$skip_delete) +{ +DELETE FROM t WHERE c1 > 1; +} + +SELECT * FROM t ORDER BY c1 ASC; + +DROP TABLE t; + +--echo # Inserting a positive value that exceeds maximum allowed value for an +--echo # Auto Increment column (positive maximum) + +eval CREATE TABLE t (c1 TINYINT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1), + c2 INT) ENGINE=$engine PARTITION BY HASH(c1) PARTITIONS 4; + +INSERT INTO t(c2) VALUES (10); +INSERT INTO t(c2) VALUES (20); +INSERT INTO t VALUES (126,30); +INSERT INTO t VALUES (127,40); + +--error ER_DUP_ENTRY +INSERT INTO t VALUES (128,50); +--error ER_DUP_ENTRY +INSERT INTO t VALUES (129,60); + +SELECT * FROM t ORDER BY c1 ASC; + +DROP TABLE t; + +--echo # Inserting a negative value that goes below minimum allowed value for an +--echo # Auto Increment column (negative minimum) + +eval CREATE TABLE t (c1 TINYINT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1), + c2 INT) ENGINE=$engine PARTITION BY HASH(c1) PARTITIONS 4; + +INSERT INTO t(c2) VALUES (10); +INSERT INTO t(c2) VALUES (20); +INSERT INTO t VALUES (-127,30); +INSERT INTO t VALUES (-128,40); + +--error ER_DUP_ENTRY +INSERT INTO t VALUES (-129,50); +--error ER_DUP_ENTRY +INSERT INTO t VALUES (-130,60); + +SELECT * FROM t ORDER BY c1 ASC; + +DROP TABLE t; + +--echo # Updating the partition table with a negative Auto Increment value + +eval CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1), + c2 INT) ENGINE=$engine PARTITION BY HASH(c1) PARTITIONS 4; + +INSERT INTO t(c2) VALUES (10); +INSERT INTO t(c2) VALUES (20); +INSERT INTO t VALUES (-1,-10); +INSERT INTO t(c2) VALUES (30); + +SELECT * FROM t ORDER BY c1 ASC; + +if (!$skip_update) +{ +UPDATE t SET c1 = -6 WHERE c1 = 2; +} + +SELECT * FROM t ORDER BY c1 ASC; + +INSERT INTO t(c2) VALUES (40); +INSERT INTO t(c2) VALUES (50); + +if (!$skip_update) +{ +UPDATE t SET c1 = -6 WHERE c1 = 2; +} + +SELECT * FROM t ORDER BY c1 ASC; + +DROP TABLE t; + +--echo # Updating the partition table with a value that crosses the upper limits +--echo # on both the positive and the negative side. + +eval CREATE TABLE t (c1 TINYINT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1), + c2 INT) ENGINE=$engine PARTITION BY HASH(c1) PARTITIONS 4; + +INSERT INTO t(c2) VALUES (10); +INSERT INTO t(c2) VALUES (20); +INSERT INTO t VALUES (126,30); +INSERT INTO t VALUES (127,40); + +SELECT * FROM t ORDER BY c1 ASC; + +if (!$skip_update) +{ +UPDATE t SET c1 = 130 where c1 = 127; +} + +SELECT * FROM t ORDER BY c1 ASC; + +if (!$skip_update) +{ +UPDATE t SET c1 = -140 where c1 = 126; +} + +SELECT * FROM t ORDER BY c1 ASC; + +DROP TABLE t; + +--echo ############################################################################## +} diff --git a/mysql-test/suite/parts/r/partition_auto_increment_innodb.result b/mysql-test/suite/parts/r/partition_auto_increment_innodb.result index 9a23cd4364e..6295d14d98f 100644 --- a/mysql-test/suite/parts/r/partition_auto_increment_innodb.result +++ b/mysql-test/suite/parts/r/partition_auto_increment_innodb.result @@ -825,3 +825,194 @@ c1 4 5 DROP TABLE t1; +############################################################################# +# Bug #45823 - Assertion failure in file row/row0mysql.c line 1386 +# Bug #43988 - AUTO_INCREMENT errors with partitioned InnoDB tables in 5.1.31 +############################################################################## +# Inserting negative autoincrement values into a partition table (partitions >= 4) +CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1), +c2 INT) ENGINE='InnoDB' PARTITION BY HASH(c1) PARTITIONS 4; +INSERT INTO t(c2) VALUES (10); +INSERT INTO t(c2) VALUES (20); +INSERT INTO t VALUES (-1,-10); +INSERT INTO t(c2) VALUES (30); +INSERT INTO t(c2) VALUES (40); +SELECT * FROM t ORDER BY c1 ASC; +c1 c2 +-1 -10 +1 10 +2 20 +3 30 +4 40 +DROP TABLE t; +# Reading from a partition table (partitions >= 2 ) after inserting a negative +# value into the auto increment column +CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1), +c2 INT) ENGINE='InnoDB' PARTITION BY HASH(c1) PARTITIONS 2; +INSERT INTO t VALUES (-2,-20); +INSERT INTO t(c2) VALUES (30); +SELECT * FROM t ORDER BY c1 ASC; +c1 c2 +-2 -20 +1 30 +DROP TABLE t; +# Inserting negative auto increment value into a partition table (partitions >= 2) +# auto increment value > 2. +CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1), +c2 INT) ENGINE='InnoDB' PARTITION BY HASH(c1) PARTITIONS 2; +INSERT INTO t VALUES (-4,-20); +INSERT INTO t(c2) VALUES (30); +INSERT INTO t(c2) VALUES (40); +SELECT * FROM t ORDER BY c1 ASC; +c1 c2 +-4 -20 +1 30 +2 40 +DROP TABLE t; +# Inserting -1 into autoincrement column of a partition table (partition >= 4) +CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1), +c2 INT) ENGINE='InnoDB' PARTITION BY HASH(c1) PARTITIONS 4; +INSERT INTO t(c2) VALUES (10); +INSERT INTO t(c2) VALUES (20); +INSERT INTO t VALUES (-1,-10); +SELECT * FROM t ORDER BY c1 ASC; +c1 c2 +-1 -10 +1 10 +2 20 +INSERT INTO t(c2) VALUES (30); +SELECT * FROM t ORDER BY c1 ASC; +c1 c2 +-1 -10 +1 10 +2 20 +3 30 +DROP TABLE t; +# Deleting from an auto increment table after inserting negative values +CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1), +c2 INT) ENGINE='InnoDB' PARTITION BY HASH(c1) PARTITIONS 4; +INSERT INTO t(c2) VALUES (10); +INSERT INTO t(c2) VALUES (20); +INSERT INTO t VALUES (-1,-10); +INSERT INTO t(c2) VALUES (30); +INSERT INTO t VALUES (-3,-20); +INSERT INTO t(c2) VALUES (40); +SELECT * FROM t ORDER BY c1 ASC; +c1 c2 +-3 -20 +-1 -10 +1 10 +2 20 +3 30 +4 40 +DELETE FROM t WHERE c1 > 1; +SELECT * FROM t ORDER BY c1 ASC; +c1 c2 +-3 -20 +-1 -10 +1 10 +DROP TABLE t; +# Inserting a positive value that exceeds maximum allowed value for an +# Auto Increment column (positive maximum) +CREATE TABLE t (c1 TINYINT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1), +c2 INT) ENGINE='InnoDB' PARTITION BY HASH(c1) PARTITIONS 4; +INSERT INTO t(c2) VALUES (10); +INSERT INTO t(c2) VALUES (20); +INSERT INTO t VALUES (126,30); +INSERT INTO t VALUES (127,40); +INSERT INTO t VALUES (128,50); +ERROR 23000: Duplicate entry '127' for key 'PRIMARY' +INSERT INTO t VALUES (129,60); +ERROR 23000: Duplicate entry '127' for key 'PRIMARY' +SELECT * FROM t ORDER BY c1 ASC; +c1 c2 +1 10 +2 20 +126 30 +127 40 +DROP TABLE t; +# Inserting a negative value that goes below minimum allowed value for an +# Auto Increment column (negative minimum) +CREATE TABLE t (c1 TINYINT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1), +c2 INT) ENGINE='InnoDB' PARTITION BY HASH(c1) PARTITIONS 4; +INSERT INTO t(c2) VALUES (10); +INSERT INTO t(c2) VALUES (20); +INSERT INTO t VALUES (-127,30); +INSERT INTO t VALUES (-128,40); +INSERT INTO t VALUES (-129,50); +ERROR 23000: Duplicate entry '-128' for key 'PRIMARY' +INSERT INTO t VALUES (-130,60); +ERROR 23000: Duplicate entry '-128' for key 'PRIMARY' +SELECT * FROM t ORDER BY c1 ASC; +c1 c2 +-128 40 +-127 30 +1 10 +2 20 +DROP TABLE t; +# Updating the partition table with a negative Auto Increment value +CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1), +c2 INT) ENGINE='InnoDB' PARTITION BY HASH(c1) PARTITIONS 4; +INSERT INTO t(c2) VALUES (10); +INSERT INTO t(c2) VALUES (20); +INSERT INTO t VALUES (-1,-10); +INSERT INTO t(c2) VALUES (30); +SELECT * FROM t ORDER BY c1 ASC; +c1 c2 +-1 -10 +1 10 +2 20 +3 30 +UPDATE t SET c1 = -6 WHERE c1 = 2; +SELECT * FROM t ORDER BY c1 ASC; +c1 c2 +-6 20 +-1 -10 +1 10 +3 30 +INSERT INTO t(c2) VALUES (40); +INSERT INTO t(c2) VALUES (50); +UPDATE t SET c1 = -6 WHERE c1 = 2; +SELECT * FROM t ORDER BY c1 ASC; +c1 c2 +-6 20 +-1 -10 +1 10 +3 30 +4 40 +5 50 +DROP TABLE t; +# Updating the partition table with a value that crosses the upper limits +# on both the positive and the negative side. +CREATE TABLE t (c1 TINYINT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1), +c2 INT) ENGINE='InnoDB' PARTITION BY HASH(c1) PARTITIONS 4; +INSERT INTO t(c2) VALUES (10); +INSERT INTO t(c2) VALUES (20); +INSERT INTO t VALUES (126,30); +INSERT INTO t VALUES (127,40); +SELECT * FROM t ORDER BY c1 ASC; +c1 c2 +1 10 +2 20 +126 30 +127 40 +UPDATE t SET c1 = 130 where c1 = 127; +Warnings: +Warning 1264 Out of range value for column 'c1' at row 1 +SELECT * FROM t ORDER BY c1 ASC; +c1 c2 +1 10 +2 20 +126 30 +127 40 +UPDATE t SET c1 = -140 where c1 = 126; +Warnings: +Warning 1264 Out of range value for column 'c1' at row 1 +SELECT * FROM t ORDER BY c1 ASC; +c1 c2 +-128 30 +1 10 +2 20 +127 40 +DROP TABLE t; +############################################################################## diff --git a/mysql-test/suite/parts/r/partition_auto_increment_memory.result b/mysql-test/suite/parts/r/partition_auto_increment_memory.result index f4d783825f4..6e3b990dc0f 100644 --- a/mysql-test/suite/parts/r/partition_auto_increment_memory.result +++ b/mysql-test/suite/parts/r/partition_auto_increment_memory.result @@ -851,3 +851,194 @@ c1 4 5 DROP TABLE t1; +############################################################################# +# Bug #45823 - Assertion failure in file row/row0mysql.c line 1386 +# Bug #43988 - AUTO_INCREMENT errors with partitioned InnoDB tables in 5.1.31 +############################################################################## +# Inserting negative autoincrement values into a partition table (partitions >= 4) +CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1), +c2 INT) ENGINE='Memory' PARTITION BY HASH(c1) PARTITIONS 4; +INSERT INTO t(c2) VALUES (10); +INSERT INTO t(c2) VALUES (20); +INSERT INTO t VALUES (-1,-10); +INSERT INTO t(c2) VALUES (30); +INSERT INTO t(c2) VALUES (40); +SELECT * FROM t ORDER BY c1 ASC; +c1 c2 +-1 -10 +1 10 +2 20 +3 30 +4 40 +DROP TABLE t; +# Reading from a partition table (partitions >= 2 ) after inserting a negative +# value into the auto increment column +CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1), +c2 INT) ENGINE='Memory' PARTITION BY HASH(c1) PARTITIONS 2; +INSERT INTO t VALUES (-2,-20); +INSERT INTO t(c2) VALUES (30); +SELECT * FROM t ORDER BY c1 ASC; +c1 c2 +-2 -20 +1 30 +DROP TABLE t; +# Inserting negative auto increment value into a partition table (partitions >= 2) +# auto increment value > 2. +CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1), +c2 INT) ENGINE='Memory' PARTITION BY HASH(c1) PARTITIONS 2; +INSERT INTO t VALUES (-4,-20); +INSERT INTO t(c2) VALUES (30); +INSERT INTO t(c2) VALUES (40); +SELECT * FROM t ORDER BY c1 ASC; +c1 c2 +-4 -20 +1 30 +2 40 +DROP TABLE t; +# Inserting -1 into autoincrement column of a partition table (partition >= 4) +CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1), +c2 INT) ENGINE='Memory' PARTITION BY HASH(c1) PARTITIONS 4; +INSERT INTO t(c2) VALUES (10); +INSERT INTO t(c2) VALUES (20); +INSERT INTO t VALUES (-1,-10); +SELECT * FROM t ORDER BY c1 ASC; +c1 c2 +-1 -10 +1 10 +2 20 +INSERT INTO t(c2) VALUES (30); +SELECT * FROM t ORDER BY c1 ASC; +c1 c2 +-1 -10 +1 10 +2 20 +3 30 +DROP TABLE t; +# Deleting from an auto increment table after inserting negative values +CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1), +c2 INT) ENGINE='Memory' PARTITION BY HASH(c1) PARTITIONS 4; +INSERT INTO t(c2) VALUES (10); +INSERT INTO t(c2) VALUES (20); +INSERT INTO t VALUES (-1,-10); +INSERT INTO t(c2) VALUES (30); +INSERT INTO t VALUES (-3,-20); +INSERT INTO t(c2) VALUES (40); +SELECT * FROM t ORDER BY c1 ASC; +c1 c2 +-3 -20 +-1 -10 +1 10 +2 20 +3 30 +4 40 +DELETE FROM t WHERE c1 > 1; +SELECT * FROM t ORDER BY c1 ASC; +c1 c2 +-3 -20 +-1 -10 +1 10 +DROP TABLE t; +# Inserting a positive value that exceeds maximum allowed value for an +# Auto Increment column (positive maximum) +CREATE TABLE t (c1 TINYINT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1), +c2 INT) ENGINE='Memory' PARTITION BY HASH(c1) PARTITIONS 4; +INSERT INTO t(c2) VALUES (10); +INSERT INTO t(c2) VALUES (20); +INSERT INTO t VALUES (126,30); +INSERT INTO t VALUES (127,40); +INSERT INTO t VALUES (128,50); +ERROR 23000: Duplicate entry '127' for key 'PRIMARY' +INSERT INTO t VALUES (129,60); +ERROR 23000: Duplicate entry '127' for key 'PRIMARY' +SELECT * FROM t ORDER BY c1 ASC; +c1 c2 +1 10 +2 20 +126 30 +127 40 +DROP TABLE t; +# Inserting a negative value that goes below minimum allowed value for an +# Auto Increment column (negative minimum) +CREATE TABLE t (c1 TINYINT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1), +c2 INT) ENGINE='Memory' PARTITION BY HASH(c1) PARTITIONS 4; +INSERT INTO t(c2) VALUES (10); +INSERT INTO t(c2) VALUES (20); +INSERT INTO t VALUES (-127,30); +INSERT INTO t VALUES (-128,40); +INSERT INTO t VALUES (-129,50); +ERROR 23000: Duplicate entry '-128' for key 'PRIMARY' +INSERT INTO t VALUES (-130,60); +ERROR 23000: Duplicate entry '-128' for key 'PRIMARY' +SELECT * FROM t ORDER BY c1 ASC; +c1 c2 +-128 40 +-127 30 +1 10 +2 20 +DROP TABLE t; +# Updating the partition table with a negative Auto Increment value +CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1), +c2 INT) ENGINE='Memory' PARTITION BY HASH(c1) PARTITIONS 4; +INSERT INTO t(c2) VALUES (10); +INSERT INTO t(c2) VALUES (20); +INSERT INTO t VALUES (-1,-10); +INSERT INTO t(c2) VALUES (30); +SELECT * FROM t ORDER BY c1 ASC; +c1 c2 +-1 -10 +1 10 +2 20 +3 30 +UPDATE t SET c1 = -6 WHERE c1 = 2; +SELECT * FROM t ORDER BY c1 ASC; +c1 c2 +-6 20 +-1 -10 +1 10 +3 30 +INSERT INTO t(c2) VALUES (40); +INSERT INTO t(c2) VALUES (50); +UPDATE t SET c1 = -6 WHERE c1 = 2; +SELECT * FROM t ORDER BY c1 ASC; +c1 c2 +-6 20 +-1 -10 +1 10 +3 30 +4 40 +5 50 +DROP TABLE t; +# Updating the partition table with a value that crosses the upper limits +# on both the positive and the negative side. +CREATE TABLE t (c1 TINYINT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1), +c2 INT) ENGINE='Memory' PARTITION BY HASH(c1) PARTITIONS 4; +INSERT INTO t(c2) VALUES (10); +INSERT INTO t(c2) VALUES (20); +INSERT INTO t VALUES (126,30); +INSERT INTO t VALUES (127,40); +SELECT * FROM t ORDER BY c1 ASC; +c1 c2 +1 10 +2 20 +126 30 +127 40 +UPDATE t SET c1 = 130 where c1 = 127; +Warnings: +Warning 1264 Out of range value for column 'c1' at row 1 +SELECT * FROM t ORDER BY c1 ASC; +c1 c2 +1 10 +2 20 +126 30 +127 40 +UPDATE t SET c1 = -140 where c1 = 126; +Warnings: +Warning 1264 Out of range value for column 'c1' at row 1 +SELECT * FROM t ORDER BY c1 ASC; +c1 c2 +-128 30 +1 10 +2 20 +127 40 +DROP TABLE t; +############################################################################## diff --git a/mysql-test/suite/parts/r/partition_auto_increment_myisam.result b/mysql-test/suite/parts/r/partition_auto_increment_myisam.result index 6abf08b68a0..047b974f0a3 100644 --- a/mysql-test/suite/parts/r/partition_auto_increment_myisam.result +++ b/mysql-test/suite/parts/r/partition_auto_increment_myisam.result @@ -870,3 +870,194 @@ c1 4 5 DROP TABLE t1; +############################################################################# +# Bug #45823 - Assertion failure in file row/row0mysql.c line 1386 +# Bug #43988 - AUTO_INCREMENT errors with partitioned InnoDB tables in 5.1.31 +############################################################################## +# Inserting negative autoincrement values into a partition table (partitions >= 4) +CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1), +c2 INT) ENGINE='MyISAM' PARTITION BY HASH(c1) PARTITIONS 4; +INSERT INTO t(c2) VALUES (10); +INSERT INTO t(c2) VALUES (20); +INSERT INTO t VALUES (-1,-10); +INSERT INTO t(c2) VALUES (30); +INSERT INTO t(c2) VALUES (40); +SELECT * FROM t ORDER BY c1 ASC; +c1 c2 +-1 -10 +1 10 +2 20 +3 30 +4 40 +DROP TABLE t; +# Reading from a partition table (partitions >= 2 ) after inserting a negative +# value into the auto increment column +CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1), +c2 INT) ENGINE='MyISAM' PARTITION BY HASH(c1) PARTITIONS 2; +INSERT INTO t VALUES (-2,-20); +INSERT INTO t(c2) VALUES (30); +SELECT * FROM t ORDER BY c1 ASC; +c1 c2 +-2 -20 +1 30 +DROP TABLE t; +# Inserting negative auto increment value into a partition table (partitions >= 2) +# auto increment value > 2. +CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1), +c2 INT) ENGINE='MyISAM' PARTITION BY HASH(c1) PARTITIONS 2; +INSERT INTO t VALUES (-4,-20); +INSERT INTO t(c2) VALUES (30); +INSERT INTO t(c2) VALUES (40); +SELECT * FROM t ORDER BY c1 ASC; +c1 c2 +-4 -20 +1 30 +2 40 +DROP TABLE t; +# Inserting -1 into autoincrement column of a partition table (partition >= 4) +CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1), +c2 INT) ENGINE='MyISAM' PARTITION BY HASH(c1) PARTITIONS 4; +INSERT INTO t(c2) VALUES (10); +INSERT INTO t(c2) VALUES (20); +INSERT INTO t VALUES (-1,-10); +SELECT * FROM t ORDER BY c1 ASC; +c1 c2 +-1 -10 +1 10 +2 20 +INSERT INTO t(c2) VALUES (30); +SELECT * FROM t ORDER BY c1 ASC; +c1 c2 +-1 -10 +1 10 +2 20 +3 30 +DROP TABLE t; +# Deleting from an auto increment table after inserting negative values +CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1), +c2 INT) ENGINE='MyISAM' PARTITION BY HASH(c1) PARTITIONS 4; +INSERT INTO t(c2) VALUES (10); +INSERT INTO t(c2) VALUES (20); +INSERT INTO t VALUES (-1,-10); +INSERT INTO t(c2) VALUES (30); +INSERT INTO t VALUES (-3,-20); +INSERT INTO t(c2) VALUES (40); +SELECT * FROM t ORDER BY c1 ASC; +c1 c2 +-3 -20 +-1 -10 +1 10 +2 20 +3 30 +4 40 +DELETE FROM t WHERE c1 > 1; +SELECT * FROM t ORDER BY c1 ASC; +c1 c2 +-3 -20 +-1 -10 +1 10 +DROP TABLE t; +# Inserting a positive value that exceeds maximum allowed value for an +# Auto Increment column (positive maximum) +CREATE TABLE t (c1 TINYINT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1), +c2 INT) ENGINE='MyISAM' PARTITION BY HASH(c1) PARTITIONS 4; +INSERT INTO t(c2) VALUES (10); +INSERT INTO t(c2) VALUES (20); +INSERT INTO t VALUES (126,30); +INSERT INTO t VALUES (127,40); +INSERT INTO t VALUES (128,50); +ERROR 23000: Duplicate entry '127' for key 'PRIMARY' +INSERT INTO t VALUES (129,60); +ERROR 23000: Duplicate entry '127' for key 'PRIMARY' +SELECT * FROM t ORDER BY c1 ASC; +c1 c2 +1 10 +2 20 +126 30 +127 40 +DROP TABLE t; +# Inserting a negative value that goes below minimum allowed value for an +# Auto Increment column (negative minimum) +CREATE TABLE t (c1 TINYINT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1), +c2 INT) ENGINE='MyISAM' PARTITION BY HASH(c1) PARTITIONS 4; +INSERT INTO t(c2) VALUES (10); +INSERT INTO t(c2) VALUES (20); +INSERT INTO t VALUES (-127,30); +INSERT INTO t VALUES (-128,40); +INSERT INTO t VALUES (-129,50); +ERROR 23000: Duplicate entry '-128' for key 'PRIMARY' +INSERT INTO t VALUES (-130,60); +ERROR 23000: Duplicate entry '-128' for key 'PRIMARY' +SELECT * FROM t ORDER BY c1 ASC; +c1 c2 +-128 40 +-127 30 +1 10 +2 20 +DROP TABLE t; +# Updating the partition table with a negative Auto Increment value +CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1), +c2 INT) ENGINE='MyISAM' PARTITION BY HASH(c1) PARTITIONS 4; +INSERT INTO t(c2) VALUES (10); +INSERT INTO t(c2) VALUES (20); +INSERT INTO t VALUES (-1,-10); +INSERT INTO t(c2) VALUES (30); +SELECT * FROM t ORDER BY c1 ASC; +c1 c2 +-1 -10 +1 10 +2 20 +3 30 +UPDATE t SET c1 = -6 WHERE c1 = 2; +SELECT * FROM t ORDER BY c1 ASC; +c1 c2 +-6 20 +-1 -10 +1 10 +3 30 +INSERT INTO t(c2) VALUES (40); +INSERT INTO t(c2) VALUES (50); +UPDATE t SET c1 = -6 WHERE c1 = 2; +SELECT * FROM t ORDER BY c1 ASC; +c1 c2 +-6 20 +-1 -10 +1 10 +3 30 +4 40 +5 50 +DROP TABLE t; +# Updating the partition table with a value that crosses the upper limits +# on both the positive and the negative side. +CREATE TABLE t (c1 TINYINT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1), +c2 INT) ENGINE='MyISAM' PARTITION BY HASH(c1) PARTITIONS 4; +INSERT INTO t(c2) VALUES (10); +INSERT INTO t(c2) VALUES (20); +INSERT INTO t VALUES (126,30); +INSERT INTO t VALUES (127,40); +SELECT * FROM t ORDER BY c1 ASC; +c1 c2 +1 10 +2 20 +126 30 +127 40 +UPDATE t SET c1 = 130 where c1 = 127; +Warnings: +Warning 1264 Out of range value for column 'c1' at row 1 +SELECT * FROM t ORDER BY c1 ASC; +c1 c2 +1 10 +2 20 +126 30 +127 40 +UPDATE t SET c1 = -140 where c1 = 126; +Warnings: +Warning 1264 Out of range value for column 'c1' at row 1 +SELECT * FROM t ORDER BY c1 ASC; +c1 c2 +-128 30 +1 10 +2 20 +127 40 +DROP TABLE t; +############################################################################## diff --git a/mysql-test/suite/parts/r/partition_auto_increment_ndb.result b/mysql-test/suite/parts/r/partition_auto_increment_ndb.result index 5a1c5b06b36..317669be7ad 100644 --- a/mysql-test/suite/parts/r/partition_auto_increment_ndb.result +++ b/mysql-test/suite/parts/r/partition_auto_increment_ndb.result @@ -846,3 +846,194 @@ c1 4 5 DROP TABLE t1; +############################################################################# +# Bug #45823 - Assertion failure in file row/row0mysql.c line 1386 +# Bug #43988 - AUTO_INCREMENT errors with partitioned InnoDB tables in 5.1.31 +############################################################################## +# Inserting negative autoincrement values into a partition table (partitions >= 4) +CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1), +c2 INT) ENGINE='NDB' PARTITION BY HASH(c1) PARTITIONS 4; +INSERT INTO t(c2) VALUES (10); +INSERT INTO t(c2) VALUES (20); +INSERT INTO t VALUES (-1,-10); +INSERT INTO t(c2) VALUES (30); +INSERT INTO t(c2) VALUES (40); +SELECT * FROM t ORDER BY c1 ASC; +c1 c2 +-1 -10 +1 10 +2 20 +3 30 +4 40 +DROP TABLE t; +# Reading from a partition table (partitions >= 2 ) after inserting a negative +# value into the auto increment column +CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1), +c2 INT) ENGINE='NDB' PARTITION BY HASH(c1) PARTITIONS 2; +INSERT INTO t VALUES (-2,-20); +INSERT INTO t(c2) VALUES (30); +SELECT * FROM t ORDER BY c1 ASC; +c1 c2 +-2 -20 +1 30 +DROP TABLE t; +# Inserting negative auto increment value into a partition table (partitions >= 2) +# auto increment value > 2. +CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1), +c2 INT) ENGINE='NDB' PARTITION BY HASH(c1) PARTITIONS 2; +INSERT INTO t VALUES (-4,-20); +INSERT INTO t(c2) VALUES (30); +INSERT INTO t(c2) VALUES (40); +SELECT * FROM t ORDER BY c1 ASC; +c1 c2 +-4 -20 +1 30 +2 40 +DROP TABLE t; +# Inserting -1 into autoincrement column of a partition table (partition >= 4) +CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1), +c2 INT) ENGINE='NDB' PARTITION BY HASH(c1) PARTITIONS 4; +INSERT INTO t(c2) VALUES (10); +INSERT INTO t(c2) VALUES (20); +INSERT INTO t VALUES (-1,-10); +SELECT * FROM t ORDER BY c1 ASC; +c1 c2 +-1 -10 +1 10 +2 20 +INSERT INTO t(c2) VALUES (30); +SELECT * FROM t ORDER BY c1 ASC; +c1 c2 +-1 -10 +1 10 +2 20 +3 30 +DROP TABLE t; +# Deleting from an auto increment table after inserting negative values +CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1), +c2 INT) ENGINE='NDB' PARTITION BY HASH(c1) PARTITIONS 4; +INSERT INTO t(c2) VALUES (10); +INSERT INTO t(c2) VALUES (20); +INSERT INTO t VALUES (-1,-10); +INSERT INTO t(c2) VALUES (30); +INSERT INTO t VALUES (-3,-20); +INSERT INTO t(c2) VALUES (40); +SELECT * FROM t ORDER BY c1 ASC; +c1 c2 +-3 -20 +-1 -10 +1 10 +2 20 +3 30 +4 40 +DELETE FROM t WHERE c1 > 1; +SELECT * FROM t ORDER BY c1 ASC; +c1 c2 +-3 -20 +-1 -10 +1 10 +DROP TABLE t; +# Inserting a positive value that exceeds maximum allowed value for an +# Auto Increment column (positive maximum) +CREATE TABLE t (c1 TINYINT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1), +c2 INT) ENGINE='NDB' PARTITION BY HASH(c1) PARTITIONS 4; +INSERT INTO t(c2) VALUES (10); +INSERT INTO t(c2) VALUES (20); +INSERT INTO t VALUES (126,30); +INSERT INTO t VALUES (127,40); +INSERT INTO t VALUES (128,50); +ERROR 23000: Duplicate entry '127' for key 'PRIMARY' +INSERT INTO t VALUES (129,60); +ERROR 23000: Duplicate entry '127' for key 'PRIMARY' +SELECT * FROM t ORDER BY c1 ASC; +c1 c2 +1 10 +2 20 +126 30 +127 40 +DROP TABLE t; +# Inserting a negative value that goes below minimum allowed value for an +# Auto Increment column (negative minimum) +CREATE TABLE t (c1 TINYINT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1), +c2 INT) ENGINE='NDB' PARTITION BY HASH(c1) PARTITIONS 4; +INSERT INTO t(c2) VALUES (10); +INSERT INTO t(c2) VALUES (20); +INSERT INTO t VALUES (-127,30); +INSERT INTO t VALUES (-128,40); +INSERT INTO t VALUES (-129,50); +ERROR 23000: Duplicate entry '-128' for key 'PRIMARY' +INSERT INTO t VALUES (-130,60); +ERROR 23000: Duplicate entry '-128' for key 'PRIMARY' +SELECT * FROM t ORDER BY c1 ASC; +c1 c2 +-128 40 +-127 30 +1 10 +2 20 +DROP TABLE t; +# Updating the partition table with a negative Auto Increment value +CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1), +c2 INT) ENGINE='NDB' PARTITION BY HASH(c1) PARTITIONS 4; +INSERT INTO t(c2) VALUES (10); +INSERT INTO t(c2) VALUES (20); +INSERT INTO t VALUES (-1,-10); +INSERT INTO t(c2) VALUES (30); +SELECT * FROM t ORDER BY c1 ASC; +c1 c2 +-1 -10 +1 10 +2 20 +3 30 +UPDATE t SET c1 = -6 WHERE c1 = 2; +SELECT * FROM t ORDER BY c1 ASC; +c1 c2 +-6 20 +-1 -10 +1 10 +3 30 +INSERT INTO t(c2) VALUES (40); +INSERT INTO t(c2) VALUES (50); +UPDATE t SET c1 = -6 WHERE c1 = 2; +SELECT * FROM t ORDER BY c1 ASC; +c1 c2 +-6 20 +-1 -10 +1 10 +3 30 +4 40 +5 50 +DROP TABLE t; +# Updating the partition table with a value that crosses the upper limits +# on both the positive and the negative side. +CREATE TABLE t (c1 TINYINT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1), +c2 INT) ENGINE='NDB' PARTITION BY HASH(c1) PARTITIONS 4; +INSERT INTO t(c2) VALUES (10); +INSERT INTO t(c2) VALUES (20); +INSERT INTO t VALUES (126,30); +INSERT INTO t VALUES (127,40); +SELECT * FROM t ORDER BY c1 ASC; +c1 c2 +1 10 +2 20 +126 30 +127 40 +UPDATE t SET c1 = 130 where c1 = 127; +Warnings: +Warning 1264 Out of range value for column 'c1' at row 1 +SELECT * FROM t ORDER BY c1 ASC; +c1 c2 +1 10 +2 20 +126 30 +127 40 +UPDATE t SET c1 = -140 where c1 = 126; +Warnings: +Warning 1264 Out of range value for column 'c1' at row 1 +SELECT * FROM t ORDER BY c1 ASC; +c1 c2 +-128 30 +1 10 +2 20 +127 40 +DROP TABLE t; +############################################################################## diff --git a/mysql-test/suite/parts/t/partition_auto_increment_archive.test b/mysql-test/suite/parts/t/partition_auto_increment_archive.test index fb09557204f..e99a0b23b36 100644 --- a/mysql-test/suite/parts/t/partition_auto_increment_archive.test +++ b/mysql-test/suite/parts/t/partition_auto_increment_archive.test @@ -30,6 +30,9 @@ let $skip_delete= 1; let $skip_truncate= 1; let $skip_update= 1; let $only_ai_pk= 1; +# Bug#45823 Assertion failure in file row/row0mysql.c line 1386 +# Archive does not handle negative autoincrement values correctly +let $skip_negative_auto_inc= 1; ##### Storage engine to be tested let $engine= 'Archive'; diff --git a/mysql-test/suite/parts/t/partition_auto_increment_blackhole.test b/mysql-test/suite/parts/t/partition_auto_increment_blackhole.test index 64cd96c6173..f92dc33f263 100644 --- a/mysql-test/suite/parts/t/partition_auto_increment_blackhole.test +++ b/mysql-test/suite/parts/t/partition_auto_increment_blackhole.test @@ -25,6 +25,9 @@ #------------------------------------------------------------------------------# # Engine specific settings and requirements --source include/have_blackhole.inc +# Bug#45823 Assertion failure in file row/row0mysql.c line 1386 +# Blackhole does not handle negative autoincrement values correctly +let $skip_negative_auto_inc= 1; ##### Storage engine to be tested let $engine= 'Blackhole'; diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index ac8c46ec4e3..63f8271cca1 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -3024,7 +3024,7 @@ int ha_partition::write_row(uchar * buf) tmp_disable_binlog(thd); /* Do not replicate the low-level changes. */ error= m_file[part_id]->ha_write_row(buf); if (have_auto_increment && !table->s->next_number_keypart) - set_auto_increment_if_higher(table->next_number_field->val_int()); + set_auto_increment_if_higher(table->next_number_field); reenable_binlog(thd); exit: table->timestamp_field_type= orig_timestamp_type; @@ -3128,7 +3128,7 @@ exit: HA_DATA_PARTITION *ha_data= (HA_DATA_PARTITION*) table_share->ha_data; if (!ha_data->auto_inc_initialized) info(HA_STATUS_AUTO); - set_auto_increment_if_higher(table->found_next_number_field->val_int()); + set_auto_increment_if_higher(table->found_next_number_field); } table->timestamp_field_type= orig_timestamp_type; DBUG_RETURN(error); diff --git a/sql/ha_partition.h b/sql/ha_partition.h index 8a81a759e2a..d0301e24a93 100644 --- a/sql/ha_partition.h +++ b/sql/ha_partition.h @@ -936,9 +936,11 @@ private: auto_increment_lock= FALSE; } } - virtual void set_auto_increment_if_higher(const ulonglong nr) + virtual void set_auto_increment_if_higher(Field *field) { HA_DATA_PARTITION *ha_data= (HA_DATA_PARTITION*) table_share->ha_data; + ulonglong nr= (((Field_num*) field)->unsigned_flag || + field->val_int() > 0) ? field->val_int() : 0; lock_auto_increment(); DBUG_ASSERT(ha_data->auto_inc_initialized == TRUE); /* must check when the mutex is taken */ From 81053daf9731145a84827ca0ce58b0097518ccf0 Mon Sep 17 00:00:00 2001 From: Satya B Date: Fri, 4 Sep 2009 11:19:44 +0530 Subject: [PATCH 40/68] Addition to Fix for BUG#46591 - .frm file isn't sync'd with sync_frm enabled for CREATE TABLE...LIKE... Add my_sync.c to mysqltest sources list in CMakeLists.txt --- client/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index a419da5eabf..7426384f0cf 100755 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -33,7 +33,8 @@ ADD_EXECUTABLE(mysql completion_hash.cc mysql.cc readline.cc sql_string.cc ../my TARGET_LINK_LIBRARIES(mysql mysqlclient_notls wsock32) ADD_EXECUTABLE(mysqltest mysqltest.c ../mysys/my_getsystime.c - ../mysys/my_copy.c ../mysys/my_mkdir.c) + ../mysys/my_copy.c ../mysys/my_mkdir.c + ../mysys/my_sync.c) TARGET_LINK_LIBRARIES(mysqltest mysqlclient_notls regex wsock32) ADD_EXECUTABLE(mysqlcheck mysqlcheck.c) From eebffb422b515f6b8a32401679fb202f531a58e3 Mon Sep 17 00:00:00 2001 From: Satya B Date: Fri, 4 Sep 2009 12:21:54 +0530 Subject: [PATCH 41/68] Fix for BUG#46384 - mysqld segfault when trying to create table with same name as existing view When trying to create a table with the same name as existing view with join, mysql server crashes. The problem is when create table is issued with the same name as view, while verifying with the existing tables, we assume that base table object is created always. In this case, since it is a view over multiple tables, we don't have the mysql derived table object. Fixed the logic which checks if there is an existing table to not to assume that table object is created when the base table is view over multiple tables. --- mysql-test/r/create.result | 13 +++++++++++++ mysql-test/t/create.test | 17 +++++++++++++++++ sql/sql_insert.cc | 2 +- 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index d37c1a04daa..dfd376a6bde 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -1559,4 +1559,17 @@ CREATE TABLE IF NOT EXISTS t2 (a INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY) SELECT a FROM t1; ERROR 23000: Duplicate entry '1' for key 1 DROP TABLE t1, t2; +# +# BUG#46384 - mysqld segfault when trying to create table with same +# name as existing view +# +CREATE TABLE t1 (a INT); +CREATE TABLE t2 (a INT); +INSERT INTO t1 VALUES (1),(2),(3); +INSERT INTO t2 VALUES (1),(2),(3); +CREATE VIEW v1 AS SELECT t1.a FROM t1, t2; +CREATE TABLE v1 AS SELECT * FROM t1; +ERROR 42S01: Table 'v1' already exists +DROP VIEW v1; +DROP TABLE t1,t2; End of 5.0 tests diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test index a837653d618..2ec416cfc87 100644 --- a/mysql-test/t/create.test +++ b/mysql-test/t/create.test @@ -1194,5 +1194,22 @@ CREATE TABLE IF NOT EXISTS t2 (a INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY) DROP TABLE t1, t2; +--echo # +--echo # BUG#46384 - mysqld segfault when trying to create table with same +--echo # name as existing view +--echo # + +CREATE TABLE t1 (a INT); +CREATE TABLE t2 (a INT); + +INSERT INTO t1 VALUES (1),(2),(3); +INSERT INTO t2 VALUES (1),(2),(3); + +CREATE VIEW v1 AS SELECT t1.a FROM t1, t2; +--error ER_TABLE_EXISTS_ERROR +CREATE TABLE v1 AS SELECT * FROM t1; + +DROP VIEW v1; +DROP TABLE t1,t2; --echo End of 5.0 tests diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index d2a0f47f1a9..b0958201795 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -3217,7 +3217,7 @@ static TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info, DBUG_EXECUTE_IF("sleep_create_select_before_check_if_exists", my_sleep(6000000);); if (!(create_info->options & HA_LEX_CREATE_TMP_TABLE) && - create_table->table->db_stat) + (create_table->table && create_table->table->db_stat)) { /* Table already exists and was open at open_and_lock_tables() stage. */ if (create_info->options & HA_LEX_CREATE_IF_NOT_EXISTS) From e1d49b814335d77f0835da5a47154b99bd5ddf02 Mon Sep 17 00:00:00 2001 From: Sergey Glukhov Date: Fri, 4 Sep 2009 12:20:53 +0500 Subject: [PATCH 42/68] Bug#45989 memory leak after explain encounters an error in the query Memory allocated in TMP_TABLE_PARAM::copy_field is not cleaned up. The fix is to clean up TMP_TABLE_PARAM::copy_field array in JOIN::destroy. --- mysql-test/r/explain.result | 8 ++++++++ mysql-test/t/explain.test | 11 +++++++++++ sql/sql_select.cc | 2 +- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/explain.result b/mysql-test/r/explain.result index b0adc428e4c..8d3859fd68e 100644 --- a/mysql-test/r/explain.result +++ b/mysql-test/r/explain.result @@ -159,3 +159,11 @@ CREATE TABLE t1 (a INT PRIMARY KEY); EXPLAIN EXTENDED SELECT COUNT(a) FROM t1 USE KEY(a); ERROR HY000: Key 'a' doesn't exist in table 't1' DROP TABLE t1; +CREATE TABLE t1(a LONGTEXT); +INSERT INTO t1 VALUES (repeat('a',@@global.max_allowed_packet)); +INSERT INTO t1 VALUES (repeat('b',@@global.max_allowed_packet)); +EXPLAIN SELECT DISTINCT 1 FROM t1, +(SELECT DISTINCTROW a AS away FROM t1 GROUP BY a WITH ROLLUP) as d1 +WHERE t1.a = d1.a; +ERROR 42S22: Unknown column 'd1.a' in 'where clause' +DROP TABLE t1; diff --git a/mysql-test/t/explain.test b/mysql-test/t/explain.test index 1bc98a8acb1..7b7bdd3563c 100644 --- a/mysql-test/t/explain.test +++ b/mysql-test/t/explain.test @@ -135,5 +135,16 @@ EXPLAIN EXTENDED SELECT COUNT(a) FROM t1 USE KEY(a); DROP TABLE t1; +# +# Bug#45989 memory leak after explain encounters an error in the query +# +CREATE TABLE t1(a LONGTEXT); +INSERT INTO t1 VALUES (repeat('a',@@global.max_allowed_packet)); +INSERT INTO t1 VALUES (repeat('b',@@global.max_allowed_packet)); +--error ER_BAD_FIELD_ERROR +EXPLAIN SELECT DISTINCT 1 FROM t1, + (SELECT DISTINCTROW a AS away FROM t1 GROUP BY a WITH ROLLUP) as d1 + WHERE t1.a = d1.a; +DROP TABLE t1; # End of 5.0 tests. diff --git a/sql/sql_select.cc b/sql/sql_select.cc index ff179c432a8..b670e6e3637 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -2176,7 +2176,7 @@ JOIN::destroy() } } tmp_join->tmp_join= 0; - tmp_table_param.copy_field=0; + tmp_table_param.cleanup(); DBUG_RETURN(tmp_join->destroy()); } cond_equal= 0; From 8a9a633e4bab5aa93e6c284f82d9a4b495dc75b7 Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Fri, 4 Sep 2009 12:29:18 +0500 Subject: [PATCH 43/68] BUG#46961 - archive engine loses rows during self joining select! SELECT with join (not only self-join) from archive table may return incomplete result set, when result set size exceeds join buffer size. The problem was that archive row counter was initialzed too early, when ha_archive::info() method was called. Later, when optimizer exceeds join buffer, it attempts to reuse handler without calling ha_archive::info() again (which is correct). Fixed by moving row counter initialization from ha_archive::info() to ha_archive::rnd_init(). --- mysql-test/r/archive.result | 11 +++++++++++ mysql-test/t/archive.test | 13 +++++++++++++ storage/archive/ha_archive.cc | 2 +- 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/archive.result b/mysql-test/r/archive.result index 8c26ea1ff82..9a6edbaa85c 100644 --- a/mysql-test/r/archive.result +++ b/mysql-test/r/archive.result @@ -12695,3 +12695,14 @@ a b 1 NULL 2 NULL DROP TABLE t1; +SET @save_join_buffer_size= @@join_buffer_size; +SET @@join_buffer_size= 8228; +CREATE TABLE t1(a CHAR(255)) ENGINE=archive; +INSERT INTO t1 VALUES('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'), +('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'), +('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'); +SELECT COUNT(t1.a) FROM t1, t1 a, t1 b, t1 c, t1 d, t1 e; +COUNT(t1.a) +729 +DROP TABLE t1; +SET @@join_buffer_size= @save_join_buffer_size; diff --git a/mysql-test/t/archive.test b/mysql-test/t/archive.test index 7139d95ab49..663f7faf208 100644 --- a/mysql-test/t/archive.test +++ b/mysql-test/t/archive.test @@ -1599,3 +1599,16 @@ INSERT INTO t1 VALUES (NULL, NULL),(NULL, NULL); FLUSH TABLE t1; SELECT * FROM t1 ORDER BY a; DROP TABLE t1; + +# +# BUG#46961 - archive engine loses rows during self joining select! +# +SET @save_join_buffer_size= @@join_buffer_size; +SET @@join_buffer_size= 8228; +CREATE TABLE t1(a CHAR(255)) ENGINE=archive; +INSERT INTO t1 VALUES('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'), + ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'), + ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'); +SELECT COUNT(t1.a) FROM t1, t1 a, t1 b, t1 c, t1 d, t1 e; +DROP TABLE t1; +SET @@join_buffer_size= @save_join_buffer_size; diff --git a/storage/archive/ha_archive.cc b/storage/archive/ha_archive.cc index 1146b2eb73a..f1b9c26dfd6 100644 --- a/storage/archive/ha_archive.cc +++ b/storage/archive/ha_archive.cc @@ -993,6 +993,7 @@ int ha_archive::rnd_init(bool scan) /* We rewind the file so that we can read from the beginning if scan */ if (scan) { + scan_rows= stats.records; DBUG_PRINT("info", ("archive will retrieve %llu rows", (unsigned long long) scan_rows)); @@ -1461,7 +1462,6 @@ int ha_archive::info(uint flag) stats.records= share->rows_recorded; pthread_mutex_unlock(&share->mutex); - scan_rows= stats.records; stats.deleted= 0; DBUG_PRINT("ha_archive", ("Stats rows is %d\n", (int)stats.records)); From b6ef08bb73eb18a603de3d5977922694ac167d25 Mon Sep 17 00:00:00 2001 From: Ramil Kalimullin Date: Fri, 4 Sep 2009 13:14:54 +0500 Subject: [PATCH 44/68] Fix for bug#46629: Item_in_subselect::val_int(): Assertion `0' on subquery inside a SP Problem: repeated call of a SP containing an incorrect query with a subselect may lead to failed ASSERT(). Fix: set proper sublelect's state in case of error occured during subquery transformation. --- mysql-test/r/sp.result | 16 ++++++++++++++++ mysql-test/t/sp.test | 22 ++++++++++++++++++++++ sql/item_subselect.cc | 10 ++++------ 3 files changed, 42 insertions(+), 6 deletions(-) diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index 3ad556b8c30..67514c314f4 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -6963,6 +6963,22 @@ CALL p1(); CALL p1(); DROP PROCEDURE p1; DROP TABLE t1; +# +# Bug #46629: Item_in_subselect::val_int(): Assertion `0' +# on subquery inside a SP +# +CREATE TABLE t1(a INT); +CREATE TABLE t2(a INT, b INT PRIMARY KEY); +CREATE PROCEDURE p1 () +BEGIN +SELECT a FROM t1 A WHERE A.b IN (SELECT b FROM t2 AS B); +END| +CALL p1; +ERROR 42S22: Unknown column 'A.b' in 'IN/ALL/ANY subquery' +CALL p1; +ERROR 42S22: Unknown column 'A.b' in 'IN/ALL/ANY subquery' +DROP PROCEDURE p1; +DROP TABLE t1, t2; # ------------------------------------------------------------------ # -- End of 5.1 tests # ------------------------------------------------------------------ diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index 5eeac457958..44c4556340e 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -8242,6 +8242,28 @@ while ($tab_count) DROP PROCEDURE p1; DROP TABLE t1; + +--echo # +--echo # Bug #46629: Item_in_subselect::val_int(): Assertion `0' +--echo # on subquery inside a SP +--echo # +CREATE TABLE t1(a INT); +CREATE TABLE t2(a INT, b INT PRIMARY KEY); + +DELIMITER |; +CREATE PROCEDURE p1 () +BEGIN + SELECT a FROM t1 A WHERE A.b IN (SELECT b FROM t2 AS B); +END| +DELIMITER ;| +--error ER_BAD_FIELD_ERROR +CALL p1; +--error ER_BAD_FIELD_ERROR +CALL p1; +DROP PROCEDURE p1; +DROP TABLE t1, t2; + + --echo # ------------------------------------------------------------------ --echo # -- End of 5.1 tests --echo # ------------------------------------------------------------------ diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index cdb091fa07e..da651cec70c 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -155,13 +155,11 @@ bool Item_subselect::fix_fields(THD *thd_param, Item **ref) if (check_stack_overrun(thd, STACK_MIN_SIZE, (uchar*)&res)) return TRUE; - res= engine->prepare(); - - // all transformation is done (used by prepared statements) - changed= 1; - - if (!res) + if (!(res= engine->prepare())) { + // all transformation is done (used by prepared statements) + changed= 1; + if (substitution) { int ret= 0; From 4f6b8707dc60f09c6d59e4127f21467c8aa4473d Mon Sep 17 00:00:00 2001 From: Kristofer Pettersson Date: Fri, 4 Sep 2009 12:32:21 +0200 Subject: [PATCH 45/68] Bug#46486 warnings produced when running mysql_install_db Incremental patch part 2 Removing dead code and changing a note level message to a warning. --- sql/sql_plugin.cc | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index f00e1f72390..025c8a8248d 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -1520,7 +1520,7 @@ error: void plugin_shutdown(void) { - uint i, count= plugin_array.elements, free_slots= 0; + uint i, count= plugin_array.elements; struct st_plugin_int **plugins, *plugin; struct st_plugin_dl **dl; DBUG_ENTER("plugin_shutdown"); @@ -1541,18 +1541,13 @@ void plugin_shutdown(void) while (reap_needed && (count= plugin_array.elements)) { reap_plugins(); - for (i= free_slots= 0; i < count; i++) + for (i= 0; i < count; i++) { plugin= *dynamic_element(&plugin_array, i, struct st_plugin_int **); - switch (plugin->state) { - case PLUGIN_IS_READY: + if (plugin->state == PLUGIN_IS_READY) + { plugin->state= PLUGIN_IS_DELETED; reap_needed= true; - break; - case PLUGIN_IS_FREED: - case PLUGIN_IS_UNINITIALIZED: - free_slots++; - break; } } if (!reap_needed) @@ -1586,8 +1581,8 @@ void plugin_shutdown(void) if (!(plugins[i]->state & (PLUGIN_IS_UNINITIALIZED | PLUGIN_IS_FREED | PLUGIN_IS_DISABLED))) { - sql_print_information("Plugin '%s' will be forced to shutdown", - plugins[i]->name.str); + sql_print_warning("Plugin '%s' will be forced to shutdown", + plugins[i]->name.str); /* We are forcing deinit on plugins so we don't want to do a ref_count check until we have processed all the plugins. From cc900f2c50f54cbe2c6540e27b86244b9f823dff Mon Sep 17 00:00:00 2001 From: Mattias Jonsson Date: Fri, 4 Sep 2009 15:02:15 +0200 Subject: [PATCH 46/68] Bug#35845: unneccesary call to ha_start_bulk_insert for not used partitions (Backport) Problem is that when insert (ha_start_bulk_insert) in i partitioned table, it will call ha_start_bulk_insert for every partition, used or not. Solution is to delay the call to the partitions ha_start_bulk_insert until the first row is to be inserted into that partition --- sql/ha_partition.cc | 95 ++++++++++++++++++++++++++++++++++++++------- sql/ha_partition.h | 10 ++++- 2 files changed, 91 insertions(+), 14 deletions(-) diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 63f8271cca1..c849bbd12c5 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -239,6 +239,7 @@ void ha_partition::init_handler_variables() m_curr_key_info[0]= NULL; m_curr_key_info[1]= NULL; is_clone= FALSE, + m_part_func_monotonicity_info= NON_MONOTONIC; auto_increment_lock= FALSE; auto_increment_safe_stmt_log_lock= FALSE; /* @@ -2464,11 +2465,18 @@ int ha_partition::open(const char *name, int mode, uint test_if_locked) } } + /* Initialize the bitmap we use to minimize ha_start_bulk_insert calls */ + if (bitmap_init(&m_bulk_insert_started, NULL, m_tot_parts + 1, FALSE)) + DBUG_RETURN(1); + bitmap_clear_all(&m_bulk_insert_started); /* Initialize the bitmap we use to determine what partitions are used */ if (!is_clone) { if (bitmap_init(&(m_part_info->used_partitions), NULL, m_tot_parts, TRUE)) + { + bitmap_free(&m_bulk_insert_started); DBUG_RETURN(1); + } bitmap_set_all(&(m_part_info->used_partitions)); } @@ -2552,12 +2560,18 @@ int ha_partition::open(const char *name, int mode, uint test_if_locked) calling open on all individual handlers. */ m_handler_status= handler_opened; + if (m_part_info->part_expr) + m_part_func_monotonicity_info= + m_part_info->part_expr->get_monotonicity_info(); + else if (m_part_info->list_of_part_fields) + m_part_func_monotonicity_info= MONOTONIC_STRICT_INCREASING; info(HA_STATUS_VARIABLE | HA_STATUS_CONST); DBUG_RETURN(0); err_handler: while (file-- != m_file) (*file)->close(); + bitmap_free(&m_bulk_insert_started); if (!is_clone) bitmap_free(&(m_part_info->used_partitions)); @@ -2605,6 +2619,7 @@ int ha_partition::close(void) DBUG_ASSERT(table->s == table_share); delete_queue(&m_queue); + bitmap_free(&m_bulk_insert_started); if (!is_clone) bitmap_free(&(m_part_info->used_partitions)); file= m_file; @@ -3021,6 +3036,8 @@ int ha_partition::write_row(uchar * buf) } m_last_part= part_id; DBUG_PRINT("info", ("Insert in partition %d", part_id)); + start_part_bulk_insert(part_id); + tmp_disable_binlog(thd); /* Do not replicate the low-level changes. */ error= m_file[part_id]->ha_write_row(buf); if (have_auto_increment && !table->s->next_number_keypart) @@ -3083,6 +3100,7 @@ int ha_partition::update_row(const uchar *old_data, uchar *new_data) } m_last_part= new_part_id; + start_part_bulk_insert(new_part_id); if (new_part_id == old_part_id) { DBUG_PRINT("info", ("Update in partition %d", new_part_id)); @@ -3247,22 +3265,65 @@ int ha_partition::delete_all_rows() DESCRIPTION rows == 0 means we will probably insert many rows */ - void ha_partition::start_bulk_insert(ha_rows rows) { - handler **file; DBUG_ENTER("ha_partition::start_bulk_insert"); - rows= rows ? rows/m_tot_parts + 1 : 0; - file= m_file; - do - { - (*file)->ha_start_bulk_insert(rows); - } while (*(++file)); + m_bulk_inserted_rows= 0; + bitmap_clear_all(&m_bulk_insert_started); + /* use the last bit for marking if bulk_insert_started was called */ + bitmap_set_bit(&m_bulk_insert_started, m_tot_parts); DBUG_VOID_RETURN; } +/* + Check if start_bulk_insert has been called for this partition, + if not, call it and mark it called +*/ +void ha_partition::start_part_bulk_insert(uint part_id) +{ + if (!bitmap_is_set(&m_bulk_insert_started, part_id) && + bitmap_is_set(&m_bulk_insert_started, m_tot_parts)) + { + m_file[part_id]->ha_start_bulk_insert(guess_bulk_insert_rows()); + bitmap_set_bit(&m_bulk_insert_started, part_id); + } + m_bulk_inserted_rows++; +} + + +/* + Try to predict the number of inserts into this partition. + + If less than 10 rows (including 0 which means Unknown) + just give that as a guess + If monotonic partitioning function was used + guess that 50 % of the inserts goes to the first partition + For all other cases, guess on equal distribution between the partitions +*/ +ha_rows ha_partition::guess_bulk_insert_rows() +{ + DBUG_ENTER("guess_bulk_insert_rows"); + + if (estimation_rows_to_insert < 10) + DBUG_RETURN(estimation_rows_to_insert); + + /* If first insert/partition and monotonic partition function, guess 50%. */ + if (!m_bulk_inserted_rows && + m_part_func_monotonicity_info != NON_MONOTONIC && + m_tot_parts > 1) + DBUG_RETURN(estimation_rows_to_insert / 2); + + /* Else guess on equal distribution (+1 is to avoid returning 0/Unknown) */ + if (m_bulk_inserted_rows < estimation_rows_to_insert) + DBUG_RETURN(((estimation_rows_to_insert - m_bulk_inserted_rows) + / m_tot_parts) + 1); + /* The estimation was wrong, must say 'Unknown' */ + DBUG_RETURN(0); +} + + /* Finish a large batch of insert rows @@ -3272,21 +3333,29 @@ void ha_partition::start_bulk_insert(ha_rows rows) RETURN VALUE >0 Error code 0 Success + + Note: end_bulk_insert can be called without start_bulk_insert + being called, see bug陇44108. + */ int ha_partition::end_bulk_insert() { int error= 0; - handler **file; + uint i; DBUG_ENTER("ha_partition::end_bulk_insert"); - file= m_file; - do + if (!bitmap_is_set(&m_bulk_insert_started, m_tot_parts)) + DBUG_RETURN(error); + + for (i= 0; i < m_tot_parts; i++) { int tmp; - if ((tmp= (*file)->ha_end_bulk_insert())) + if (bitmap_is_set(&m_bulk_insert_started, i) && + (tmp= m_file[i]->ha_end_bulk_insert())) error= tmp; - } while (*(++file)); + } + bitmap_clear_all(&m_bulk_insert_started); DBUG_RETURN(error); } diff --git a/sql/ha_partition.h b/sql/ha_partition.h index d0301e24a93..f47dfe8f621 100644 --- a/sql/ha_partition.h +++ b/sql/ha_partition.h @@ -176,6 +176,11 @@ private: This to ensure it will work with statement based replication. */ bool auto_increment_safe_stmt_log_lock; + /** For optimizing ha_start_bulk_insert calls */ + MY_BITMAP m_bulk_insert_started; + ha_rows m_bulk_inserted_rows; + /** used for prediction of start_bulk_insert rows */ + enum_monotonicity_info m_part_func_monotonicity_info; public: handler *clone(MEM_ROOT *mem_root); virtual void set_part_info(partition_info *part_info) @@ -353,7 +358,6 @@ public: Bulk inserts are supported if all underlying handlers support it. start_bulk_insert and end_bulk_insert is called before and after a number of calls to write_row. - Not yet though. */ virtual int write_row(uchar * buf); virtual int update_row(const uchar * old_data, uchar * new_data); @@ -361,6 +365,10 @@ public: virtual int delete_all_rows(void); virtual void start_bulk_insert(ha_rows rows); virtual int end_bulk_insert(); +private: + ha_rows guess_bulk_insert_rows(); + void start_part_bulk_insert(uint part_id); +public: virtual bool is_fatal_error(int error, uint flags) { From 7d82f7846c5bfb403008129e325bba8e68200aa3 Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Fri, 4 Sep 2009 17:02:17 -0300 Subject: [PATCH 47/68] Bug#45605: ps_not_windows.test fails: The plugin feature is disabled, you need HAVE_DLOPEN Selectively skip tests that require dynamic loading (ie: static builds). --- mysql-test/include/have_dynamic_loading.inc | 7 +++++++ mysql-test/include/have_example_plugin.inc | 5 +---- mysql-test/include/have_simple_parser.inc | 5 +---- mysql-test/include/have_udf.inc | 5 +---- mysql-test/t/ps_not_windows.test | 2 ++ 5 files changed, 12 insertions(+), 12 deletions(-) create mode 100644 mysql-test/include/have_dynamic_loading.inc diff --git a/mysql-test/include/have_dynamic_loading.inc b/mysql-test/include/have_dynamic_loading.inc new file mode 100644 index 00000000000..1b2c85b3904 --- /dev/null +++ b/mysql-test/include/have_dynamic_loading.inc @@ -0,0 +1,7 @@ +# +# Whether server supports dynamic loading. +# +--require r/have_dynamic_loading.require +disable_query_log; +show variables like 'have_dynamic_loading'; +enable_query_log; diff --git a/mysql-test/include/have_example_plugin.inc b/mysql-test/include/have_example_plugin.inc index 8e57c725eb5..a2fffc17b97 100644 --- a/mysql-test/include/have_example_plugin.inc +++ b/mysql-test/include/have_example_plugin.inc @@ -2,10 +2,7 @@ # Check if server has support for loading udf's # i.e it will support dlopen # ---require r/have_dynamic_loading.require -disable_query_log; -show variables like 'have_dynamic_loading'; -enable_query_log; +--source include/have_dynamic_loading.inc # # Check if the variable EXAMPLE_PLUGIN is set diff --git a/mysql-test/include/have_simple_parser.inc b/mysql-test/include/have_simple_parser.inc index c85786bd524..5a4dc93ec81 100644 --- a/mysql-test/include/have_simple_parser.inc +++ b/mysql-test/include/have_simple_parser.inc @@ -2,10 +2,7 @@ # Check if server has support for loading udf's # i.e it will support dlopen # ---require r/have_dynamic_loading.require -disable_query_log; -show variables like 'have_dynamic_loading'; -enable_query_log; +--source include/have_dynamic_loading.inc # # Check if the variable SIMPLE_PARSER is set diff --git a/mysql-test/include/have_udf.inc b/mysql-test/include/have_udf.inc index 3f7e260c5ba..7be57bbb7a9 100644 --- a/mysql-test/include/have_udf.inc +++ b/mysql-test/include/have_udf.inc @@ -2,10 +2,7 @@ # Check if server has support for loading udf's # i.e it will support dlopen # ---require r/have_dynamic_loading.require -disable_query_log; -show variables like 'have_dynamic_loading'; -enable_query_log; +--source include/have_dynamic_loading.inc # # Check if the variable UDF_EXAMPLE_LIB is set diff --git a/mysql-test/t/ps_not_windows.test b/mysql-test/t/ps_not_windows.test index 6d85f737b32..0ab08b59f1e 100644 --- a/mysql-test/t/ps_not_windows.test +++ b/mysql-test/t/ps_not_windows.test @@ -2,6 +2,8 @@ --source include/not_embedded.inc # Non-windows specific ps tests. --source include/not_windows.inc +# requires dynamic loading +--source include/have_dynamic_loading.inc # # Bug #20665: All commands supported in Stored Procedures should work in From f1617238210eb110f483dddef212efbeb5ad4e3d Mon Sep 17 00:00:00 2001 From: Alexey Kopytov Date: Sun, 6 Sep 2009 00:42:17 +0400 Subject: [PATCH 48/68] Bug #46159: simple query that never returns The external 'for' loop in remove_dup_with_compare() handled HA_ERR_RECORD_DELETED by just starting over without advancing to the next record which caused an infinite loop. This condition could be triggered on certain data by a SELECT query containing DISTINCT, GROUP BY and HAVING clauses. Fixed remove_dup_with_compare() so that we always advance to the next record when receiving HA_ERR_RECORD_DELETED from rnd_next(). --- mysql-test/r/distinct.result | 30 +++++++++++++++++++++++++++ mysql-test/t/distinct.test | 40 ++++++++++++++++++++++++++++++++++++ sql/sql_select.cc | 5 ++++- 3 files changed, 74 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/distinct.result b/mysql-test/r/distinct.result index e0324af8cfd..b1cb70fa43c 100644 --- a/mysql-test/r/distinct.result +++ b/mysql-test/r/distinct.result @@ -763,4 +763,34 @@ a b d c 1 2 0 2 1 2 0 3 DROP TABLE t1; +# +# Bug #46159: simple query that never returns +# +SET @old_max_heap_table_size = @@max_heap_table_size; +SET @@max_heap_table_size = 16384; +SET @old_sort_buffer_size = @@sort_buffer_size; +SET @@sort_buffer_size = 32804; +CREATE TABLE t1(c1 int, c2 VARCHAR(20)); +INSERT INTO t1 VALUES (1, '1'), (1, '1'), (2, '2'), (3, '1'), (3, '1'), (4, '4'); +INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1; +INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1; +INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1; +INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1; +INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1; +INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1; +INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1; +INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1; +SELECT c1, c2, COUNT(*) FROM t1 GROUP BY c1 LIMIT 4; +c1 c2 COUNT(*) +1 1 2 +2 2 1 +3 1 2 +4 4 1 +SELECT DISTINCT c2 FROM t1 GROUP BY c1 HAVING COUNT(*) > 1; +c2 +1 +5 +DROP TABLE t1; +SET @@sort_buffer_size = @old_sort_buffer_size; +SET @@max_heap_table_size = @old_max_heap_table_size; End of 5.1 tests diff --git a/mysql-test/t/distinct.test b/mysql-test/t/distinct.test index a77d1136840..bf4c23562cf 100644 --- a/mysql-test/t/distinct.test +++ b/mysql-test/t/distinct.test @@ -573,4 +573,44 @@ SELECT DISTINCT a, b, d, c FROM t1; DROP TABLE t1; +--echo # +--echo # Bug #46159: simple query that never returns +--echo # + +# Set max_heap_table_size to the minimum value so that GROUP BY table in the +# SELECT query below gets converted to MyISAM +SET @old_max_heap_table_size = @@max_heap_table_size; +SET @@max_heap_table_size = 16384; + +# Set sort_buffer_size to the mininum value so that remove_duplicates() calls +# remove_dup_with_compare() +SET @old_sort_buffer_size = @@sort_buffer_size; +SET @@sort_buffer_size = 32804; + +CREATE TABLE t1(c1 int, c2 VARCHAR(20)); +INSERT INTO t1 VALUES (1, '1'), (1, '1'), (2, '2'), (3, '1'), (3, '1'), (4, '4'); +# Now we just need to pad the table with random data so we have enough unique +# values to force conversion of the GROUP BY table to MyISAM +INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1; +INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1; +INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1; +INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1; +INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1; +INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1; +INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1; +INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1; + +# First rows of the GROUP BY table that will be processed by +# remove_dup_with_compare() +SELECT c1, c2, COUNT(*) FROM t1 GROUP BY c1 LIMIT 4; + +# The actual test case +SELECT DISTINCT c2 FROM t1 GROUP BY c1 HAVING COUNT(*) > 1; + +# Cleanup + +DROP TABLE t1; +SET @@sort_buffer_size = @old_sort_buffer_size; +SET @@max_heap_table_size = @old_max_heap_table_size; + --echo End of 5.1 tests diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 5cb0de1ba5c..a02430446d1 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -13665,7 +13665,10 @@ static int remove_dup_with_compare(THD *thd, TABLE *table, Field **first_field, if (error) { if (error == HA_ERR_RECORD_DELETED) - continue; + { + error= file->rnd_next(record); + continue; + } if (error == HA_ERR_END_OF_FILE) break; goto err; From c21168f37ae116c4c075ec55fce5c5854e96129d Mon Sep 17 00:00:00 2001 From: Date: Mon, 7 Sep 2009 13:01:03 +0800 Subject: [PATCH 49/68] Bug#45581 Test rpl_row_sp006_InnoDB fails randomly: Unknown database 'mysqltest1' Postfix. extra/rpl_tests/rpl_row_sp006.test had changed to fix this bug. extra/rpl_tests/rpl_row_sp006.test is also referenced by rpl_ndb_sp006, So rpl_row_sp006.result must be changed too. --- .../suite/rpl_ndb/r/rpl_ndb_sp006.result | 36 +++++++++---------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_sp006.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_sp006.result index 482d43c8f10..047402f826f 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_sp006.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_sp006.result @@ -4,21 +4,20 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; -create database if not exists mysqltest1; -DROP PROCEDURE IF EXISTS mysqltest1.p1; -DROP PROCEDURE IF EXISTS mysqltest1.p2; -DROP TABLE IF EXISTS mysqltest1.t2; -DROP TABLE IF EXISTS mysqltest1.t1; -CREATE TABLE IF NOT EXISTS mysqltest1.t1(name CHAR(16), birth DATE,PRIMARY KEY(name))ENGINE=NDBCLUSTER; -CREATE TABLE IF NOT EXISTS mysqltest1.t2(name CHAR(16), age INT ,PRIMARY KEY(name))ENGINE=NDBCLUSTER; -CREATE PROCEDURE mysqltest1.p1() +DROP TABLE IF EXISTS t1; +DROP TABLE IF EXISTS t2; +DROP PROCEDURE IF EXISTS p1; +DROP PROCEDURE IF EXISTS p2; +CREATE TABLE IF NOT EXISTS t1(name CHAR(16), birth DATE,PRIMARY KEY(name))ENGINE=NDBCLUSTER; +CREATE TABLE IF NOT EXISTS t2(name CHAR(16), age INT ,PRIMARY KEY(name))ENGINE=NDBCLUSTER; +CREATE PROCEDURE p1() BEGIN DECLARE done INT DEFAULT 0; DECLARE spa CHAR(16); DECLARE spb INT; DECLARE cur1 CURSOR FOR SELECT name, (YEAR(CURDATE())-YEAR(birth))-(RIGHT(CURDATE(),5) Date: Mon, 7 Sep 2009 13:42:54 +0800 Subject: [PATCH 50/68] Bug#46010 main.ctype_gbk_binlog fails sporadically : Table 't2' already exists This test case uses mysqlbinlog to dump the content of master-bin.000001, but the content of master-bin.000001 is not that this test needs. MTR runs a lot of test cases on one server, so when this test starts, the current binlog file might not be master-bin.000001, or there are other events are written by tests before. 'RESET MASTER' command must be called at the begin, it ensures that binlog of this test is wrote to master-bin.000001 correctly. Three other tests have the same problem, They were fixed together. mysqlbinlog-cp932 binlog_incident binlog_tmp_table --- mysql-test/r/ctype_gbk_binlog.result | 1 + mysql-test/r/mysqlbinlog-cp932.result | 2 +- mysql-test/suite/binlog/r/binlog_incident.result | 1 + mysql-test/suite/binlog/r/binlog_tmp_table.result | 1 + mysql-test/suite/binlog/t/binlog_incident.test | 3 ++- mysql-test/suite/binlog/t/binlog_tmp_table.test | 1 + mysql-test/t/ctype_gbk_binlog.test | 1 + mysql-test/t/mysqlbinlog-cp932.test | 5 +++-- 8 files changed, 11 insertions(+), 4 deletions(-) diff --git a/mysql-test/r/ctype_gbk_binlog.result b/mysql-test/r/ctype_gbk_binlog.result index a49e170ff19..df927af9a6b 100644 --- a/mysql-test/r/ctype_gbk_binlog.result +++ b/mysql-test/r/ctype_gbk_binlog.result @@ -1,3 +1,4 @@ +RESET MASTER; SET NAMES gbk; CREATE TABLE t1 ( f1 BLOB diff --git a/mysql-test/r/mysqlbinlog-cp932.result b/mysql-test/r/mysqlbinlog-cp932.result index 1640a3b1642..cbf6159516a 100644 --- a/mysql-test/r/mysqlbinlog-cp932.result +++ b/mysql-test/r/mysqlbinlog-cp932.result @@ -1,4 +1,4 @@ -flush logs; +RESET MASTER; create table t3 (f text character set utf8); create table t4 (f text character set cp932); flush logs; diff --git a/mysql-test/suite/binlog/r/binlog_incident.result b/mysql-test/suite/binlog/r/binlog_incident.result index d8b0357b8c4..7a555743723 100644 --- a/mysql-test/suite/binlog/r/binlog_incident.result +++ b/mysql-test/suite/binlog/r/binlog_incident.result @@ -1,3 +1,4 @@ +RESET MASTER; CREATE TABLE t1 (a INT); INSERT INTO t1 VALUES (1),(2),(3); SELECT * FROM t1; diff --git a/mysql-test/suite/binlog/r/binlog_tmp_table.result b/mysql-test/suite/binlog/r/binlog_tmp_table.result index e4928432324..14b1963ffd9 100644 --- a/mysql-test/suite/binlog/r/binlog_tmp_table.result +++ b/mysql-test/suite/binlog/r/binlog_tmp_table.result @@ -1,3 +1,4 @@ +RESET MASTER; create table foo (a int); flush logs; create temporary table tmp1_foo like foo; diff --git a/mysql-test/suite/binlog/t/binlog_incident.test b/mysql-test/suite/binlog/t/binlog_incident.test index 208c7f24df2..901ac49ea24 100644 --- a/mysql-test/suite/binlog/t/binlog_incident.test +++ b/mysql-test/suite/binlog/t/binlog_incident.test @@ -6,6 +6,7 @@ source include/have_log_bin.inc; source include/have_debug.inc; let $MYSQLD_DATADIR= `select @@datadir`; +RESET MASTER; CREATE TABLE t1 (a INT); @@ -24,4 +25,4 @@ exec $MYSQL_BINLOG --start-position=106 $MYSQLD_DATADIR/master-bin.000001 >$MYSQ eval SELECT cont LIKE '%RELOAD DATABASE; # Shall generate syntax error%' AS `Contain RELOAD DATABASE` FROM (SELECT load_file('$MYSQLTEST_VARDIR/tmp/binlog_incident-bug44442.sql') AS cont) AS tbl; --enable_query_log -remove_file $MYSQLTEST_VARDIR/tmp/binlog_incident-bug44442.sql; \ No newline at end of file +remove_file $MYSQLTEST_VARDIR/tmp/binlog_incident-bug44442.sql; diff --git a/mysql-test/suite/binlog/t/binlog_tmp_table.test b/mysql-test/suite/binlog/t/binlog_tmp_table.test index 6947959a5e0..54af8a8cb68 100644 --- a/mysql-test/suite/binlog/t/binlog_tmp_table.test +++ b/mysql-test/suite/binlog/t/binlog_tmp_table.test @@ -30,6 +30,7 @@ source include/have_binlog_format_mixed_or_statement.inc; connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,); connect (master1,127.0.0.1,root,,test,$MASTER_MYPORT,); +RESET MASTER; create table foo (a int); diff --git a/mysql-test/t/ctype_gbk_binlog.test b/mysql-test/t/ctype_gbk_binlog.test index a8f653d1b1e..e4c1bee19af 100644 --- a/mysql-test/t/ctype_gbk_binlog.test +++ b/mysql-test/t/ctype_gbk_binlog.test @@ -1,6 +1,7 @@ -- source include/have_binlog_format_mixed_or_statement.inc -- source include/have_gbk.inc +RESET MASTER; SET NAMES gbk; --character_set gbk diff --git a/mysql-test/t/mysqlbinlog-cp932.test b/mysql-test/t/mysqlbinlog-cp932.test index a7055bfc8ca..2a210bea0e0 100644 --- a/mysql-test/t/mysqlbinlog-cp932.test +++ b/mysql-test/t/mysqlbinlog-cp932.test @@ -5,8 +5,9 @@ -- source include/have_cp932.inc -- source include/have_log_bin.inc +RESET MASTER; + # Bug#16217 (mysql client did not know how not switch its internal charset) -flush logs; create table t3 (f text character set utf8); create table t4 (f text character set cp932); --exec $MYSQL --default-character-set=utf8 test -e "insert into t3 values(_utf8'銈')" @@ -14,7 +15,7 @@ create table t4 (f text character set cp932); flush logs; rename table t3 to t03, t4 to t04; let $MYSQLD_DATADIR= `select @@datadir`; ---exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000002 | $MYSQL --default-character-set=utf8 +--exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000001 | $MYSQL --default-character-set=utf8 # original and recovered data must be equal select HEX(f) from t03; select HEX(f) from t3; From ea5d204370662a751b70d1a940be82601ac1a3b6 Mon Sep 17 00:00:00 2001 From: Mikael Ronstrom Date: Mon, 7 Sep 2009 10:37:54 +0200 Subject: [PATCH 51/68] Fix to ensure that all subpartitions gets deleted before renaming starts, BUG#47029 --- mysql-test/r/partition_innodb.result | 14 ++++++++++++++ mysql-test/t/partition_innodb.test | 17 +++++++++++++++++ sql/ha_partition.cc | 1 + 3 files changed, 32 insertions(+) diff --git a/mysql-test/r/partition_innodb.result b/mysql-test/r/partition_innodb.result index ad4d08e89ff..9c5675c0c75 100644 --- a/mysql-test/r/partition_innodb.result +++ b/mysql-test/r/partition_innodb.result @@ -1,4 +1,18 @@ drop table if exists t1; +create table t1 (a int not null, +b datetime not null, +primary key (a,b)) +engine=innodb +partition by range (to_days(b)) +subpartition by hash (a) +subpartitions 2 +( partition p0 values less than (to_days('2009-01-01')), +partition p1 values less than (to_days('2009-02-01')), +partition p2 values less than (to_days('2009-03-01')), +partition p3 values less than maxvalue); +alter table t1 reorganize partition p1,p2 into +( partition p2 values less than (to_days('2009-03-01'))); +drop table t1; CREATE TABLE t1 (id INT PRIMARY KEY, data INT) ENGINE = InnoDB PARTITION BY RANGE(id) ( PARTITION p0 VALUES LESS THAN (5), diff --git a/mysql-test/t/partition_innodb.test b/mysql-test/t/partition_innodb.test index 2abbceffbb0..b29ce289811 100644 --- a/mysql-test/t/partition_innodb.test +++ b/mysql-test/t/partition_innodb.test @@ -5,6 +5,23 @@ drop table if exists t1; --enable_warnings +# +# Bug#47029: Crash when reorganize partition with subpartition +# +create table t1 (a int not null, + b datetime not null, + primary key (a,b)) +engine=innodb +partition by range (to_days(b)) +subpartition by hash (a) +subpartitions 2 +( partition p0 values less than (to_days('2009-01-01')), + partition p1 values less than (to_days('2009-02-01')), + partition p2 values less than (to_days('2009-03-01')), + partition p3 values less than maxvalue); +alter table t1 reorganize partition p1,p2 into +( partition p2 values less than (to_days('2009-03-01'))); +drop table t1; # # Bug#40595: Non-matching rows not released with READ-COMMITTED on tables # with partitions diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index ac8c46ec4e3..2e303744c1a 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -705,6 +705,7 @@ int ha_partition::rename_partitions(const char *path) if (m_is_sub_partitioned) { List_iterator sub_it(part_elem->subpartitions); + j= 0; do { sub_elem= sub_it++; From fa604f0a3d74ba60e2ba4b583fc5f14221ac713d Mon Sep 17 00:00:00 2001 From: Martin Hansson Date: Mon, 7 Sep 2009 11:57:22 +0200 Subject: [PATCH 52/68] Bug#46259: 5.0.83 -> 5.1.36, query doesn't work The parser rule for expressions in a udf parameter list contains two hacks: First, the parser input stream is read verbatim, bypassing the lexer. Second, the Item::name field is overwritten. If the argument to a udf was a field, the field's name as seen by name resolution was overwritten this way. If the field name was quoted or escaped, it would appear as e.g. "`field`". Fixed by not overwriting field names. --- mysql-test/r/udf.result | 16 ++++++++++++++++ mysql-test/t/udf.test | 12 ++++++++++++ sql/sql_yacc.yy | 8 +++++++- 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/udf.result b/mysql-test/r/udf.result index 15410ac2039..601b364fbbe 100644 --- a/mysql-test/r/udf.result +++ b/mysql-test/r/udf.result @@ -392,4 +392,20 @@ a 4 DROP FUNCTION sequence; DROP TABLE t1,t2; +# +# Bug#46259: 5.0.83 -> 5.1.36, query doesn't work +# +CREATE TABLE t1 ( a INT ); +INSERT INTO t1 VALUES (1), (2), (3); +SELECT IF( a = 1, a, a ) AS `b` FROM t1 ORDER BY field( `b` + 1, 1 ); +b +1 +2 +3 +SELECT IF( a = 1, a, a ) AS `b` FROM t1 ORDER BY field( `b`, 1 ); +b +2 +3 +1 +DROP TABLE t1; End of 5.0 tests. diff --git a/mysql-test/t/udf.test b/mysql-test/t/udf.test index e9ae1a31079..7bf252040e5 100644 --- a/mysql-test/t/udf.test +++ b/mysql-test/t/udf.test @@ -436,4 +436,16 @@ SELECT * FROM t2 WHERE a = sequence(); DROP FUNCTION sequence; DROP TABLE t1,t2; +--echo # +--echo # Bug#46259: 5.0.83 -> 5.1.36, query doesn't work +--echo # +CREATE TABLE t1 ( a INT ); + +INSERT INTO t1 VALUES (1), (2), (3); + +SELECT IF( a = 1, a, a ) AS `b` FROM t1 ORDER BY field( `b` + 1, 1 ); +SELECT IF( a = 1, a, a ) AS `b` FROM t1 ORDER BY field( `b`, 1 ); + +DROP TABLE t1; + --echo End of 5.0 tests. diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index a18f57bf9cf..db97e77bbd0 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -7921,7 +7921,13 @@ udf_expr: $2->is_autogenerated_name= FALSE; $2->set_name($4.str, $4.length, system_charset_info); } - else + /* + A field has to have its proper name in order for name + resolution to work, something we are only guaranteed if we + parse it out. If we hijack the input stream with + remember_name we may get quoted or escaped names. + */ + else if ($2->type() != Item::FIELD_ITEM) $2->set_name($1, (uint) ($3 - $1), YYTHD->charset()); $$= $2; } From d141e840a2ee7764d6cc8b7e0a104d802141af52 Mon Sep 17 00:00:00 2001 From: Joerg Bruehe Date: Tue, 8 Sep 2009 15:35:01 +0200 Subject: [PATCH 53/68] This is the 5.4 version of the fix for bug#47007 Unresolved reference to 'innodb_system_libs' in "mysql_config" In 5.4.2, we use InnoDB 1.0.4 which does file IO via separate threads, opposed to the use of asynchronous IO previously. So there is no InnoDB call to "aio_read()" which was searched in "librt", causing a "-lrt" value of "innodb_system_libs", that whole variable is gone. This fix was applied in the build of 5.4.2-beta. --- scripts/Makefile.am | 1 - scripts/mysql_config.pl.in | 2 +- scripts/mysql_config.sh | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/Makefile.am b/scripts/Makefile.am index e493c68827c..cd758370388 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -169,7 +169,6 @@ SUFFIXES = .sh -e 's!@''ZLIB_LIBS''@!@ZLIB_LIBS@!' \ -e 's!@''LIBS''@!@LIBS@!' \ -e 's!@''WRAPLIBS''@!@WRAPLIBS@!' \ - -e 's!@''innodb_system_libs''@!@innodb_system_libs@!' \ -e 's!@''openssl_libs''@!@openssl_libs@!' \ -e 's!@''VERSION''@!@VERSION@!' \ -e 's!@''MYSQL_BASE_VERSION''@!@MYSQL_BASE_VERSION@!' \ diff --git a/scripts/mysql_config.pl.in b/scripts/mysql_config.pl.in index 21896711fa8..415c0d3040e 100644 --- a/scripts/mysql_config.pl.in +++ b/scripts/mysql_config.pl.in @@ -202,7 +202,7 @@ $flags->{libs} = $flags->{libs_r} = [@ldflags,@lib_r_opts,'@ZLIB_DEPS@','@LIBS@','@openssl_libs@']; $flags->{embedded_libs} = - [@ldflags,@lib_e_opts,'@LIBDL@','@ZLIB_DEPS@','@LIBS@','@WRAPLIBS@','@innodb_system_libs@','@openssl_libs@']; + [@ldflags,@lib_e_opts,'@LIBDL@','@ZLIB_DEPS@','@LIBS@','@WRAPLIBS@','@openssl_libs@']; $flags->{include} = ["-I$pkgincludedir"]; $flags->{cflags} = [@{$flags->{include}},split(" ",'@CFLAGS@')]; diff --git a/scripts/mysql_config.sh b/scripts/mysql_config.sh index efc82544bc0..4118856af19 100644 --- a/scripts/mysql_config.sh +++ b/scripts/mysql_config.sh @@ -107,7 +107,7 @@ fi libs=" $ldflags -L$pkglibdir -lmysqlclient @ZLIB_DEPS@ @NON_THREADED_LIBS@" libs="$libs @openssl_libs@ @STATIC_NSS_FLAGS@ " libs_r=" $ldflags -L$pkglibdir -lmysqlclient_r @ZLIB_DEPS@ @LIBS@ @openssl_libs@ " -embedded_libs=" $ldflags -L$pkglibdir -lmysqld @LIBDL@ @ZLIB_DEPS@ @LIBS@ @WRAPLIBS@ @innodb_system_libs@ @openssl_libs@ " +embedded_libs=" $ldflags -L$pkglibdir -lmysqld @LIBDL@ @ZLIB_DEPS@ @LIBS@ @WRAPLIBS@ @openssl_libs@ " if [ -r "$pkglibdir/libmygcc.a" ]; then # When linking against the static library with a different version of GCC From 796a257cf5c56c1b8351fd65870d0e067b2341f3 Mon Sep 17 00:00:00 2001 From: Joerg Bruehe Date: Tue, 8 Sep 2009 15:38:40 +0200 Subject: [PATCH 54/68] Some fixes to make 5.4.2-beta compile on the less common platforms like AIX, HP-UX, and Solaris 8. All these are upmerges from 5.1 which came too late to be included when 5.4.2-beta was cloned, so they were applied during the build phase. --- storage/innobase/handler/i_s.cc | 18 ++++++++++-------- storage/innobase/include/btr0cur.h | 2 +- storage/innobase/include/trx0types.h | 2 +- storage/innobase/include/univ.i | 3 ++- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc index c0d488d1c49..524fe696de2 100644 --- a/storage/innobase/handler/i_s.cc +++ b/storage/innobase/handler/i_s.cc @@ -69,14 +69,16 @@ do { \ #define STRUCT_FLD(name, value) value #endif -static const ST_FIELD_INFO END_OF_ST_FIELD_INFO = - {STRUCT_FLD(field_name, NULL), - STRUCT_FLD(field_length, 0), - STRUCT_FLD(field_type, MYSQL_TYPE_NULL), - STRUCT_FLD(value, 0), - STRUCT_FLD(field_flags, 0), - STRUCT_FLD(old_name, ""), - STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}; +/* Don't use a static const variable here, as some C++ compilers (notably +HPUX aCC: HP ANSI C++ B3910B A.03.65) can't handle it. */ +#define END_OF_ST_FIELD_INFO \ + {STRUCT_FLD(field_name, NULL), \ + STRUCT_FLD(field_length, 0), \ + STRUCT_FLD(field_type, MYSQL_TYPE_NULL), \ + STRUCT_FLD(value, 0), \ + STRUCT_FLD(field_flags, 0), \ + STRUCT_FLD(old_name, ""), \ + STRUCT_FLD(open_method, SKIP_OPEN_TABLE)} /* Use the following types mapping: diff --git a/storage/innobase/include/btr0cur.h b/storage/innobase/include/btr0cur.h index b2d43ae3254..8e66dd50783 100644 --- a/storage/innobase/include/btr0cur.h +++ b/storage/innobase/include/btr0cur.h @@ -618,7 +618,7 @@ enum btr_cur_method { hash_node, and might be necessary to update */ BTR_CUR_BINARY, /*!< success using the binary search */ - BTR_CUR_INSERT_TO_IBUF, /*!< performed the intended insert to + BTR_CUR_INSERT_TO_IBUF /*!< performed the intended insert to the insert buffer */ }; diff --git a/storage/innobase/include/trx0types.h b/storage/innobase/include/trx0types.h index 08cc9622d02..e312efd0b50 100644 --- a/storage/innobase/include/trx0types.h +++ b/storage/innobase/include/trx0types.h @@ -70,7 +70,7 @@ typedef struct trx_named_savept_struct trx_named_savept_t; enum trx_rb_ctx { RB_NONE = 0, /*!< no rollback */ RB_NORMAL, /*!< normal rollback */ - RB_RECOVERY, /*!< rolling back an incomplete transaction, + RB_RECOVERY /*!< rolling back an incomplete transaction, in crash recovery */ }; diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i index 6bce6dd765e..023a6c9cd89 100644 --- a/storage/innobase/include/univ.i +++ b/storage/innobase/include/univ.i @@ -408,7 +408,8 @@ it is read. */ /* Minimize cache-miss latency by moving data at addr into a cache before it is read or written. */ # define UNIV_PREFETCH_RW(addr) __builtin_prefetch(addr, 1, 3) -#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) +/* Sun Studio includes sun_prefetch.h as of version 5.9 */ +#elif (defined(__SUNPRO_C) && __SUNPRO_C >= 0x590) || (defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x590) # include #if __SUNPRO_C >= 0x550 # undef UNIV_INTERN From 472d0c0dfd5940e88e34709e35659bc71e7222f4 Mon Sep 17 00:00:00 2001 From: Joerg Bruehe Date: Tue, 8 Sep 2009 15:48:55 +0200 Subject: [PATCH 55/68] The former "Instance Manager" (program "mysqlmanager") is not being built in 5.4.2-beta, so it cannot be included in a RPM: Remove both the program and the man page from the spec file. This patch was applied during the build of 5.4.2-beta. --- support-files/mysql.spec.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index 778b04b30fe..6a0679bcfb3 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -453,11 +453,9 @@ rm -fr $RBR%{_datadir}/sql-bench # will appreciate that, as all services usually offer this. ln -s %{_sysconfdir}/init.d/mysql $RPM_BUILD_ROOT%{_sbindir}/rcmysql -# Touch the place where the my.cnf config file and mysqlmanager.passwd -# (MySQL Instance Manager password file) might be located +# Touch the place where the my.cnf config file might be located # Just to make sure it's in the file list and marked as a config file touch $RBR%{_sysconfdir}/my.cnf -touch $RBR%{_sysconfdir}/mysqlmanager.passwd %pre server # Check if we can safely upgrade. An upgrade is only safe if it's from one @@ -655,7 +653,6 @@ fi %doc %attr(644, root, man) %{_mandir}/man1/mysql_upgrade.1* %doc %attr(644, root, man) %{_mandir}/man1/mysqlhotcopy.1* %doc %attr(644, root, man) %{_mandir}/man1/mysqlman.1* -%doc %attr(644, root, man) %{_mandir}/man8/mysqlmanager.8* %doc %attr(644, root, man) %{_mandir}/man1/mysql.server.1* %doc %attr(644, root, man) %{_mandir}/man1/mysqltest.1* %doc %attr(644, root, man) %{_mandir}/man1/mysql_tzinfo_to_sql.1* @@ -665,7 +662,6 @@ fi %doc %attr(644, root, man) %{_mandir}/man1/replace.1* %ghost %config(noreplace,missingok) %{_sysconfdir}/my.cnf -%ghost %config(noreplace,missingok) %{_sysconfdir}/mysqlmanager.passwd %attr(755, root, root) %{_bindir}/innochecksum %attr(755, root, root) %{_bindir}/my_print_defaults @@ -695,7 +691,6 @@ fi %attr(755, root, root) %{_sbindir}/mysqld %attr(755, root, root) %{_sbindir}/mysqld-debug -%attr(755, root, root) %{_sbindir}/mysqlmanager %attr(755, root, root) %{_sbindir}/rcmysql %attr(644, root, root) %config(noreplace,missingok) %{_sysconfdir}/logrotate.d/mysql @@ -847,6 +842,11 @@ fi # itself - note that they must be ordered by date (important when # merging BK trees) %changelog +* Thu Aug 27 2009 Joerg Bruehe + +- This version does not contain the "Instance manager", "mysqlmanager": + Remove it from the spec file so that packaging succeeds. + * Fri Nov 07 2008 Joerg Bruehe - Correct yesterday's fix, so that it also works for the last flag, From efaf925068d8309acfa5755c56ff198402e556a3 Mon Sep 17 00:00:00 2001 From: Joerg Bruehe Date: Tue, 8 Sep 2009 16:10:06 +0200 Subject: [PATCH 56/68] Make sure that variables which are (or may be) used in an ".opt" file are defined to some value (even if it is empty). Without this, a test suite run aborted on Windows for "embedded". This fix was applied dusing the build of 5.4.2-beta. --- mysql-test/mysql-test-run.pl | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 7591e091992..cdc7dbb01cd 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -1781,6 +1781,14 @@ sub environment_setup { $ENV{'HA_EXAMPLE_SO'}="'".$plugin_filename."'"; $ENV{'EXAMPLE_PLUGIN_LOAD'}="--plugin_load=;EXAMPLE=".$plugin_filename.";"; } + else + { + # Some ".opt" files use some of these variables, so they must be defined + $ENV{'EXAMPLE_PLUGIN'}= ""; + $ENV{'EXAMPLE_PLUGIN_OPT'}= ""; + $ENV{'HA_EXAMPLE_SO'}= ""; + $ENV{'EXAMPLE_PLUGIN_LOAD'}= ""; + } # ---------------------------------------------------- # Add the path where mysqld will find mypluglib.so From 54847efffd20a6550813cf543d48bacc9e3e9a1a Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Wed, 9 Sep 2009 12:06:15 +0300 Subject: [PATCH 57/68] Bug #45159 Part 1 : rejuvenate the jp test suite using normal run. Updates the results of all the out-dated test suites and adds the special mysqltest command to enable innodb for the tests that need it. --- mysql-test/suite/jp/r/jp_alter_sjis.result | 78 ++--- mysql-test/suite/jp/r/jp_alter_ucs2.result | 78 ++--- mysql-test/suite/jp/r/jp_alter_ujis.result | 78 ++--- mysql-test/suite/jp/r/jp_alter_utf8.result | 78 ++--- mysql-test/suite/jp/r/jp_convert_sjis.result | 12 + .../suite/jp/r/jp_create_db_sjis.result | 1 + .../suite/jp/r/jp_create_db_ucs2.result | 1 + .../suite/jp/r/jp_create_db_ujis.result | 1 + .../suite/jp/r/jp_create_db_utf8.result | 1 + .../suite/jp/r/jp_create_tbl_sjis.result | 78 ++++- .../suite/jp/r/jp_create_tbl_ucs2.result | 78 ++++- .../suite/jp/r/jp_create_tbl_ujis.result | 78 ++++- .../suite/jp/r/jp_create_tbl_utf8.result | 78 ++++- mysql-test/suite/jp/r/jp_enum_sjis.result | 60 ++-- mysql-test/suite/jp/r/jp_enum_ucs2.result | 6 +- mysql-test/suite/jp/r/jp_enum_ujis.result | 60 ++-- mysql-test/suite/jp/r/jp_enum_utf8.result | 60 ++-- mysql-test/suite/jp/r/jp_join_sjis.result | 288 +++++++++--------- mysql-test/suite/jp/r/jp_join_ucs2.result | 288 +++++++++--------- mysql-test/suite/jp/r/jp_join_ujis.result | 288 +++++++++--------- mysql-test/suite/jp/r/jp_join_utf8.result | 288 +++++++++--------- mysql-test/suite/jp/r/jp_select_sjis.result | 4 + mysql-test/suite/jp/t/jp_alter_sjis.test | 2 + mysql-test/suite/jp/t/jp_alter_ucs2.test | 2 + mysql-test/suite/jp/t/jp_alter_ujis.test | 2 + mysql-test/suite/jp/t/jp_alter_utf8.test | 2 + mysql-test/suite/jp/t/jp_charlength_sjis.test | 2 + mysql-test/suite/jp/t/jp_charlength_ucs2.test | 2 + mysql-test/suite/jp/t/jp_charlength_ujis.test | 2 + mysql-test/suite/jp/t/jp_charlength_utf8.test | 2 + mysql-test/suite/jp/t/jp_charset_sjis.test | 2 + mysql-test/suite/jp/t/jp_charset_ucs2.test | 2 + mysql-test/suite/jp/t/jp_charset_ujis.test | 2 + mysql-test/suite/jp/t/jp_charset_utf8.test | 2 + mysql-test/suite/jp/t/jp_convert_sjis.test | 2 + mysql-test/suite/jp/t/jp_convert_ucs2.test | 2 + mysql-test/suite/jp/t/jp_convert_ujis.test | 2 + mysql-test/suite/jp/t/jp_convert_utf8.test | 2 + mysql-test/suite/jp/t/jp_create_tbl_sjis.test | 2 + mysql-test/suite/jp/t/jp_create_tbl_ucs2.test | 2 + mysql-test/suite/jp/t/jp_create_tbl_ujis.test | 2 + mysql-test/suite/jp/t/jp_create_tbl_utf8.test | 2 + mysql-test/suite/jp/t/jp_enum_sjis.test | 2 + mysql-test/suite/jp/t/jp_enum_ucs2.test | 2 + mysql-test/suite/jp/t/jp_enum_ujis.test | 2 + mysql-test/suite/jp/t/jp_enum_utf8.test | 2 + mysql-test/suite/jp/t/jp_insert_sjis.test | 2 + mysql-test/suite/jp/t/jp_insert_ucs2.test | 2 + mysql-test/suite/jp/t/jp_insert_ujis.test | 2 + mysql-test/suite/jp/t/jp_insert_utf8.test | 2 + mysql-test/suite/jp/t/jp_instr_sjis.test | 2 + mysql-test/suite/jp/t/jp_instr_ucs2.test | 2 + mysql-test/suite/jp/t/jp_instr_ujis.test | 2 + mysql-test/suite/jp/t/jp_instr_utf8.test | 2 + mysql-test/suite/jp/t/jp_join_sjis.test | 1 + mysql-test/suite/jp/t/jp_join_ucs2.test | 1 + mysql-test/suite/jp/t/jp_join_ujis.test | 1 + mysql-test/suite/jp/t/jp_join_utf8.test | 1 + mysql-test/suite/jp/t/jp_left_sjis.test | 2 + mysql-test/suite/jp/t/jp_left_ucs2.test | 2 + mysql-test/suite/jp/t/jp_left_ujis.test | 2 + mysql-test/suite/jp/t/jp_left_utf8.test | 2 + mysql-test/suite/jp/t/jp_length_sjis.test | 2 + mysql-test/suite/jp/t/jp_length_ucs2.test | 2 + mysql-test/suite/jp/t/jp_length_ujis.test | 2 + mysql-test/suite/jp/t/jp_length_utf8.test | 2 + mysql-test/suite/jp/t/jp_like_sjis.test | 2 + mysql-test/suite/jp/t/jp_like_ucs2.test | 2 + mysql-test/suite/jp/t/jp_like_ujis.test | 2 + mysql-test/suite/jp/t/jp_like_utf8.test | 2 + mysql-test/suite/jp/t/jp_locate_sjis.test | 2 + mysql-test/suite/jp/t/jp_locate_ucs2.test | 2 + mysql-test/suite/jp/t/jp_locate_ujis.test | 2 + mysql-test/suite/jp/t/jp_locate_utf8.test | 2 + mysql-test/suite/jp/t/jp_lpad_sjis.test | 2 + mysql-test/suite/jp/t/jp_lpad_ucs2.test | 2 + mysql-test/suite/jp/t/jp_lpad_ujis.test | 2 + mysql-test/suite/jp/t/jp_lpad_utf8.test | 2 + mysql-test/suite/jp/t/jp_ltrim_sjis.test | 2 + mysql-test/suite/jp/t/jp_ltrim_ucs2.test | 2 + mysql-test/suite/jp/t/jp_ltrim_ujis.test | 2 + mysql-test/suite/jp/t/jp_ltrim_utf8.test | 2 + mysql-test/suite/jp/t/jp_ps_sjis.test | 2 + mysql-test/suite/jp/t/jp_ps_ujis.test | 2 + mysql-test/suite/jp/t/jp_replace_sjis.test | 2 + mysql-test/suite/jp/t/jp_replace_ucs2.test | 2 + mysql-test/suite/jp/t/jp_replace_ujis.test | 2 + mysql-test/suite/jp/t/jp_replace_utf8.test | 2 + mysql-test/suite/jp/t/jp_reverse_sjis.test | 2 + mysql-test/suite/jp/t/jp_reverse_ucs2.test | 2 + mysql-test/suite/jp/t/jp_reverse_ujis.test | 2 + mysql-test/suite/jp/t/jp_reverse_utf8.test | 2 + mysql-test/suite/jp/t/jp_right_sjis.test | 2 + mysql-test/suite/jp/t/jp_right_ucs2.test | 2 + mysql-test/suite/jp/t/jp_right_ujis.test | 2 + mysql-test/suite/jp/t/jp_right_utf8.test | 2 + mysql-test/suite/jp/t/jp_rpad_sjis.test | 2 + mysql-test/suite/jp/t/jp_rpad_ucs2.test | 2 + mysql-test/suite/jp/t/jp_rpad_ujis.test | 2 + mysql-test/suite/jp/t/jp_rpad_utf8.test | 2 + mysql-test/suite/jp/t/jp_rtrim_sjis.test | 2 + mysql-test/suite/jp/t/jp_rtrim_ucs2.test | 2 + mysql-test/suite/jp/t/jp_rtrim_ujis.test | 2 + mysql-test/suite/jp/t/jp_rtrim_utf8.test | 2 + mysql-test/suite/jp/t/jp_select_sjis.test | 2 + mysql-test/suite/jp/t/jp_select_ucs2.test | 2 + mysql-test/suite/jp/t/jp_select_ujis.test | 2 + mysql-test/suite/jp/t/jp_select_utf8.test | 2 + mysql-test/suite/jp/t/jp_subquery_sjis.test | 1 + mysql-test/suite/jp/t/jp_subquery_ucs2.test | 1 + mysql-test/suite/jp/t/jp_subquery_ujis.test | 1 + mysql-test/suite/jp/t/jp_subquery_utf8.test | 1 + mysql-test/suite/jp/t/jp_substring_sjis.test | 2 + mysql-test/suite/jp/t/jp_substring_ucs2.test | 2 + mysql-test/suite/jp/t/jp_substring_ujis.test | 2 + mysql-test/suite/jp/t/jp_substring_utf8.test | 2 + mysql-test/suite/jp/t/jp_trim_sjis.test | 2 + mysql-test/suite/jp/t/jp_trim_ucs2.test | 2 + mysql-test/suite/jp/t/jp_trim_ujis.test | 2 + mysql-test/suite/jp/t/jp_trim_utf8.test | 2 + mysql-test/suite/jp/t/jp_union_ujis.test | 2 + mysql-test/suite/jp/t/jp_update_sjis.test | 2 + mysql-test/suite/jp/t/jp_update_ucs2.test | 2 + mysql-test/suite/jp/t/jp_update_ujis.test | 2 + mysql-test/suite/jp/t/jp_update_utf8.test | 2 + mysql-test/suite/jp/t/jp_where_sjis.test | 2 + mysql-test/suite/jp/t/jp_where_ucs2.test | 2 + mysql-test/suite/jp/t/jp_where_ujis.test | 2 + mysql-test/suite/jp/t/jp_where_utf8.test | 2 + 129 files changed, 1303 insertions(+), 885 deletions(-) diff --git a/mysql-test/suite/jp/r/jp_alter_sjis.result b/mysql-test/suite/jp/r/jp_alter_sjis.result index f970508229a..32ae7d5729d 100644 --- a/mysql-test/suite/jp/r/jp_alter_sjis.result +++ b/mysql-test/suite/jp/r/jp_alter_sjis.result @@ -31,8 +31,8 @@ NULL DESC `北盽; Field Type Null Key Default Extra 抖 char(1) YES MUL NULL -贩 char(6) PRI -父 char(1) YES MUL NULL +贩 char(6) NO PRI +父 char(1) YES UNI NULL 构 char(1) YES NULL SHOW CREATE TABLE `北盽; Table Create Table @@ -58,7 +58,7 @@ SELECT * FROM ` 吵吵 DESC `北盽; Field Type Null Key Default Extra -贩 char(6) +贩 char(6) NO SHOW CREATE TABLE `北盽; Table Create Table 北 CREATE TABLE `北盽 ( @@ -80,8 +80,8 @@ NULL DESC `偁偁偁`; Field Type Null Key Default Extra 偐偐 char(1) YES MUL NULL -偒偒偒 char(6) PRI -偔偔偔 char(1) YES MUL NULL +偒偒偒 char(6) NO PRI +偔偔偔 char(1) YES UNI NULL 偗偗偗 char(1) YES NULL SHOW CREATE TABLE `偁偁偁`; Table Create Table @@ -107,7 +107,7 @@ SELECT * FROM ` 偆偆偆偆偆 DESC `偁偁偁`; Field Type Null Key Default Extra -偒偒偒 char(6) +偒偒偒 char(6) NO SHOW CREATE TABLE `偁偁偁`; Table Create Table 偁偁偁 CREATE TABLE `偁偁偁` ( @@ -129,8 +129,8 @@ NULL DESC `僜僜僜`; Field Type Null Key Default Extra 峔峔 char(1) YES MUL NULL -昞昞昞 char(6) PRI -擻擻擻 char(1) YES MUL NULL +昞昞昞 char(6) NO PRI +擻擻擻 char(1) YES UNI NULL 梊梊梊 char(1) YES NULL SHOW CREATE TABLE `僜僜僜`; Table Create Table @@ -156,7 +156,7 @@ SELECT * FROM ` 昞昞昞昞昞 DESC `僜僜僜`; Field Type Null Key Default Extra -昞昞昞 char(6) +昞昞昞 char(6) NO SHOW CREATE TABLE `僜僜僜`; Table Create Table 僜僜僜 CREATE TABLE `僜僜僜` ( @@ -193,8 +193,8 @@ NULL DESC `北盽; Field Type Null Key Default Extra 抖 char(1) YES MUL NULL -贩 char(6) PRI -父 char(1) YES MUL NULL +贩 char(6) NO PRI +父 char(1) YES UNI NULL 构 char(1) YES NULL SHOW CREATE TABLE `北盽; Table Create Table @@ -220,7 +220,7 @@ SELECT * FROM ` 吵吵 DESC `北盽; Field Type Null Key Default Extra -贩 char(6) +贩 char(6) NO SHOW CREATE TABLE `北盽; Table Create Table 北 CREATE TABLE `北盽 ( @@ -242,8 +242,8 @@ NULL DESC `偁偁偁`; Field Type Null Key Default Extra 偐偐 char(1) YES MUL NULL -偒偒偒 char(6) PRI -偔偔偔 char(1) YES MUL NULL +偒偒偒 char(6) NO PRI +偔偔偔 char(1) YES UNI NULL 偗偗偗 char(1) YES NULL SHOW CREATE TABLE `偁偁偁`; Table Create Table @@ -269,7 +269,7 @@ SELECT * FROM ` 偆偆偆偆偆 DESC `偁偁偁`; Field Type Null Key Default Extra -偒偒偒 char(6) +偒偒偒 char(6) NO SHOW CREATE TABLE `偁偁偁`; Table Create Table 偁偁偁 CREATE TABLE `偁偁偁` ( @@ -291,8 +291,8 @@ NULL DESC `僜僜僜`; Field Type Null Key Default Extra 峔峔 char(1) YES MUL NULL -昞昞昞 char(6) PRI -擻擻擻 char(1) YES MUL NULL +昞昞昞 char(6) NO PRI +擻擻擻 char(1) YES UNI NULL 梊梊梊 char(1) YES NULL SHOW CREATE TABLE `僜僜僜`; Table Create Table @@ -318,7 +318,7 @@ SELECT * FROM ` 擻擻擻擻擻 DESC `僜僜僜`; Field Type Null Key Default Extra -昞昞昞 char(6) +昞昞昞 char(6) NO SHOW CREATE TABLE `僜僜僜`; Table Create Table 僜僜僜 CREATE TABLE `僜僜僜` ( @@ -355,8 +355,8 @@ NULL DESC `北盽; Field Type Null Key Default Extra 抖 char(1) YES MUL NULL -贩 char(6) PRI -父 char(1) YES MUL NULL +贩 char(6) NO PRI +父 char(1) YES UNI NULL 构 char(1) YES NULL SHOW CREATE TABLE `北盽; Table Create Table @@ -368,7 +368,7 @@ Table Create Table PRIMARY KEY (`贩穈), UNIQUE KEY `父竊 (`父竊), KEY `抖禶 (`抖`) -) ENGINE=HEAP DEFAULT CHARSET=sjis +) ENGINE=MEMORY DEFAULT CHARSET=sjis ALTER TABLE `北盽 DROP INDEX `抖禶; ALTER TABLE `北盽 DROP PRIMARY KEY; ALTER TABLE `北盽 DROP INDEX `父竊; @@ -382,12 +382,12 @@ SELECT * FROM ` 吵吵 DESC `北盽; Field Type Null Key Default Extra -贩 char(6) +贩 char(6) NO SHOW CREATE TABLE `北盽; Table Create Table 北 CREATE TABLE `北盽 ( `贩穈 char(6) NOT NULL default '' -) ENGINE=HEAP DEFAULT CHARSET=sjis +) ENGINE=MEMORY DEFAULT CHARSET=sjis ALTER TABLE `偁偁偁` ADD `偐偐偐` char(1) FIRST; ALTER TABLE `偁偁偁` ADD `偔偔偔` char(1) AFTER `偒偒偒`; ALTER TABLE `偁偁偁` ADD `偗偗偗` char(1); @@ -404,8 +404,8 @@ NULL DESC `偁偁偁`; Field Type Null Key Default Extra 偐偐 char(1) YES MUL NULL -偒偒偒 char(6) PRI -偔偔偔 char(1) YES MUL NULL +偒偒偒 char(6) NO PRI +偔偔偔 char(1) YES UNI NULL 偗偗偗 char(1) YES NULL SHOW CREATE TABLE `偁偁偁`; Table Create Table @@ -417,7 +417,7 @@ Table Create Table PRIMARY KEY (`偒偒偒`), UNIQUE KEY `偔偔偔` (`偔偔偔`), KEY `偐偐偐` (`偐偐`) -) ENGINE=HEAP DEFAULT CHARSET=sjis +) ENGINE=MEMORY DEFAULT CHARSET=sjis ALTER TABLE `偁偁偁` DROP INDEX `偐偐偐`; ALTER TABLE `偁偁偁` DROP PRIMARY KEY; ALTER TABLE `偁偁偁` DROP INDEX `偔偔偔`; @@ -431,12 +431,12 @@ SELECT * FROM ` 偆偆偆偆偆 DESC `偁偁偁`; Field Type Null Key Default Extra -偒偒偒 char(6) +偒偒偒 char(6) NO SHOW CREATE TABLE `偁偁偁`; Table Create Table 偁偁偁 CREATE TABLE `偁偁偁` ( `偒偒偒` char(6) NOT NULL default '' -) ENGINE=HEAP DEFAULT CHARSET=sjis +) ENGINE=MEMORY DEFAULT CHARSET=sjis ALTER TABLE `僜僜僜` ADD `峔峔峔` char(1) FIRST; ALTER TABLE `僜僜僜` ADD `擻擻擻` char(1) AFTER `昞昞昞`; ALTER TABLE `僜僜僜` ADD `梊梊梊` char(1); @@ -453,8 +453,8 @@ NULL DESC `僜僜僜`; Field Type Null Key Default Extra 峔峔 char(1) YES MUL NULL -昞昞昞 char(6) PRI -擻擻擻 char(1) YES MUL NULL +昞昞昞 char(6) NO PRI +擻擻擻 char(1) YES UNI NULL 梊梊梊 char(1) YES NULL SHOW CREATE TABLE `僜僜僜`; Table Create Table @@ -466,7 +466,7 @@ Table Create Table PRIMARY KEY (`昞昞昞`), UNIQUE KEY `擻擻擻` (`擻擻擻`), KEY `峔峔峔` (`峔峔`) -) ENGINE=HEAP DEFAULT CHARSET=sjis +) ENGINE=MEMORY DEFAULT CHARSET=sjis ALTER TABLE `僜僜僜` DROP INDEX `峔峔峔`; ALTER TABLE `僜僜僜` DROP PRIMARY KEY; ALTER TABLE `僜僜僜` DROP INDEX `擻擻擻`; @@ -480,12 +480,12 @@ SELECT * FROM ` 擻擻擻擻擻 DESC `僜僜僜`; Field Type Null Key Default Extra -昞昞昞 char(6) +昞昞昞 char(6) NO SHOW CREATE TABLE `僜僜僜`; Table Create Table 僜僜僜 CREATE TABLE `僜僜僜` ( `昞昞昞` char(6) NOT NULL default '' -) ENGINE=HEAP DEFAULT CHARSET=sjis +) ENGINE=MEMORY DEFAULT CHARSET=sjis DROP TABLE `北盽; DROP TABLE `膊瞏; DROP TABLE `偁偁偁`; @@ -516,7 +516,7 @@ NULL DESC `北盽; Field Type Null Key Default Extra 抖 char(1) YES MUL NULL -贩 char(6) PRI +贩 char(6) NO PRI 父 char(1) YES NULL 构 char(1) YES NULL SHOW CREATE TABLE `北盽; @@ -541,7 +541,7 @@ SELECT * FROM ` 吵吵 DESC `北盽; Field Type Null Key Default Extra -贩 char(6) +贩 char(6) NO SHOW CREATE TABLE `北盽; Table Create Table 北 CREATE TABLE `北盽 ( @@ -562,7 +562,7 @@ NULL DESC `偁偁偁`; Field Type Null Key Default Extra 偐偐 char(1) YES MUL NULL -偒偒偒 char(6) PRI +偒偒偒 char(6) NO PRI 偔偔偔 char(1) YES NULL 偗偗偗 char(1) YES NULL SHOW CREATE TABLE `偁偁偁`; @@ -587,7 +587,7 @@ SELECT * FROM ` 偆偆偆偆偆 DESC `偁偁偁`; Field Type Null Key Default Extra -偒偒偒 char(6) +偒偒偒 char(6) NO SHOW CREATE TABLE `偁偁偁`; Table Create Table 偁偁偁 CREATE TABLE `偁偁偁` ( @@ -608,7 +608,7 @@ NULL DESC `僜僜僜`; Field Type Null Key Default Extra 峔峔 char(1) YES MUL NULL -昞昞昞 char(6) PRI +昞昞昞 char(6) NO PRI 擻擻擻 char(1) YES NULL 梊梊梊 char(1) YES NULL SHOW CREATE TABLE `僜僜僜`; @@ -633,7 +633,7 @@ SELECT * FROM ` 昞昞昞昞昞 DESC `僜僜僜`; Field Type Null Key Default Extra -昞昞昞 char(6) +昞昞昞 char(6) NO SHOW CREATE TABLE `僜僜僜`; Table Create Table 僜僜僜 CREATE TABLE `僜僜僜` ( diff --git a/mysql-test/suite/jp/r/jp_alter_ucs2.result b/mysql-test/suite/jp/r/jp_alter_ucs2.result index 2756e5a758d..746dfdd62cc 100644 --- a/mysql-test/suite/jp/r/jp_alter_ucs2.result +++ b/mysql-test/suite/jp/r/jp_alter_ucs2.result @@ -32,8 +32,8 @@ NULL DESC `幈幈幈`; Field Type Null Key Default Extra 幎幎 char(1) YES MUL NULL -幏幏幏 char(6) PRI -幐幐幐 char(1) YES MUL NULL +幏幏幏 char(6) NO PRI +幐幐幐 char(1) YES UNI NULL 幑幑幑 char(1) YES NULL SHOW CREATE TABLE `幈幈幈`; Table Create Table @@ -59,7 +59,7 @@ SELECT * FROM ` 幊幊幊幊幊 DESC `幈幈幈`; Field Type Null Key Default Extra -幏幏幏 char(6) +幏幏幏 char(6) NO SHOW CREATE TABLE `幈幈幈`; Table Create Table 幈幈幈 CREATE TABLE `幈幈幈` ( @@ -81,8 +81,8 @@ NULL DESC `あああ`; Field Type Null Key Default Extra かか char(1) YES MUL NULL -ききき char(6) PRI -くくく char(1) YES MUL NULL +ききき char(6) NO PRI +くくく char(1) YES UNI NULL けけけ char(1) YES NULL SHOW CREATE TABLE `あああ`; Table Create Table @@ -108,7 +108,7 @@ SELECT * FROM ` ううううう DESC `あああ`; Field Type Null Key Default Extra -ききき char(6) +ききき char(6) NO SHOW CREATE TABLE `あああ`; Table Create Table あああ CREATE TABLE `あああ` ( @@ -130,8 +130,8 @@ NULL DESC `忢輳磔忢輅; Field Type Null Key Default Extra 彴阿 char(1) YES MUL NULL -彴啊彴 char(6) PRI -彴埃彴 char(1) YES MUL NULL +彴啊彴 char(6) NO PRI +彴埃彴 char(1) YES UNI NULL 彴磸按彴 char(1) YES NULL SHOW CREATE TABLE `忢輳磔忢輅; Table Create Table @@ -157,7 +157,7 @@ SELECT * FROM ` 彴埃彴埃彴 DESC `忢輳磔忢輅; Field Type Null Key Default Extra -彴啊彴 char(6) +彴啊彴 char(6) NO SHOW CREATE TABLE `忢輳磔忢輅; Table Create Table 忢輳磔忢 CREATE TABLE `忢輳磔忢輅 ( @@ -194,8 +194,8 @@ NULL DESC `幈幈幈`; Field Type Null Key Default Extra 幎幎 char(1) YES MUL NULL -幏幏幏 char(6) PRI -幐幐幐 char(1) YES MUL NULL +幏幏幏 char(6) NO PRI +幐幐幐 char(1) YES UNI NULL 幑幑幑 char(1) YES NULL SHOW CREATE TABLE `幈幈幈`; Table Create Table @@ -221,7 +221,7 @@ SELECT * FROM ` 幊幊幊幊幊 DESC `幈幈幈`; Field Type Null Key Default Extra -幏幏幏 char(6) +幏幏幏 char(6) NO SHOW CREATE TABLE `幈幈幈`; Table Create Table 幈幈幈 CREATE TABLE `幈幈幈` ( @@ -243,8 +243,8 @@ NULL DESC `あああ`; Field Type Null Key Default Extra かか char(1) YES MUL NULL -ききき char(6) PRI -くくく char(1) YES MUL NULL +ききき char(6) NO PRI +くくく char(1) YES UNI NULL けけけ char(1) YES NULL SHOW CREATE TABLE `あああ`; Table Create Table @@ -270,7 +270,7 @@ SELECT * FROM ` ううううう DESC `あああ`; Field Type Null Key Default Extra -ききき char(6) +ききき char(6) NO SHOW CREATE TABLE `あああ`; Table Create Table あああ CREATE TABLE `あああ` ( @@ -292,8 +292,8 @@ NULL DESC `忢輳磔忢輅; Field Type Null Key Default Extra 彴阿 char(1) YES MUL NULL -彴啊彴 char(6) PRI -彴埃彴 char(1) YES MUL NULL +彴啊彴 char(6) NO PRI +彴埃彴 char(1) YES UNI NULL 彴磸按彴 char(1) YES NULL SHOW CREATE TABLE `忢輳磔忢輅; Table Create Table @@ -319,7 +319,7 @@ SELECT * FROM ` 彴埃彴埃彴 DESC `忢輳磔忢輅; Field Type Null Key Default Extra -彴啊彴 char(6) +彴啊彴 char(6) NO SHOW CREATE TABLE `忢輳磔忢輅; Table Create Table 忢輳磔忢 CREATE TABLE `忢輳磔忢輅 ( @@ -356,8 +356,8 @@ NULL DESC `幈幈幈`; Field Type Null Key Default Extra 幎幎 char(1) YES MUL NULL -幏幏幏 char(6) PRI -幐幐幐 char(1) YES MUL NULL +幏幏幏 char(6) NO PRI +幐幐幐 char(1) YES UNI NULL 幑幑幑 char(1) YES NULL SHOW CREATE TABLE `幈幈幈`; Table Create Table @@ -369,7 +369,7 @@ Table Create Table PRIMARY KEY (`幏幏幏`), UNIQUE KEY `幐幐幐` (`幐幐幐`), KEY `幎幎幎` (`幎幎`) -) ENGINE=HEAP DEFAULT CHARSET=ucs2 +) ENGINE=MEMORY DEFAULT CHARSET=ucs2 ALTER TABLE `幈幈幈` DROP INDEX `幎幎幎`; ALTER TABLE `幈幈幈` DROP PRIMARY KEY; ALTER TABLE `幈幈幈` DROP INDEX `幐幐幐`; @@ -383,12 +383,12 @@ SELECT * FROM ` 幊幊幊幊幊 DESC `幈幈幈`; Field Type Null Key Default Extra -幏幏幏 char(6) +幏幏幏 char(6) NO SHOW CREATE TABLE `幈幈幈`; Table Create Table 幈幈幈 CREATE TABLE `幈幈幈` ( `幏幏幏` char(6) NOT NULL default '' -) ENGINE=HEAP DEFAULT CHARSET=ucs2 +) ENGINE=MEMORY DEFAULT CHARSET=ucs2 ALTER TABLE `あああ` ADD `かかか` char(1) FIRST; ALTER TABLE `あああ` ADD `くくく` char(1) AFTER `ききき`; ALTER TABLE `あああ` ADD `けけけ` char(1); @@ -405,8 +405,8 @@ NULL DESC `あああ`; Field Type Null Key Default Extra かか char(1) YES MUL NULL -ききき char(6) PRI -くくく char(1) YES MUL NULL +ききき char(6) NO PRI +くくく char(1) YES UNI NULL けけけ char(1) YES NULL SHOW CREATE TABLE `あああ`; Table Create Table @@ -418,7 +418,7 @@ Table Create Table PRIMARY KEY (`ききき`), UNIQUE KEY `くくく` (`くくく`), KEY `かかか` (`かか`) -) ENGINE=HEAP DEFAULT CHARSET=ucs2 +) ENGINE=MEMORY DEFAULT CHARSET=ucs2 ALTER TABLE `あああ` DROP INDEX `かかか`; ALTER TABLE `あああ` DROP PRIMARY KEY; ALTER TABLE `あああ` DROP INDEX `くくく`; @@ -432,12 +432,12 @@ SELECT * FROM ` ううううう DESC `あああ`; Field Type Null Key Default Extra -ききき char(6) +ききき char(6) NO SHOW CREATE TABLE `あああ`; Table Create Table あああ CREATE TABLE `あああ` ( `ききき` char(6) NOT NULL default '' -) ENGINE=HEAP DEFAULT CHARSET=ucs2 +) ENGINE=MEMORY DEFAULT CHARSET=ucs2 ALTER TABLE `忢輳磔忢輅 ADD `彴阿彴 char(1) FIRST; ALTER TABLE `忢輳磔忢輅 ADD `彴埃彴 char(1) AFTER `彴啊彴; ALTER TABLE `忢輳磔忢輅 ADD `彴磸按彴碻 char(1); @@ -454,8 +454,8 @@ NULL DESC `忢輳磔忢輅; Field Type Null Key Default Extra 彴阿 char(1) YES MUL NULL -彴啊彴 char(6) PRI -彴埃彴 char(1) YES MUL NULL +彴啊彴 char(6) NO PRI +彴埃彴 char(1) YES UNI NULL 彴磸按彴 char(1) YES NULL SHOW CREATE TABLE `忢輳磔忢輅; Table Create Table @@ -467,7 +467,7 @@ Table Create Table PRIMARY KEY (`彴啊彴), UNIQUE KEY `彴埃彴 (`彴埃彴), KEY `彴阿彴 (`彴阿`) -) ENGINE=HEAP DEFAULT CHARSET=ucs2 +) ENGINE=MEMORY DEFAULT CHARSET=ucs2 ALTER TABLE `忢輳磔忢輅 DROP INDEX `彴阿彴; ALTER TABLE `忢輳磔忢輅 DROP PRIMARY KEY; ALTER TABLE `忢輳磔忢輅 DROP INDEX `彴埃彴; @@ -481,12 +481,12 @@ SELECT * FROM ` 彴埃彴埃彴 DESC `忢輳磔忢輅; Field Type Null Key Default Extra -彴啊彴 char(6) +彴啊彴 char(6) NO SHOW CREATE TABLE `忢輳磔忢輅; Table Create Table 忢輳磔忢 CREATE TABLE `忢輳磔忢輅 ( `彴啊彴 char(6) NOT NULL default '' -) ENGINE=HEAP DEFAULT CHARSET=ucs2 +) ENGINE=MEMORY DEFAULT CHARSET=ucs2 DROP TABLE `幈幈幈`; DROP TABLE `幉幉幉`; DROP TABLE `あああ`; @@ -517,7 +517,7 @@ NULL DESC `幈幈幈`; Field Type Null Key Default Extra 幎幎 char(1) YES MUL NULL -幏幏幏 char(6) PRI +幏幏幏 char(6) NO PRI 幐幐幐 char(1) YES NULL 幑幑幑 char(1) YES NULL SHOW CREATE TABLE `幈幈幈`; @@ -542,7 +542,7 @@ SELECT * FROM ` 幊幊幊幊幊 DESC `幈幈幈`; Field Type Null Key Default Extra -幏幏幏 char(6) +幏幏幏 char(6) NO SHOW CREATE TABLE `幈幈幈`; Table Create Table 幈幈幈 CREATE TABLE `幈幈幈` ( @@ -563,7 +563,7 @@ NULL DESC `あああ`; Field Type Null Key Default Extra かか char(1) YES MUL NULL -ききき char(6) PRI +ききき char(6) NO PRI くくく char(1) YES NULL けけけ char(1) YES NULL SHOW CREATE TABLE `あああ`; @@ -588,7 +588,7 @@ SELECT * FROM ` ううううう DESC `あああ`; Field Type Null Key Default Extra -ききき char(6) +ききき char(6) NO SHOW CREATE TABLE `あああ`; Table Create Table あああ CREATE TABLE `あああ` ( @@ -609,7 +609,7 @@ NULL DESC `忢輳磔忢輅; Field Type Null Key Default Extra 彴阿 char(1) YES MUL NULL -彴啊彴 char(6) PRI +彴啊彴 char(6) NO PRI 彴埃彴 char(1) YES NULL 彴磸按彴 char(1) YES NULL SHOW CREATE TABLE `忢輳磔忢輅; @@ -634,7 +634,7 @@ SELECT * FROM ` 彴埃彴埃彴 DESC `忢輳磔忢輅; Field Type Null Key Default Extra -彴啊彴 char(6) +彴啊彴 char(6) NO SHOW CREATE TABLE `忢輳磔忢輅; Table Create Table 忢輳磔忢 CREATE TABLE `忢輳磔忢輅 ( diff --git a/mysql-test/suite/jp/r/jp_alter_ujis.result b/mysql-test/suite/jp/r/jp_alter_ujis.result index afa3c79cbce..daea68caa3f 100644 --- a/mysql-test/suite/jp/r/jp_alter_ujis.result +++ b/mysql-test/suite/jp/r/jp_alter_ujis.result @@ -31,8 +31,8 @@ NULL DESC `幈幈幈`; Field Type Null Key Default Extra 幎幎 char(1) YES MUL NULL -幏幏幏 char(6) PRI -幐幐幐 char(1) YES MUL NULL +幏幏幏 char(6) NO PRI +幐幐幐 char(1) YES UNI NULL 幑幑幑 char(1) YES NULL SHOW CREATE TABLE `幈幈幈`; Table Create Table @@ -58,7 +58,7 @@ SELECT * FROM ` 幊幊幊幊幊 DESC `幈幈幈`; Field Type Null Key Default Extra -幏幏幏 char(6) +幏幏幏 char(6) NO SHOW CREATE TABLE `幈幈幈`; Table Create Table 幈幈幈 CREATE TABLE `幈幈幈` ( @@ -80,8 +80,8 @@ NULL DESC `あああ`; Field Type Null Key Default Extra かか char(1) YES MUL NULL -ききき char(6) PRI -くくく char(1) YES MUL NULL +ききき char(6) NO PRI +くくく char(1) YES UNI NULL けけけ char(1) YES NULL SHOW CREATE TABLE `あああ`; Table Create Table @@ -107,7 +107,7 @@ SELECT * FROM ` ううううう DESC `あああ`; Field Type Null Key Default Extra -ききき char(6) +ききき char(6) NO SHOW CREATE TABLE `あああ`; Table Create Table あああ CREATE TABLE `あああ` ( @@ -129,8 +129,8 @@ NULL DESC `忢輳磔忢輅; Field Type Null Key Default Extra 彴阿 char(1) YES MUL NULL -彴啊彴 char(6) PRI -彴埃彴 char(1) YES MUL NULL +彴啊彴 char(6) NO PRI +彴埃彴 char(1) YES UNI NULL 彴磸按彴 char(1) YES NULL SHOW CREATE TABLE `忢輳磔忢輅; Table Create Table @@ -156,7 +156,7 @@ SELECT * FROM ` 彴埃彴埃彴 DESC `忢輳磔忢輅; Field Type Null Key Default Extra -彴啊彴 char(6) +彴啊彴 char(6) NO SHOW CREATE TABLE `忢輳磔忢輅; Table Create Table 忢輳磔忢 CREATE TABLE `忢輳磔忢輅 ( @@ -193,8 +193,8 @@ NULL DESC `幈幈幈`; Field Type Null Key Default Extra 幎幎 char(1) YES MUL NULL -幏幏幏 char(6) PRI -幐幐幐 char(1) YES MUL NULL +幏幏幏 char(6) NO PRI +幐幐幐 char(1) YES UNI NULL 幑幑幑 char(1) YES NULL SHOW CREATE TABLE `幈幈幈`; Table Create Table @@ -220,7 +220,7 @@ SELECT * FROM ` 幊幊幊幊幊 DESC `幈幈幈`; Field Type Null Key Default Extra -幏幏幏 char(6) +幏幏幏 char(6) NO SHOW CREATE TABLE `幈幈幈`; Table Create Table 幈幈幈 CREATE TABLE `幈幈幈` ( @@ -242,8 +242,8 @@ NULL DESC `あああ`; Field Type Null Key Default Extra かか char(1) YES MUL NULL -ききき char(6) PRI -くくく char(1) YES MUL NULL +ききき char(6) NO PRI +くくく char(1) YES UNI NULL けけけ char(1) YES NULL SHOW CREATE TABLE `あああ`; Table Create Table @@ -269,7 +269,7 @@ SELECT * FROM ` ううううう DESC `あああ`; Field Type Null Key Default Extra -ききき char(6) +ききき char(6) NO SHOW CREATE TABLE `あああ`; Table Create Table あああ CREATE TABLE `あああ` ( @@ -291,8 +291,8 @@ NULL DESC `忢輳磔忢輅; Field Type Null Key Default Extra 彴阿 char(1) YES MUL NULL -彴啊彴 char(6) PRI -彴埃彴 char(1) YES MUL NULL +彴啊彴 char(6) NO PRI +彴埃彴 char(1) YES UNI NULL 彴磸按彴 char(1) YES NULL SHOW CREATE TABLE `忢輳磔忢輅; Table Create Table @@ -318,7 +318,7 @@ SELECT * FROM ` 彴埃彴埃彴 DESC `忢輳磔忢輅; Field Type Null Key Default Extra -彴啊彴 char(6) +彴啊彴 char(6) NO SHOW CREATE TABLE `忢輳磔忢輅; Table Create Table 忢輳磔忢 CREATE TABLE `忢輳磔忢輅 ( @@ -355,8 +355,8 @@ NULL DESC `幈幈幈`; Field Type Null Key Default Extra 幎幎 char(1) YES MUL NULL -幏幏幏 char(6) PRI -幐幐幐 char(1) YES MUL NULL +幏幏幏 char(6) NO PRI +幐幐幐 char(1) YES UNI NULL 幑幑幑 char(1) YES NULL SHOW CREATE TABLE `幈幈幈`; Table Create Table @@ -368,7 +368,7 @@ Table Create Table PRIMARY KEY (`幏幏幏`), UNIQUE KEY `幐幐幐` (`幐幐幐`), KEY `幎幎幎` (`幎幎`) -) ENGINE=HEAP DEFAULT CHARSET=ujis +) ENGINE=MEMORY DEFAULT CHARSET=ujis ALTER TABLE `幈幈幈` DROP INDEX `幎幎幎`; ALTER TABLE `幈幈幈` DROP PRIMARY KEY; ALTER TABLE `幈幈幈` DROP INDEX `幐幐幐`; @@ -382,12 +382,12 @@ SELECT * FROM ` 幊幊幊幊幊 DESC `幈幈幈`; Field Type Null Key Default Extra -幏幏幏 char(6) +幏幏幏 char(6) NO SHOW CREATE TABLE `幈幈幈`; Table Create Table 幈幈幈 CREATE TABLE `幈幈幈` ( `幏幏幏` char(6) NOT NULL default '' -) ENGINE=HEAP DEFAULT CHARSET=ujis +) ENGINE=MEMORY DEFAULT CHARSET=ujis ALTER TABLE `あああ` ADD `かかか` char(1) FIRST; ALTER TABLE `あああ` ADD `くくく` char(1) AFTER `ききき`; ALTER TABLE `あああ` ADD `けけけ` char(1); @@ -404,8 +404,8 @@ NULL DESC `あああ`; Field Type Null Key Default Extra かか char(1) YES MUL NULL -ききき char(6) PRI -くくく char(1) YES MUL NULL +ききき char(6) NO PRI +くくく char(1) YES UNI NULL けけけ char(1) YES NULL SHOW CREATE TABLE `あああ`; Table Create Table @@ -417,7 +417,7 @@ Table Create Table PRIMARY KEY (`ききき`), UNIQUE KEY `くくく` (`くくく`), KEY `かかか` (`かか`) -) ENGINE=HEAP DEFAULT CHARSET=ujis +) ENGINE=MEMORY DEFAULT CHARSET=ujis ALTER TABLE `あああ` DROP INDEX `かかか`; ALTER TABLE `あああ` DROP PRIMARY KEY; ALTER TABLE `あああ` DROP INDEX `くくく`; @@ -431,12 +431,12 @@ SELECT * FROM ` ううううう DESC `あああ`; Field Type Null Key Default Extra -ききき char(6) +ききき char(6) NO SHOW CREATE TABLE `あああ`; Table Create Table あああ CREATE TABLE `あああ` ( `ききき` char(6) NOT NULL default '' -) ENGINE=HEAP DEFAULT CHARSET=ujis +) ENGINE=MEMORY DEFAULT CHARSET=ujis ALTER TABLE `忢輳磔忢輅 ADD `彴阿彴 char(1) FIRST; ALTER TABLE `忢輳磔忢輅 ADD `彴埃彴 char(1) AFTER `彴啊彴; ALTER TABLE `忢輳磔忢輅 ADD `彴磸按彴碻 char(1); @@ -453,8 +453,8 @@ NULL DESC `忢輳磔忢輅; Field Type Null Key Default Extra 彴阿 char(1) YES MUL NULL -彴啊彴 char(6) PRI -彴埃彴 char(1) YES MUL NULL +彴啊彴 char(6) NO PRI +彴埃彴 char(1) YES UNI NULL 彴磸按彴 char(1) YES NULL SHOW CREATE TABLE `忢輳磔忢輅; Table Create Table @@ -466,7 +466,7 @@ Table Create Table PRIMARY KEY (`彴啊彴), UNIQUE KEY `彴埃彴 (`彴埃彴), KEY `彴阿彴 (`彴阿`) -) ENGINE=HEAP DEFAULT CHARSET=ujis +) ENGINE=MEMORY DEFAULT CHARSET=ujis ALTER TABLE `忢輳磔忢輅 DROP INDEX `彴阿彴; ALTER TABLE `忢輳磔忢輅 DROP PRIMARY KEY; ALTER TABLE `忢輳磔忢輅 DROP INDEX `彴埃彴; @@ -480,12 +480,12 @@ SELECT * FROM ` 彴埃彴埃彴 DESC `忢輳磔忢輅; Field Type Null Key Default Extra -彴啊彴 char(6) +彴啊彴 char(6) NO SHOW CREATE TABLE `忢輳磔忢輅; Table Create Table 忢輳磔忢 CREATE TABLE `忢輳磔忢輅 ( `彴啊彴 char(6) NOT NULL default '' -) ENGINE=HEAP DEFAULT CHARSET=ujis +) ENGINE=MEMORY DEFAULT CHARSET=ujis DROP TABLE `幈幈幈`; DROP TABLE `幉幉幉`; DROP TABLE `あああ`; @@ -516,7 +516,7 @@ NULL DESC `幈幈幈`; Field Type Null Key Default Extra 幎幎 char(1) YES MUL NULL -幏幏幏 char(6) PRI +幏幏幏 char(6) NO PRI 幐幐幐 char(1) YES NULL 幑幑幑 char(1) YES NULL SHOW CREATE TABLE `幈幈幈`; @@ -541,7 +541,7 @@ SELECT * FROM ` 幊幊幊幊幊 DESC `幈幈幈`; Field Type Null Key Default Extra -幏幏幏 char(6) +幏幏幏 char(6) NO SHOW CREATE TABLE `幈幈幈`; Table Create Table 幈幈幈 CREATE TABLE `幈幈幈` ( @@ -562,7 +562,7 @@ NULL DESC `あああ`; Field Type Null Key Default Extra かか char(1) YES MUL NULL -ききき char(6) PRI +ききき char(6) NO PRI くくく char(1) YES NULL けけけ char(1) YES NULL SHOW CREATE TABLE `あああ`; @@ -587,7 +587,7 @@ SELECT * FROM ` ううううう DESC `あああ`; Field Type Null Key Default Extra -ききき char(6) +ききき char(6) NO SHOW CREATE TABLE `あああ`; Table Create Table あああ CREATE TABLE `あああ` ( @@ -608,7 +608,7 @@ NULL DESC `忢輳磔忢輅; Field Type Null Key Default Extra 彴阿 char(1) YES MUL NULL -彴啊彴 char(6) PRI +彴啊彴 char(6) NO PRI 彴埃彴 char(1) YES NULL 彴磸按彴 char(1) YES NULL SHOW CREATE TABLE `忢輳磔忢輅; @@ -633,7 +633,7 @@ SELECT * FROM ` 彴埃彴埃彴 DESC `忢輳磔忢輅; Field Type Null Key Default Extra -彴啊彴 char(6) +彴啊彴 char(6) NO SHOW CREATE TABLE `忢輳磔忢輅; Table Create Table 忢輳磔忢 CREATE TABLE `忢輳磔忢輅 ( diff --git a/mysql-test/suite/jp/r/jp_alter_utf8.result b/mysql-test/suite/jp/r/jp_alter_utf8.result index 19475e06a87..f2f374eed87 100644 --- a/mysql-test/suite/jp/r/jp_alter_utf8.result +++ b/mysql-test/suite/jp/r/jp_alter_utf8.result @@ -31,8 +31,8 @@ NULL 锝筹匠锝筹匠锝 NULL NULL DESC `锝憋奖锝盽; Field Type Null Key Default Extra 锝讹蕉 char(1) YES MUL NULL -锝凤椒锝 char(6) PRI -锝革礁锝 char(1) YES MUL NULL +锝凤椒锝 char(6) NO PRI +锝革礁锝 char(1) YES UNI NULL 锝癸焦锝 char(1) YES NULL SHOW CREATE TABLE `锝憋奖锝盽; Table Create Table @@ -58,7 +58,7 @@ SELECT * FROM `锝憋奖锝盽; 锝筹匠锝筹匠锝 DESC `锝憋奖锝盽; Field Type Null Key Default Extra -锝凤椒锝 char(6) +锝凤椒锝 char(6) NO SHOW CREATE TABLE `锝憋奖锝盽; Table Create Table 锝憋奖锝 CREATE TABLE `锝憋奖锝盽 ( @@ -80,8 +80,8 @@ NULL 銇嗐亞銇嗐亞銇 NULL NULL DESC `銇傘亗銇俙; Field Type Null Key Default Extra 銇嬨亱 char(1) YES MUL NULL -銇嶃亶銇 char(6) PRI -銇忋亸銇 char(1) YES MUL NULL +銇嶃亶銇 char(6) NO PRI +銇忋亸銇 char(1) YES UNI NULL 銇戙亼銇 char(1) YES NULL SHOW CREATE TABLE `銇傘亗銇俙; Table Create Table @@ -107,7 +107,7 @@ SELECT * FROM `銇傘亗銇俙; 銇嗐亞銇嗐亞銇 DESC `銇傘亗銇俙; Field Type Null Key Default Extra -銇嶃亶銇 char(6) +銇嶃亶銇 char(6) NO SHOW CREATE TABLE `銇傘亗銇俙; Table Create Table 銇傘亗銇 CREATE TABLE `銇傘亗銇俙 ( @@ -129,8 +129,8 @@ NULL 涓呬竻涓呬竻涓 NULL NULL DESC `榫栭緰榫朻; Field Type Null Key Default Extra 涓勪竸 char(1) YES MUL NULL -涓備競涓 char(6) PRI -涓呬竻涓 char(1) YES MUL NULL +涓備競涓 char(6) NO PRI +涓呬竻涓 char(1) YES UNI NULL 涔氫箽涔 char(1) YES NULL SHOW CREATE TABLE `榫栭緰榫朻; Table Create Table @@ -156,7 +156,7 @@ SELECT * FROM `榫栭緰榫朻; 涓呬竻涓呬竻涓 DESC `榫栭緰榫朻; Field Type Null Key Default Extra -涓備競涓 char(6) +涓備競涓 char(6) NO SHOW CREATE TABLE `榫栭緰榫朻; Table Create Table 榫栭緰榫 CREATE TABLE `榫栭緰榫朻 ( @@ -193,8 +193,8 @@ NULL 锝筹匠锝筹匠锝 NULL NULL DESC `锝憋奖锝盽; Field Type Null Key Default Extra 锝讹蕉 char(1) YES MUL NULL -锝凤椒锝 char(6) PRI -锝革礁锝 char(1) YES MUL NULL +锝凤椒锝 char(6) NO PRI +锝革礁锝 char(1) YES UNI NULL 锝癸焦锝 char(1) YES NULL SHOW CREATE TABLE `锝憋奖锝盽; Table Create Table @@ -220,7 +220,7 @@ SELECT * FROM `锝憋奖锝盽; 锝筹匠锝筹匠锝 DESC `锝憋奖锝盽; Field Type Null Key Default Extra -锝凤椒锝 char(6) +锝凤椒锝 char(6) NO SHOW CREATE TABLE `锝憋奖锝盽; Table Create Table 锝憋奖锝 CREATE TABLE `锝憋奖锝盽 ( @@ -242,8 +242,8 @@ NULL 銇嗐亞銇嗐亞銇 NULL NULL DESC `銇傘亗銇俙; Field Type Null Key Default Extra 銇嬨亱 char(1) YES MUL NULL -銇嶃亶銇 char(6) PRI -銇忋亸銇 char(1) YES MUL NULL +銇嶃亶銇 char(6) NO PRI +銇忋亸銇 char(1) YES UNI NULL 銇戙亼銇 char(1) YES NULL SHOW CREATE TABLE `銇傘亗銇俙; Table Create Table @@ -269,7 +269,7 @@ SELECT * FROM `銇傘亗銇俙; 銇嗐亞銇嗐亞銇 DESC `銇傘亗銇俙; Field Type Null Key Default Extra -銇嶃亶銇 char(6) +銇嶃亶銇 char(6) NO SHOW CREATE TABLE `銇傘亗銇俙; Table Create Table 銇傘亗銇 CREATE TABLE `銇傘亗銇俙 ( @@ -291,8 +291,8 @@ NULL 涓呬竻涓呬竻涓 NULL NULL DESC `榫栭緰榫朻; Field Type Null Key Default Extra 涓勪竸 char(1) YES MUL NULL -涓備競涓 char(6) PRI -涓呬竻涓 char(1) YES MUL NULL +涓備競涓 char(6) NO PRI +涓呬竻涓 char(1) YES UNI NULL 涔氫箽涔 char(1) YES NULL SHOW CREATE TABLE `榫栭緰榫朻; Table Create Table @@ -318,7 +318,7 @@ SELECT * FROM `榫栭緰榫朻; 涓呬竻涓呬竻涓 DESC `榫栭緰榫朻; Field Type Null Key Default Extra -涓備競涓 char(6) +涓備競涓 char(6) NO SHOW CREATE TABLE `榫栭緰榫朻; Table Create Table 榫栭緰榫 CREATE TABLE `榫栭緰榫朻 ( @@ -355,8 +355,8 @@ NULL 锝筹匠锝筹匠锝 NULL NULL DESC `锝憋奖锝盽; Field Type Null Key Default Extra 锝讹蕉 char(1) YES MUL NULL -锝凤椒锝 char(6) PRI -锝革礁锝 char(1) YES MUL NULL +锝凤椒锝 char(6) NO PRI +锝革礁锝 char(1) YES UNI NULL 锝癸焦锝 char(1) YES NULL SHOW CREATE TABLE `锝憋奖锝盽; Table Create Table @@ -368,7 +368,7 @@ Table Create Table PRIMARY KEY (`锝凤椒锝穈), UNIQUE KEY `锝革礁锝竊 (`锝革礁锝竊), KEY `锝讹蕉锝禶 (`锝讹蕉`) -) ENGINE=HEAP DEFAULT CHARSET=utf8 +) ENGINE=MEMORY DEFAULT CHARSET=utf8 ALTER TABLE `锝憋奖锝盽 DROP INDEX `锝讹蕉锝禶; ALTER TABLE `锝憋奖锝盽 DROP PRIMARY KEY; ALTER TABLE `锝憋奖锝盽 DROP INDEX `锝革礁锝竊; @@ -382,12 +382,12 @@ SELECT * FROM `锝憋奖锝盽; 锝筹匠锝筹匠锝 DESC `锝憋奖锝盽; Field Type Null Key Default Extra -锝凤椒锝 char(6) +锝凤椒锝 char(6) NO SHOW CREATE TABLE `锝憋奖锝盽; Table Create Table 锝憋奖锝 CREATE TABLE `锝憋奖锝盽 ( `锝凤椒锝穈 char(6) NOT NULL default '' -) ENGINE=HEAP DEFAULT CHARSET=utf8 +) ENGINE=MEMORY DEFAULT CHARSET=utf8 ALTER TABLE `銇傘亗銇俙 ADD `銇嬨亱銇媊 char(1) FIRST; ALTER TABLE `銇傘亗銇俙 ADD `銇忋亸銇廯 char(1) AFTER `銇嶃亶銇峘; ALTER TABLE `銇傘亗銇俙 ADD `銇戙亼銇慲 char(1); @@ -404,8 +404,8 @@ NULL 銇嗐亞銇嗐亞銇 NULL NULL DESC `銇傘亗銇俙; Field Type Null Key Default Extra 銇嬨亱 char(1) YES MUL NULL -銇嶃亶銇 char(6) PRI -銇忋亸銇 char(1) YES MUL NULL +銇嶃亶銇 char(6) NO PRI +銇忋亸銇 char(1) YES UNI NULL 銇戙亼銇 char(1) YES NULL SHOW CREATE TABLE `銇傘亗銇俙; Table Create Table @@ -417,7 +417,7 @@ Table Create Table PRIMARY KEY (`銇嶃亶銇峘), UNIQUE KEY `銇忋亸銇廯 (`銇忋亸銇廯), KEY `銇嬨亱銇媊 (`銇嬨亱`) -) ENGINE=HEAP DEFAULT CHARSET=utf8 +) ENGINE=MEMORY DEFAULT CHARSET=utf8 ALTER TABLE `銇傘亗銇俙 DROP INDEX `銇嬨亱銇媊; ALTER TABLE `銇傘亗銇俙 DROP PRIMARY KEY; ALTER TABLE `銇傘亗銇俙 DROP INDEX `銇忋亸銇廯; @@ -431,12 +431,12 @@ SELECT * FROM `銇傘亗銇俙; 銇嗐亞銇嗐亞銇 DESC `銇傘亗銇俙; Field Type Null Key Default Extra -銇嶃亶銇 char(6) +銇嶃亶銇 char(6) NO SHOW CREATE TABLE `銇傘亗銇俙; Table Create Table 銇傘亗銇 CREATE TABLE `銇傘亗銇俙 ( `銇嶃亶銇峘 char(6) NOT NULL default '' -) ENGINE=HEAP DEFAULT CHARSET=utf8 +) ENGINE=MEMORY DEFAULT CHARSET=utf8 ALTER TABLE `榫栭緰榫朻 ADD `涓勪竸涓刞 char(1) FIRST; ALTER TABLE `榫栭緰榫朻 ADD `涓呬竻涓卄 char(1) AFTER `涓備競涓俙; ALTER TABLE `榫栭緰榫朻 ADD `涔氫箽涔歚 char(1); @@ -453,8 +453,8 @@ NULL 涓呬竻涓呬竻涓 NULL NULL DESC `榫栭緰榫朻; Field Type Null Key Default Extra 涓勪竸 char(1) YES MUL NULL -涓備競涓 char(6) PRI -涓呬竻涓 char(1) YES MUL NULL +涓備競涓 char(6) NO PRI +涓呬竻涓 char(1) YES UNI NULL 涔氫箽涔 char(1) YES NULL SHOW CREATE TABLE `榫栭緰榫朻; Table Create Table @@ -466,7 +466,7 @@ Table Create Table PRIMARY KEY (`涓備競涓俙), UNIQUE KEY `涓呬竻涓卄 (`涓呬竻涓卄), KEY `涓勪竸涓刞 (`涓勪竸`) -) ENGINE=HEAP DEFAULT CHARSET=utf8 +) ENGINE=MEMORY DEFAULT CHARSET=utf8 ALTER TABLE `榫栭緰榫朻 DROP INDEX `涓勪竸涓刞; ALTER TABLE `榫栭緰榫朻 DROP PRIMARY KEY; ALTER TABLE `榫栭緰榫朻 DROP INDEX `涓呬竻涓卄; @@ -480,12 +480,12 @@ SELECT * FROM `榫栭緰榫朻; 涓呬竻涓呬竻涓 DESC `榫栭緰榫朻; Field Type Null Key Default Extra -涓備競涓 char(6) +涓備競涓 char(6) NO SHOW CREATE TABLE `榫栭緰榫朻; Table Create Table 榫栭緰榫 CREATE TABLE `榫栭緰榫朻 ( `涓備競涓俙 char(6) NOT NULL default '' -) ENGINE=HEAP DEFAULT CHARSET=utf8 +) ENGINE=MEMORY DEFAULT CHARSET=utf8 DROP TABLE `锝憋奖锝盽; DROP TABLE `锝诧讲锝瞏; DROP TABLE `銇傘亗銇俙; @@ -516,7 +516,7 @@ NULL 锝筹匠锝筹匠锝 NULL NULL DESC `锝憋奖锝盽; Field Type Null Key Default Extra 锝讹蕉 char(1) YES MUL NULL -锝凤椒锝 char(6) PRI +锝凤椒锝 char(6) NO PRI 锝革礁锝 char(1) YES NULL 锝癸焦锝 char(1) YES NULL SHOW CREATE TABLE `锝憋奖锝盽; @@ -541,7 +541,7 @@ SELECT * FROM `锝憋奖锝盽; 锝筹匠锝筹匠锝 DESC `锝憋奖锝盽; Field Type Null Key Default Extra -锝凤椒锝 char(6) +锝凤椒锝 char(6) NO SHOW CREATE TABLE `锝憋奖锝盽; Table Create Table 锝憋奖锝 CREATE TABLE `锝憋奖锝盽 ( @@ -562,7 +562,7 @@ NULL 銇嗐亞銇嗐亞銇 NULL NULL DESC `銇傘亗銇俙; Field Type Null Key Default Extra 銇嬨亱 char(1) YES MUL NULL -銇嶃亶銇 char(6) PRI +銇嶃亶銇 char(6) NO PRI 銇忋亸銇 char(1) YES NULL 銇戙亼銇 char(1) YES NULL SHOW CREATE TABLE `銇傘亗銇俙; @@ -587,7 +587,7 @@ SELECT * FROM `銇傘亗銇俙; 銇嗐亞銇嗐亞銇 DESC `銇傘亗銇俙; Field Type Null Key Default Extra -銇嶃亶銇 char(6) +銇嶃亶銇 char(6) NO SHOW CREATE TABLE `銇傘亗銇俙; Table Create Table 銇傘亗銇 CREATE TABLE `銇傘亗銇俙 ( @@ -608,7 +608,7 @@ NULL 涓呬竻涓呬竻涓 NULL NULL DESC `榫栭緰榫朻; Field Type Null Key Default Extra 涓勪竸 char(1) YES MUL NULL -涓備競涓 char(6) PRI +涓備競涓 char(6) NO PRI 涓呬竻涓 char(1) YES NULL 涔氫箽涔 char(1) YES NULL SHOW CREATE TABLE `榫栭緰榫朻; @@ -633,7 +633,7 @@ SELECT * FROM `榫栭緰榫朻; 涓呬竻涓呬竻涓 DESC `榫栭緰榫朻; Field Type Null Key Default Extra -涓備競涓 char(6) +涓備競涓 char(6) NO SHOW CREATE TABLE `榫栭緰榫朻; Table Create Table 榫栭緰榫 CREATE TABLE `榫栭緰榫朻 ( diff --git a/mysql-test/suite/jp/r/jp_convert_sjis.result b/mysql-test/suite/jp/r/jp_convert_sjis.result index 8c9df3606c8..ff8a3fb2cd9 100644 --- a/mysql-test/suite/jp/r/jp_convert_sjis.result +++ b/mysql-test/suite/jp/r/jp_convert_sjis.result @@ -278,12 +278,15 @@ SELECT ` 陳陸陹険陻陼陽陾陿隀隁隂隃隄隇丒丒丒丒丒 陳陸陹険陻陼陽陾陿隀隁隂隃隄隇丒丒丒丒丒 SELECT `俠侾`, CONVERT(`俠侾` using utf8) FROM `俿俁`; 俠侾 CONVERT(`俠侾` using utf8) + 僜廫昞梊峔塡嶾怽揬擻朶榎慭抃橽歕沑淺漒瀄 僜廫昞梊峔塡嶾怽揬擻朶榎慭抃橽歕沑淺漒瀄 SELECT `俠侾`, CONVERT(`俠侾` using ucs2) FROM `俿俁`; 俠侾 CONVERT(`俠侾` using ucs2) + 僜廫昞梊峔塡嶾怽揬擻朶榎慭抃橽歕沑淺漒瀄 僜廫昞梊峔塡嶾怽揬擻朶榎慭抃橽歕沑淺漒瀄 SELECT `俠侾`, CONVERT(`俠侾` using ujis) FROM `俿俁`; 俠侾 CONVERT(`俠侾` using ujis) + 僜廫昞梊峔塡嶾怽揬擻朶榎慭抃橽歕沑淺漒瀄 僜廫昞梊峔塡嶾怽揬擻朶榎慭抃橽歕沑淺漒瀄 SELECT `俠侾`, CONVERT(`俠侾` using utf8) FROM `俿係`; 俠侾 CONVERT(`俠侾` using utf8) @@ -527,12 +530,15 @@ SELECT ` 陳陸陹険陻陼陽陾陿隀隁隂隃隄隇丒丒丒丒丒 陳陸陹険陻陼陽陾陿隀隁隂隃隄隇丒丒丒丒丒 SELECT `俠侾`, CONVERT(`俠侾` using utf8) FROM `俿俇`; 俠侾 CONVERT(`俠侾` using utf8) + 僜廫昞梊峔塡嶾怽揬擻朶榎慭抃橽歕沑淺漒瀄 僜廫昞梊峔塡嶾怽揬擻朶榎慭抃橽歕沑淺漒瀄 SELECT `俠侾`, CONVERT(`俠侾` using ucs2) FROM `俿俇`; 俠侾 CONVERT(`俠侾` using ucs2) + 僜廫昞梊峔塡嶾怽揬擻朶榎慭抃橽歕沑淺漒瀄 僜廫昞梊峔塡嶾怽揬擻朶榎慭抃橽歕沑淺漒瀄 SELECT `俠侾`, CONVERT(`俠侾` using ujis) FROM `俿俇`; 俠侾 CONVERT(`俠侾` using ujis) + 僜廫昞梊峔塡嶾怽揬擻朶榎慭抃橽歕沑淺漒瀄 僜廫昞梊峔塡嶾怽揬擻朶榎慭抃橽歕沑淺漒瀄 SELECT `俠侾`, CONVERT(`俠侾` using utf8) FROM `俿俈`; 俠侾 CONVERT(`俠侾` using utf8) @@ -777,12 +783,15 @@ SELECT ` SELECT `俠侾`, CONVERT(`俠侾` using utf8) FROM `俿俋`; 俠侾 CONVERT(`俠侾` using utf8) 僜廫昞梊峔塡嶾怽揬擻朶榎慭抃橽歕沑淺漒瀄 僜廫昞梊峔塡嶾怽揬擻朶榎慭抃橽歕沑淺漒瀄 + SELECT `俠侾`, CONVERT(`俠侾` using ucs2) FROM `俿俋`; 俠侾 CONVERT(`俠侾` using ucs2) 僜廫昞梊峔塡嶾怽揬擻朶榎慭抃橽歕沑淺漒瀄 僜廫昞梊峔塡嶾怽揬擻朶榎慭抃橽歕沑淺漒瀄 + SELECT `俠侾`, CONVERT(`俠侾` using ujis) FROM `俿俋`; 俠侾 CONVERT(`俠侾` using ujis) 僜廫昞梊峔塡嶾怽揬擻朶榎慭抃橽歕沑淺漒瀄 僜廫昞梊峔塡嶾怽揬擻朶榎慭抃橽歕沑淺漒瀄 + SELECT `俠侾`, CONVERT(`俠侾` using utf8) FROM `俿侾侽`; 俠侾 CONVERT(`俠侾` using utf8) !"#$%&'()*+,-./ !"#$%&'()*+,-./ @@ -1026,12 +1035,15 @@ SELECT ` SELECT `俠侾`, CONVERT(`俠侾` using utf8) FROM `俿侾俀`; 俠侾 CONVERT(`俠侾` using utf8) 僜廫昞梊峔塡嶾怽揬擻朶榎慭抃橽歕沑淺漒瀄 僜廫昞梊峔塡嶾怽揬擻朶榎慭抃橽歕沑淺漒瀄 + SELECT `俠侾`, CONVERT(`俠侾` using ucs2) FROM `俿侾俀`; 俠侾 CONVERT(`俠侾` using ucs2) 僜廫昞梊峔塡嶾怽揬擻朶榎慭抃橽歕沑淺漒瀄 僜廫昞梊峔塡嶾怽揬擻朶榎慭抃橽歕沑淺漒瀄 + SELECT `俠侾`, CONVERT(`俠侾` using ujis) FROM `俿侾俀`; 俠侾 CONVERT(`俠侾` using ujis) 僜廫昞梊峔塡嶾怽揬擻朶榎慭抃橽歕沑淺漒瀄 僜廫昞梊峔塡嶾怽揬擻朶榎慭抃橽歕沑淺漒瀄 + drop table `俿侾`; drop table `俿俀`; drop table `俿俁`; diff --git a/mysql-test/suite/jp/r/jp_create_db_sjis.result b/mysql-test/suite/jp/r/jp_create_db_sjis.result index 1ce0b7228d5..5d13cf74a39 100644 --- a/mysql-test/suite/jp/r/jp_create_db_sjis.result +++ b/mysql-test/suite/jp/r/jp_create_db_sjis.result @@ -8,6 +8,7 @@ CREATE DATABASE ` CREATE DATABASE `僜廫昞`; SHOW DATABASES; Database +information_schema mysql test 僜廫昞 diff --git a/mysql-test/suite/jp/r/jp_create_db_ucs2.result b/mysql-test/suite/jp/r/jp_create_db_ucs2.result index 8fd921ea8e6..f03baadf707 100644 --- a/mysql-test/suite/jp/r/jp_create_db_ucs2.result +++ b/mysql-test/suite/jp/r/jp_create_db_ucs2.result @@ -9,6 +9,7 @@ CREATE DATABASE ` CREATE DATABASE `忢軓磔忢轥; SHOW DATABASES; Database +information_schema mysql test 泣塑胳 diff --git a/mysql-test/suite/jp/r/jp_create_db_ujis.result b/mysql-test/suite/jp/r/jp_create_db_ujis.result index 45fdb34717b..627381bbacb 100644 --- a/mysql-test/suite/jp/r/jp_create_db_ujis.result +++ b/mysql-test/suite/jp/r/jp_create_db_ujis.result @@ -8,6 +8,7 @@ CREATE DATABASE ` CREATE DATABASE `忢軓磔忢轥; SHOW DATABASES; Database +information_schema mysql test 泣塑胳 diff --git a/mysql-test/suite/jp/r/jp_create_db_utf8.result b/mysql-test/suite/jp/r/jp_create_db_utf8.result index c0e996040de..1813259bdc9 100644 --- a/mysql-test/suite/jp/r/jp_create_db_utf8.result +++ b/mysql-test/suite/jp/r/jp_create_db_utf8.result @@ -8,6 +8,7 @@ CREATE DATABASE `鏃ユ湰瑾瀈; CREATE DATABASE `榫旈緰榫梎; SHOW DATABASES; Database +information_schema mysql test 鏃ユ湰瑾 diff --git a/mysql-test/suite/jp/r/jp_create_tbl_sjis.result b/mysql-test/suite/jp/r/jp_create_tbl_sjis.result index ecc72f9d91b..763a25bc127 100644 --- a/mysql-test/suite/jp/r/jp_create_tbl_sjis.result +++ b/mysql-test/suite/jp/r/jp_create_tbl_sjis.result @@ -22,11 +22,23 @@ CREATE TABLE ` CREATE TABLE `僜僜僜`(`塡塡塡` char(1)) DEFAULT CHARSET = sjis engine=INNODB; CREATE TABLE `廫廫廫`(`嶾嶾嶾` char(1)) DEFAULT CHARSET = sjis engine=INNODB; CREATE TABLE IF NOT EXISTS `北盽(`抖禶 char(1)) DEFAULT CHARSET = sjis engine=INNODB; +Warnings: +Note 1050 Table '北' already exists CREATE TABLE IF NOT EXISTS `膊瞏(`贩穈 char(1)) DEFAULT CHARSET = sjis engine=INNODB; +Warnings: +Note 1050 Table '膊' already exists CREATE TABLE IF NOT EXISTS `偁偁偁`(`偐偐偐` char(1)) DEFAULT CHARSET = sjis engine=INNODB; +Warnings: +Note 1050 Table '偁偁偁' already exists CREATE TABLE IF NOT EXISTS `偄偄偄`(`偒偒偒` char(1)) DEFAULT CHARSET = sjis engine=INNODB; +Warnings: +Note 1050 Table '偄偄偄' already exists CREATE TABLE IF NOT EXISTS `僜僜僜`(`塡塡塡` char(1)) DEFAULT CHARSET = sjis engine=INNODB; +Warnings: +Note 1050 Table '僜僜僜' already exists CREATE TABLE IF NOT EXISTS `廫廫廫`(`嶾嶾嶾` char(1)) DEFAULT CHARSET = sjis engine=INNODB; +Warnings: +Note 1050 Table '廫廫廫' already exists CREATE TABLE IF NOT EXISTS `吵砢(`父竊 char(1)) DEFAULT CHARSET = sjis engine=INNODB; CREATE TABLE IF NOT EXISTS `偆偆偆`(`偔偔偔` char(1)) DEFAULT CHARSET = sjis engine=INNODB; CREATE TABLE IF NOT EXISTS `昞昞昞`(`怽怽怽`char(1)) DEFAULT CHARSET = sjis engine=INNODB; @@ -178,11 +190,23 @@ CREATE TABLE ` CREATE TABLE `僜僜僜`(`塡塡塡` char(1)) DEFAULT CHARSET = sjis engine=MyISAM; CREATE TABLE `廫廫廫`(`嶾嶾嶾` char(1)) DEFAULT CHARSET = sjis engine=MyISAM; CREATE TABLE IF NOT EXISTS `北盽(`抖禶 char(1)) DEFAULT CHARSET = sjis engine=MyISAM; +Warnings: +Note 1050 Table '北' already exists CREATE TABLE IF NOT EXISTS `膊瞏(`贩穈 char(1)) DEFAULT CHARSET = sjis engine=MyISAM; +Warnings: +Note 1050 Table '膊' already exists CREATE TABLE IF NOT EXISTS `偁偁偁`(`偐偐偐` char(1)) DEFAULT CHARSET = sjis engine=MyISAM; +Warnings: +Note 1050 Table '偁偁偁' already exists CREATE TABLE IF NOT EXISTS `偄偄偄`(`偒偒偒` char(1)) DEFAULT CHARSET = sjis engine=MyISAM; +Warnings: +Note 1050 Table '偄偄偄' already exists CREATE TABLE IF NOT EXISTS `僜僜僜`(`塡塡塡` char(1)) DEFAULT CHARSET = sjis engine=MyISAM; +Warnings: +Note 1050 Table '僜僜僜' already exists CREATE TABLE IF NOT EXISTS `廫廫廫`(`嶾嶾嶾` char(1)) DEFAULT CHARSET = sjis engine=MyISAM; +Warnings: +Note 1050 Table '廫廫廫' already exists CREATE TABLE IF NOT EXISTS `吵砢(`父竊 char(1)) DEFAULT CHARSET = sjis engine=MyISAM; CREATE TABLE IF NOT EXISTS `偆偆偆`(`偔偔偔` char(1)) DEFAULT CHARSET = sjis engine=MyISAM; CREATE TABLE IF NOT EXISTS `昞昞昞`(`怽怽怽`char(1)) DEFAULT CHARSET = sjis engine=MyISAM; @@ -334,11 +358,23 @@ CREATE TABLE ` CREATE TABLE `僜僜僜`(`塡塡塡` char(1)) DEFAULT CHARSET = sjis engine=HEAP; CREATE TABLE `廫廫廫`(`嶾嶾嶾` char(1)) DEFAULT CHARSET = sjis engine=HEAP; CREATE TABLE IF NOT EXISTS `北盽(`抖禶 char(1)) DEFAULT CHARSET = sjis engine=HEAP; +Warnings: +Note 1050 Table '北' already exists CREATE TABLE IF NOT EXISTS `膊瞏(`贩穈 char(1)) DEFAULT CHARSET = sjis engine=HEAP; +Warnings: +Note 1050 Table '膊' already exists CREATE TABLE IF NOT EXISTS `偁偁偁`(`偐偐偐` char(1)) DEFAULT CHARSET = sjis engine=HEAP; +Warnings: +Note 1050 Table '偁偁偁' already exists CREATE TABLE IF NOT EXISTS `偄偄偄`(`偒偒偒` char(1)) DEFAULT CHARSET = sjis engine=HEAP; +Warnings: +Note 1050 Table '偄偄偄' already exists CREATE TABLE IF NOT EXISTS `僜僜僜`(`塡塡塡` char(1)) DEFAULT CHARSET = sjis engine=HEAP; +Warnings: +Note 1050 Table '僜僜僜' already exists CREATE TABLE IF NOT EXISTS `廫廫廫`(`嶾嶾嶾` char(1)) DEFAULT CHARSET = sjis engine=HEAP; +Warnings: +Note 1050 Table '廫廫廫' already exists CREATE TABLE IF NOT EXISTS `吵砢(`父竊 char(1)) DEFAULT CHARSET = sjis engine=HEAP; CREATE TABLE IF NOT EXISTS `偆偆偆`(`偔偔偔` char(1)) DEFAULT CHARSET = sjis engine=HEAP; CREATE TABLE IF NOT EXISTS `昞昞昞`(`怽怽怽`char(1)) DEFAULT CHARSET = sjis engine=HEAP; @@ -397,77 +433,77 @@ SHOW CREATE TABLE ` Table Create Table 北 CREATE TABLE `北盽 ( `抖禶 char(1) default NULL -) ENGINE=HEAP DEFAULT CHARSET=sjis +) ENGINE=MEMORY DEFAULT CHARSET=sjis SHOW CREATE TABLE `膊瞏; Table Create Table 膊 CREATE TABLE `膊瞏 ( `贩穈 char(1) default NULL -) ENGINE=HEAP DEFAULT CHARSET=sjis +) ENGINE=MEMORY DEFAULT CHARSET=sjis SHOW CREATE TABLE `吵砢; Table Create Table 吵 CREATE TABLE `吵砢 ( `父竊 char(1) default NULL -) ENGINE=HEAP DEFAULT CHARSET=sjis +) ENGINE=MEMORY DEFAULT CHARSET=sjis SHOW CREATE TABLE `创碻; Table Create Table 创 CREATE TEMPORARY TABLE `创碻 ( `构筦 char(1) default NULL -) ENGINE=HEAP DEFAULT CHARSET=sjis +) ENGINE=MEMORY DEFAULT CHARSET=sjis SHOW CREATE TABLE `档礰; Table Create Table 档 CREATE TEMPORARY TABLE `档礰 ( `汉篳 char(1) default NULL -) ENGINE=HEAP DEFAULT CHARSET=sjis +) ENGINE=MEMORY DEFAULT CHARSET=sjis SHOW CREATE TABLE `偁偁偁`; Table Create Table 偁偁偁 CREATE TABLE `偁偁偁` ( `偐偐偐` char(1) default NULL -) ENGINE=HEAP DEFAULT CHARSET=sjis +) ENGINE=MEMORY DEFAULT CHARSET=sjis SHOW CREATE TABLE `偄偄偄`; Table Create Table 偄偄偄 CREATE TABLE `偄偄偄` ( `偒偒偒` char(1) default NULL -) ENGINE=HEAP DEFAULT CHARSET=sjis +) ENGINE=MEMORY DEFAULT CHARSET=sjis SHOW CREATE TABLE `偆偆偆`; Table Create Table 偆偆偆 CREATE TABLE `偆偆偆` ( `偔偔偔` char(1) default NULL -) ENGINE=HEAP DEFAULT CHARSET=sjis +) ENGINE=MEMORY DEFAULT CHARSET=sjis SHOW CREATE TABLE `偊偊偊`; Table Create Table 偊偊偊 CREATE TEMPORARY TABLE `偊偊偊` ( `偗偗偗` char(1) default NULL -) ENGINE=HEAP DEFAULT CHARSET=sjis +) ENGINE=MEMORY DEFAULT CHARSET=sjis SHOW CREATE TABLE `偍偍偍`; Table Create Table 偍偍偍 CREATE TEMPORARY TABLE `偍偍偍` ( `偙偙偙` char(1) default NULL -) ENGINE=HEAP DEFAULT CHARSET=sjis +) ENGINE=MEMORY DEFAULT CHARSET=sjis SHOW CREATE TABLE `僜僜僜`; Table Create Table 僜僜僜 CREATE TABLE `僜僜僜` ( `塡塡塡` char(1) default NULL -) ENGINE=HEAP DEFAULT CHARSET=sjis +) ENGINE=MEMORY DEFAULT CHARSET=sjis SHOW CREATE TABLE `廫廫廫`; Table Create Table 廫廫廫 CREATE TABLE `廫廫廫` ( `嶾嶾嶾` char(1) default NULL -) ENGINE=HEAP DEFAULT CHARSET=sjis +) ENGINE=MEMORY DEFAULT CHARSET=sjis SHOW CREATE TABLE `昞昞昞`; Table Create Table 昞昞昞 CREATE TABLE `昞昞昞` ( `怽怽怽` char(1) default NULL -) ENGINE=HEAP DEFAULT CHARSET=sjis +) ENGINE=MEMORY DEFAULT CHARSET=sjis SHOW CREATE TABLE `梊梊梊`; Table Create Table 梊梊梊 CREATE TEMPORARY TABLE `梊梊梊` ( `揬揬揬` char(1) default NULL -) ENGINE=HEAP DEFAULT CHARSET=sjis +) ENGINE=MEMORY DEFAULT CHARSET=sjis SHOW CREATE TABLE `峔峔峔`; Table Create Table 峔峔峔 CREATE TEMPORARY TABLE `峔峔峔` ( `擻擻擻` char(1) default NULL -) ENGINE=HEAP DEFAULT CHARSET=sjis +) ENGINE=MEMORY DEFAULT CHARSET=sjis DROP TABLE `北盽; DROP TABLE `膊瞏; DROP TABLE `吵砢; @@ -490,11 +526,23 @@ CREATE TABLE ` CREATE TABLE `僜僜僜`(`塡塡塡` char(1)) DEFAULT CHARSET = sjis engine=BDB; CREATE TABLE `廫廫廫`(`嶾嶾嶾` char(1)) DEFAULT CHARSET = sjis engine=BDB; CREATE TABLE IF NOT EXISTS `北盽(`抖禶 char(1)) DEFAULT CHARSET = sjis engine=BDB; +Warnings: +Note 1050 Table '北' already exists CREATE TABLE IF NOT EXISTS `膊瞏(`贩穈 char(1)) DEFAULT CHARSET = sjis engine=BDB; +Warnings: +Note 1050 Table '膊' already exists CREATE TABLE IF NOT EXISTS `偁偁偁`(`偐偐偐` char(1)) DEFAULT CHARSET = sjis engine=BDB; +Warnings: +Note 1050 Table '偁偁偁' already exists CREATE TABLE IF NOT EXISTS `偄偄偄`(`偒偒偒` char(1)) DEFAULT CHARSET = sjis engine=BDB; +Warnings: +Note 1050 Table '偄偄偄' already exists CREATE TABLE IF NOT EXISTS `僜僜僜`(`塡塡塡` char(1)) DEFAULT CHARSET = sjis engine=BDB; +Warnings: +Note 1050 Table '僜僜僜' already exists CREATE TABLE IF NOT EXISTS `廫廫廫`(`嶾嶾嶾` char(1)) DEFAULT CHARSET = sjis engine=BDB; +Warnings: +Note 1050 Table '廫廫廫' already exists CREATE TABLE IF NOT EXISTS `吵砢(`父竊 char(1)) DEFAULT CHARSET = sjis engine=BDB; CREATE TABLE IF NOT EXISTS `偆偆偆`(`偔偔偔` char(1)) DEFAULT CHARSET = sjis engine=BDB; CREATE TABLE IF NOT EXISTS `昞昞昞`(`怽怽怽`char(1)) DEFAULT CHARSET = sjis engine=BDB; diff --git a/mysql-test/suite/jp/r/jp_create_tbl_ucs2.result b/mysql-test/suite/jp/r/jp_create_tbl_ucs2.result index 0bf5a6891b0..d6616f66d9f 100644 --- a/mysql-test/suite/jp/r/jp_create_tbl_ucs2.result +++ b/mysql-test/suite/jp/r/jp_create_tbl_ucs2.result @@ -22,11 +22,23 @@ CREATE TABLE ` CREATE TABLE `忢輳磔忢輅(`彴啊彴 char(1)) DEFAULT CHARSET = ucs2 engine=INNODB; CREATE TABLE `忢迯磙忢轥(`彴阿彴 char(1)) DEFAULT CHARSET = ucs2 engine=INNODB; CREATE TABLE IF NOT EXISTS `幈幈幈`(`幎幎幎` char(1)) DEFAULT CHARSET = ucs2 engine=INNODB; +Warnings: +Note 1050 Table '幈幈幈' already exists CREATE TABLE IF NOT EXISTS `幉幉幉`(`幏幏幏` char(1)) DEFAULT CHARSET = ucs2 engine=INNODB; +Warnings: +Note 1050 Table '幉幉幉' already exists CREATE TABLE IF NOT EXISTS `あああ`(`かかか` char(1)) DEFAULT CHARSET = ucs2 engine=INNODB; +Warnings: +Note 1050 Table 'あああ' already exists CREATE TABLE IF NOT EXISTS `いいい`(`ききき` char(1)) DEFAULT CHARSET = ucs2 engine=INNODB; +Warnings: +Note 1050 Table 'いいい' already exists CREATE TABLE IF NOT EXISTS `忢輳磔忢輅(`彴啊彴 char(1)) DEFAULT CHARSET = ucs2 engine=INNODB; +Warnings: +Note 1050 Table '忢輳磔忢' already exists CREATE TABLE IF NOT EXISTS `忢迯磙忢轥(`彴阿彴 char(1)) DEFAULT CHARSET = ucs2 engine=INNODB; +Warnings: +Note 1050 Table '忢迯磙忢' already exists CREATE TABLE IF NOT EXISTS `幊幊幊`(`幐幐幐` char(1)) DEFAULT CHARSET = ucs2 engine=INNODB; CREATE TABLE IF NOT EXISTS `ううう`(`くくく` char(1)) DEFAULT CHARSET = ucs2 engine=INNODB; CREATE TABLE IF NOT EXISTS `忢邚磉忢違(`彴埃彴char(1)) DEFAULT CHARSET = ucs2 engine=INNODB; @@ -178,11 +190,23 @@ CREATE TABLE ` CREATE TABLE `忢輳磔忢輅(`彴啊彴 char(1)) DEFAULT CHARSET = ucs2 engine=MyISAM; CREATE TABLE `忢迯磙忢轥(`彴阿彴 char(1)) DEFAULT CHARSET = ucs2 engine=MyISAM; CREATE TABLE IF NOT EXISTS `幈幈幈`(`幎幎幎` char(1)) DEFAULT CHARSET = ucs2 engine=MyISAM; +Warnings: +Note 1050 Table '幈幈幈' already exists CREATE TABLE IF NOT EXISTS `幉幉幉`(`幏幏幏` char(1)) DEFAULT CHARSET = ucs2 engine=MyISAM; +Warnings: +Note 1050 Table '幉幉幉' already exists CREATE TABLE IF NOT EXISTS `あああ`(`かかか` char(1)) DEFAULT CHARSET = ucs2 engine=MyISAM; +Warnings: +Note 1050 Table 'あああ' already exists CREATE TABLE IF NOT EXISTS `いいい`(`ききき` char(1)) DEFAULT CHARSET = ucs2 engine=MyISAM; +Warnings: +Note 1050 Table 'いいい' already exists CREATE TABLE IF NOT EXISTS `忢輳磔忢輅(`彴啊彴 char(1)) DEFAULT CHARSET = ucs2 engine=MyISAM; +Warnings: +Note 1050 Table '忢輳磔忢' already exists CREATE TABLE IF NOT EXISTS `忢迯磙忢轥(`彴阿彴 char(1)) DEFAULT CHARSET = ucs2 engine=MyISAM; +Warnings: +Note 1050 Table '忢迯磙忢' already exists CREATE TABLE IF NOT EXISTS `幊幊幊`(`幐幐幐` char(1)) DEFAULT CHARSET = ucs2 engine=MyISAM; CREATE TABLE IF NOT EXISTS `ううう`(`くくく` char(1)) DEFAULT CHARSET = ucs2 engine=MyISAM; CREATE TABLE IF NOT EXISTS `忢邚磉忢違(`彴埃彴char(1)) DEFAULT CHARSET = ucs2 engine=MyISAM; @@ -334,11 +358,23 @@ CREATE TABLE ` CREATE TABLE `忢輳磔忢輅(`彴啊彴 char(1)) DEFAULT CHARSET = ucs2 engine=HEAP; CREATE TABLE `忢迯磙忢轥(`彴阿彴 char(1)) DEFAULT CHARSET = ucs2 engine=HEAP; CREATE TABLE IF NOT EXISTS `幈幈幈`(`幎幎幎` char(1)) DEFAULT CHARSET = ucs2 engine=HEAP; +Warnings: +Note 1050 Table '幈幈幈' already exists CREATE TABLE IF NOT EXISTS `幉幉幉`(`幏幏幏` char(1)) DEFAULT CHARSET = ucs2 engine=HEAP; +Warnings: +Note 1050 Table '幉幉幉' already exists CREATE TABLE IF NOT EXISTS `あああ`(`かかか` char(1)) DEFAULT CHARSET = ucs2 engine=HEAP; +Warnings: +Note 1050 Table 'あああ' already exists CREATE TABLE IF NOT EXISTS `いいい`(`ききき` char(1)) DEFAULT CHARSET = ucs2 engine=HEAP; +Warnings: +Note 1050 Table 'いいい' already exists CREATE TABLE IF NOT EXISTS `忢輳磔忢輅(`彴啊彴 char(1)) DEFAULT CHARSET = ucs2 engine=HEAP; +Warnings: +Note 1050 Table '忢輳磔忢' already exists CREATE TABLE IF NOT EXISTS `忢迯磙忢轥(`彴阿彴 char(1)) DEFAULT CHARSET = ucs2 engine=HEAP; +Warnings: +Note 1050 Table '忢迯磙忢' already exists CREATE TABLE IF NOT EXISTS `幊幊幊`(`幐幐幐` char(1)) DEFAULT CHARSET = ucs2 engine=HEAP; CREATE TABLE IF NOT EXISTS `ううう`(`くくく` char(1)) DEFAULT CHARSET = ucs2 engine=HEAP; CREATE TABLE IF NOT EXISTS `忢邚磉忢違(`彴埃彴char(1)) DEFAULT CHARSET = ucs2 engine=HEAP; @@ -397,77 +433,77 @@ SHOW CREATE TABLE ` Table Create Table 幈幈幈 CREATE TABLE `幈幈幈` ( `幎幎幎` char(1) default NULL -) ENGINE=HEAP DEFAULT CHARSET=ucs2 +) ENGINE=MEMORY DEFAULT CHARSET=ucs2 SHOW CREATE TABLE `幉幉幉`; Table Create Table 幉幉幉 CREATE TABLE `幉幉幉` ( `幏幏幏` char(1) default NULL -) ENGINE=HEAP DEFAULT CHARSET=ucs2 +) ENGINE=MEMORY DEFAULT CHARSET=ucs2 SHOW CREATE TABLE `幊幊幊`; Table Create Table 幊幊幊 CREATE TABLE `幊幊幊` ( `幐幐幐` char(1) default NULL -) ENGINE=HEAP DEFAULT CHARSET=ucs2 +) ENGINE=MEMORY DEFAULT CHARSET=ucs2 SHOW CREATE TABLE `幋幋幋`; Table Create Table 幋幋幋 CREATE TEMPORARY TABLE `幋幋幋` ( `幑幑幑` char(1) default NULL -) ENGINE=HEAP DEFAULT CHARSET=ucs2 +) ENGINE=MEMORY DEFAULT CHARSET=ucs2 SHOW CREATE TABLE `幍幍幍`; Table Create Table 幍幍幍 CREATE TEMPORARY TABLE `幍幍幍` ( `幒幒幒` char(1) default NULL -) ENGINE=HEAP DEFAULT CHARSET=ucs2 +) ENGINE=MEMORY DEFAULT CHARSET=ucs2 SHOW CREATE TABLE `あああ`; Table Create Table あああ CREATE TABLE `あああ` ( `かかか` char(1) default NULL -) ENGINE=HEAP DEFAULT CHARSET=ucs2 +) ENGINE=MEMORY DEFAULT CHARSET=ucs2 SHOW CREATE TABLE `いいい`; Table Create Table いいい CREATE TABLE `いいい` ( `ききき` char(1) default NULL -) ENGINE=HEAP DEFAULT CHARSET=ucs2 +) ENGINE=MEMORY DEFAULT CHARSET=ucs2 SHOW CREATE TABLE `ううう`; Table Create Table ううう CREATE TABLE `ううう` ( `くくく` char(1) default NULL -) ENGINE=HEAP DEFAULT CHARSET=ucs2 +) ENGINE=MEMORY DEFAULT CHARSET=ucs2 SHOW CREATE TABLE `えええ`; Table Create Table えええ CREATE TEMPORARY TABLE `えええ` ( `けけけ` char(1) default NULL -) ENGINE=HEAP DEFAULT CHARSET=ucs2 +) ENGINE=MEMORY DEFAULT CHARSET=ucs2 SHOW CREATE TABLE `おおお`; Table Create Table おおお CREATE TEMPORARY TABLE `おおお` ( `こここ` char(1) default NULL -) ENGINE=HEAP DEFAULT CHARSET=ucs2 +) ENGINE=MEMORY DEFAULT CHARSET=ucs2 SHOW CREATE TABLE `忢輳磔忢輅; Table Create Table 忢輳磔忢 CREATE TABLE `忢輳磔忢輅 ( `彴啊彴 char(1) default NULL -) ENGINE=HEAP DEFAULT CHARSET=ucs2 +) ENGINE=MEMORY DEFAULT CHARSET=ucs2 SHOW CREATE TABLE `忢迯磙忢轥; Table Create Table 忢迯磙忢 CREATE TABLE `忢迯磙忢轥 ( `彴阿彴 char(1) default NULL -) ENGINE=HEAP DEFAULT CHARSET=ucs2 +) ENGINE=MEMORY DEFAULT CHARSET=ucs2 SHOW CREATE TABLE `忢邚磉忢違; Table Create Table 忢邚磉忢 CREATE TABLE `忢邚磉忢違 ( `彴埃彴 char(1) default NULL -) ENGINE=HEAP DEFAULT CHARSET=ucs2 +) ENGINE=MEMORY DEFAULT CHARSET=ucs2 SHOW CREATE TABLE `忢鄰磬忢郹; Table Create Table 忢鄰磬忢 CREATE TEMPORARY TABLE `忢鄰磬忢郹 ( `彴挨彴 char(1) default NULL -) ENGINE=HEAP DEFAULT CHARSET=ucs2 +) ENGINE=MEMORY DEFAULT CHARSET=ucs2 SHOW CREATE TABLE `忢釓磲忢醏; Table Create Table 忢釓磲忢 CREATE TEMPORARY TABLE `忢釓磲忢醏 ( `彴哎彴 char(1) default NULL -) ENGINE=HEAP DEFAULT CHARSET=ucs2 +) ENGINE=MEMORY DEFAULT CHARSET=ucs2 DROP TABLE `幈幈幈`; DROP TABLE `幉幉幉`; DROP TABLE `幊幊幊`; @@ -490,11 +526,23 @@ CREATE TABLE ` CREATE TABLE `忢輳磔忢輅(`彴啊彴 char(1)) DEFAULT CHARSET = ucs2 engine=BDB; CREATE TABLE `忢迯磙忢轥(`彴阿彴 char(1)) DEFAULT CHARSET = ucs2 engine=BDB; CREATE TABLE IF NOT EXISTS `幈幈幈`(`幎幎幎` char(1)) DEFAULT CHARSET = ucs2 engine=BDB; +Warnings: +Note 1050 Table '幈幈幈' already exists CREATE TABLE IF NOT EXISTS `幉幉幉`(`幏幏幏` char(1)) DEFAULT CHARSET = ucs2 engine=BDB; +Warnings: +Note 1050 Table '幉幉幉' already exists CREATE TABLE IF NOT EXISTS `あああ`(`かかか` char(1)) DEFAULT CHARSET = ucs2 engine=BDB; +Warnings: +Note 1050 Table 'あああ' already exists CREATE TABLE IF NOT EXISTS `いいい`(`ききき` char(1)) DEFAULT CHARSET = ucs2 engine=BDB; +Warnings: +Note 1050 Table 'いいい' already exists CREATE TABLE IF NOT EXISTS `忢輳磔忢輅(`彴啊彴 char(1)) DEFAULT CHARSET = ucs2 engine=BDB; +Warnings: +Note 1050 Table '忢輳磔忢' already exists CREATE TABLE IF NOT EXISTS `忢迯磙忢轥(`彴阿彴 char(1)) DEFAULT CHARSET = ucs2 engine=BDB; +Warnings: +Note 1050 Table '忢迯磙忢' already exists CREATE TABLE IF NOT EXISTS `幊幊幊`(`幐幐幐` char(1)) DEFAULT CHARSET = ucs2 engine=BDB; CREATE TABLE IF NOT EXISTS `ううう`(`くくく` char(1)) DEFAULT CHARSET = ucs2 engine=BDB; CREATE TABLE IF NOT EXISTS `忢邚磉忢違(`彴埃彴char(1)) DEFAULT CHARSET = ucs2 engine=BDB; diff --git a/mysql-test/suite/jp/r/jp_create_tbl_ujis.result b/mysql-test/suite/jp/r/jp_create_tbl_ujis.result index ae555e5af15..f53e1e58793 100644 --- a/mysql-test/suite/jp/r/jp_create_tbl_ujis.result +++ b/mysql-test/suite/jp/r/jp_create_tbl_ujis.result @@ -22,11 +22,23 @@ CREATE TABLE ` CREATE TABLE `忢輳磔忢輅(`彴啊彴 char(1)) DEFAULT CHARSET = ujis engine=INNODB; CREATE TABLE `忢迯磙忢轥(`彴阿彴 char(1)) DEFAULT CHARSET = ujis engine=INNODB; CREATE TABLE IF NOT EXISTS `幈幈幈`(`幎幎幎` char(1)) DEFAULT CHARSET = ujis engine=INNODB; +Warnings: +Note 1050 Table '幈幈幈' already exists CREATE TABLE IF NOT EXISTS `幉幉幉`(`幏幏幏` char(1)) DEFAULT CHARSET = ujis engine=INNODB; +Warnings: +Note 1050 Table '幉幉幉' already exists CREATE TABLE IF NOT EXISTS `あああ`(`かかか` char(1)) DEFAULT CHARSET = ujis engine=INNODB; +Warnings: +Note 1050 Table 'あああ' already exists CREATE TABLE IF NOT EXISTS `いいい`(`ききき` char(1)) DEFAULT CHARSET = ujis engine=INNODB; +Warnings: +Note 1050 Table 'いいい' already exists CREATE TABLE IF NOT EXISTS `忢輳磔忢輅(`彴啊彴 char(1)) DEFAULT CHARSET = ujis engine=INNODB; +Warnings: +Note 1050 Table '忢輳磔忢' already exists CREATE TABLE IF NOT EXISTS `忢迯磙忢轥(`彴阿彴 char(1)) DEFAULT CHARSET = ujis engine=INNODB; +Warnings: +Note 1050 Table '忢迯磙忢' already exists CREATE TABLE IF NOT EXISTS `幊幊幊`(`幐幐幐` char(1)) DEFAULT CHARSET = ujis engine=INNODB; CREATE TABLE IF NOT EXISTS `ううう`(`くくく` char(1)) DEFAULT CHARSET = ujis engine=INNODB; CREATE TABLE IF NOT EXISTS `忢邚磉忢違(`彴埃彴char(1)) DEFAULT CHARSET = ujis engine=INNODB; @@ -178,11 +190,23 @@ CREATE TABLE ` CREATE TABLE `忢輳磔忢輅(`彴啊彴 char(1)) DEFAULT CHARSET = ujis engine=MyISAM; CREATE TABLE `忢迯磙忢轥(`彴阿彴 char(1)) DEFAULT CHARSET = ujis engine=MyISAM; CREATE TABLE IF NOT EXISTS `幈幈幈`(`幎幎幎` char(1)) DEFAULT CHARSET = ujis engine=MyISAM; +Warnings: +Note 1050 Table '幈幈幈' already exists CREATE TABLE IF NOT EXISTS `幉幉幉`(`幏幏幏` char(1)) DEFAULT CHARSET = ujis engine=MyISAM; +Warnings: +Note 1050 Table '幉幉幉' already exists CREATE TABLE IF NOT EXISTS `あああ`(`かかか` char(1)) DEFAULT CHARSET = ujis engine=MyISAM; +Warnings: +Note 1050 Table 'あああ' already exists CREATE TABLE IF NOT EXISTS `いいい`(`ききき` char(1)) DEFAULT CHARSET = ujis engine=MyISAM; +Warnings: +Note 1050 Table 'いいい' already exists CREATE TABLE IF NOT EXISTS `忢輳磔忢輅(`彴啊彴 char(1)) DEFAULT CHARSET = ujis engine=MyISAM; +Warnings: +Note 1050 Table '忢輳磔忢' already exists CREATE TABLE IF NOT EXISTS `忢迯磙忢轥(`彴阿彴 char(1)) DEFAULT CHARSET = ujis engine=MyISAM; +Warnings: +Note 1050 Table '忢迯磙忢' already exists CREATE TABLE IF NOT EXISTS `幊幊幊`(`幐幐幐` char(1)) DEFAULT CHARSET = ujis engine=MyISAM; CREATE TABLE IF NOT EXISTS `ううう`(`くくく` char(1)) DEFAULT CHARSET = ujis engine=MyISAM; CREATE TABLE IF NOT EXISTS `忢邚磉忢違(`彴埃彴char(1)) DEFAULT CHARSET = ujis engine=MyISAM; @@ -334,11 +358,23 @@ CREATE TABLE ` CREATE TABLE `忢輳磔忢輅(`彴啊彴 char(1)) DEFAULT CHARSET = ujis engine=HEAP; CREATE TABLE `忢迯磙忢轥(`彴阿彴 char(1)) DEFAULT CHARSET = ujis engine=HEAP; CREATE TABLE IF NOT EXISTS `幈幈幈`(`幎幎幎` char(1)) DEFAULT CHARSET = ujis engine=HEAP; +Warnings: +Note 1050 Table '幈幈幈' already exists CREATE TABLE IF NOT EXISTS `幉幉幉`(`幏幏幏` char(1)) DEFAULT CHARSET = ujis engine=HEAP; +Warnings: +Note 1050 Table '幉幉幉' already exists CREATE TABLE IF NOT EXISTS `あああ`(`かかか` char(1)) DEFAULT CHARSET = ujis engine=HEAP; +Warnings: +Note 1050 Table 'あああ' already exists CREATE TABLE IF NOT EXISTS `いいい`(`ききき` char(1)) DEFAULT CHARSET = ujis engine=HEAP; +Warnings: +Note 1050 Table 'いいい' already exists CREATE TABLE IF NOT EXISTS `忢輳磔忢輅(`彴啊彴 char(1)) DEFAULT CHARSET = ujis engine=HEAP; +Warnings: +Note 1050 Table '忢輳磔忢' already exists CREATE TABLE IF NOT EXISTS `忢迯磙忢轥(`彴阿彴 char(1)) DEFAULT CHARSET = ujis engine=HEAP; +Warnings: +Note 1050 Table '忢迯磙忢' already exists CREATE TABLE IF NOT EXISTS `幊幊幊`(`幐幐幐` char(1)) DEFAULT CHARSET = ujis engine=HEAP; CREATE TABLE IF NOT EXISTS `ううう`(`くくく` char(1)) DEFAULT CHARSET = ujis engine=HEAP; CREATE TABLE IF NOT EXISTS `忢邚磉忢違(`彴埃彴char(1)) DEFAULT CHARSET = ujis engine=HEAP; @@ -397,77 +433,77 @@ SHOW CREATE TABLE ` Table Create Table 幈幈幈 CREATE TABLE `幈幈幈` ( `幎幎幎` char(1) default NULL -) ENGINE=HEAP DEFAULT CHARSET=ujis +) ENGINE=MEMORY DEFAULT CHARSET=ujis SHOW CREATE TABLE `幉幉幉`; Table Create Table 幉幉幉 CREATE TABLE `幉幉幉` ( `幏幏幏` char(1) default NULL -) ENGINE=HEAP DEFAULT CHARSET=ujis +) ENGINE=MEMORY DEFAULT CHARSET=ujis SHOW CREATE TABLE `幊幊幊`; Table Create Table 幊幊幊 CREATE TABLE `幊幊幊` ( `幐幐幐` char(1) default NULL -) ENGINE=HEAP DEFAULT CHARSET=ujis +) ENGINE=MEMORY DEFAULT CHARSET=ujis SHOW CREATE TABLE `幋幋幋`; Table Create Table 幋幋幋 CREATE TEMPORARY TABLE `幋幋幋` ( `幑幑幑` char(1) default NULL -) ENGINE=HEAP DEFAULT CHARSET=ujis +) ENGINE=MEMORY DEFAULT CHARSET=ujis SHOW CREATE TABLE `幍幍幍`; Table Create Table 幍幍幍 CREATE TEMPORARY TABLE `幍幍幍` ( `幒幒幒` char(1) default NULL -) ENGINE=HEAP DEFAULT CHARSET=ujis +) ENGINE=MEMORY DEFAULT CHARSET=ujis SHOW CREATE TABLE `あああ`; Table Create Table あああ CREATE TABLE `あああ` ( `かかか` char(1) default NULL -) ENGINE=HEAP DEFAULT CHARSET=ujis +) ENGINE=MEMORY DEFAULT CHARSET=ujis SHOW CREATE TABLE `いいい`; Table Create Table いいい CREATE TABLE `いいい` ( `ききき` char(1) default NULL -) ENGINE=HEAP DEFAULT CHARSET=ujis +) ENGINE=MEMORY DEFAULT CHARSET=ujis SHOW CREATE TABLE `ううう`; Table Create Table ううう CREATE TABLE `ううう` ( `くくく` char(1) default NULL -) ENGINE=HEAP DEFAULT CHARSET=ujis +) ENGINE=MEMORY DEFAULT CHARSET=ujis SHOW CREATE TABLE `えええ`; Table Create Table えええ CREATE TEMPORARY TABLE `えええ` ( `けけけ` char(1) default NULL -) ENGINE=HEAP DEFAULT CHARSET=ujis +) ENGINE=MEMORY DEFAULT CHARSET=ujis SHOW CREATE TABLE `おおお`; Table Create Table おおお CREATE TEMPORARY TABLE `おおお` ( `こここ` char(1) default NULL -) ENGINE=HEAP DEFAULT CHARSET=ujis +) ENGINE=MEMORY DEFAULT CHARSET=ujis SHOW CREATE TABLE `忢輳磔忢輅; Table Create Table 忢輳磔忢 CREATE TABLE `忢輳磔忢輅 ( `彴啊彴 char(1) default NULL -) ENGINE=HEAP DEFAULT CHARSET=ujis +) ENGINE=MEMORY DEFAULT CHARSET=ujis SHOW CREATE TABLE `忢迯磙忢轥; Table Create Table 忢迯磙忢 CREATE TABLE `忢迯磙忢轥 ( `彴阿彴 char(1) default NULL -) ENGINE=HEAP DEFAULT CHARSET=ujis +) ENGINE=MEMORY DEFAULT CHARSET=ujis SHOW CREATE TABLE `忢邚磉忢違; Table Create Table 忢邚磉忢 CREATE TABLE `忢邚磉忢違 ( `彴埃彴 char(1) default NULL -) ENGINE=HEAP DEFAULT CHARSET=ujis +) ENGINE=MEMORY DEFAULT CHARSET=ujis SHOW CREATE TABLE `忢鄰磬忢郹; Table Create Table 忢鄰磬忢 CREATE TEMPORARY TABLE `忢鄰磬忢郹 ( `彴挨彴 char(1) default NULL -) ENGINE=HEAP DEFAULT CHARSET=ujis +) ENGINE=MEMORY DEFAULT CHARSET=ujis SHOW CREATE TABLE `忢釓磲忢醏; Table Create Table 忢釓磲忢 CREATE TEMPORARY TABLE `忢釓磲忢醏 ( `彴哎彴 char(1) default NULL -) ENGINE=HEAP DEFAULT CHARSET=ujis +) ENGINE=MEMORY DEFAULT CHARSET=ujis DROP TABLE `幈幈幈`; DROP TABLE `幉幉幉`; DROP TABLE `幊幊幊`; @@ -490,11 +526,23 @@ CREATE TABLE ` CREATE TABLE `忢輳磔忢輅(`彴啊彴 char(1)) DEFAULT CHARSET = ujis engine=BDB; CREATE TABLE `忢迯磙忢轥(`彴阿彴 char(1)) DEFAULT CHARSET = ujis engine=BDB; CREATE TABLE IF NOT EXISTS `幈幈幈`(`幎幎幎` char(1)) DEFAULT CHARSET = ujis engine=BDB; +Warnings: +Note 1050 Table '幈幈幈' already exists CREATE TABLE IF NOT EXISTS `幉幉幉`(`幏幏幏` char(1)) DEFAULT CHARSET = ujis engine=BDB; +Warnings: +Note 1050 Table '幉幉幉' already exists CREATE TABLE IF NOT EXISTS `あああ`(`かかか` char(1)) DEFAULT CHARSET = ujis engine=BDB; +Warnings: +Note 1050 Table 'あああ' already exists CREATE TABLE IF NOT EXISTS `いいい`(`ききき` char(1)) DEFAULT CHARSET = ujis engine=BDB; +Warnings: +Note 1050 Table 'いいい' already exists CREATE TABLE IF NOT EXISTS `忢輳磔忢輅(`彴啊彴 char(1)) DEFAULT CHARSET = ujis engine=BDB; +Warnings: +Note 1050 Table '忢輳磔忢' already exists CREATE TABLE IF NOT EXISTS `忢迯磙忢轥(`彴阿彴 char(1)) DEFAULT CHARSET = ujis engine=BDB; +Warnings: +Note 1050 Table '忢迯磙忢' already exists CREATE TABLE IF NOT EXISTS `幊幊幊`(`幐幐幐` char(1)) DEFAULT CHARSET = ujis engine=BDB; CREATE TABLE IF NOT EXISTS `ううう`(`くくく` char(1)) DEFAULT CHARSET = ujis engine=BDB; CREATE TABLE IF NOT EXISTS `忢邚磉忢違(`彴埃彴char(1)) DEFAULT CHARSET = ujis engine=BDB; diff --git a/mysql-test/suite/jp/r/jp_create_tbl_utf8.result b/mysql-test/suite/jp/r/jp_create_tbl_utf8.result index d4873406c46..6df30acbd7f 100644 --- a/mysql-test/suite/jp/r/jp_create_tbl_utf8.result +++ b/mysql-test/suite/jp/r/jp_create_tbl_utf8.result @@ -22,11 +22,23 @@ CREATE TABLE `銇勩亜銇刞(`銇嶃亶銇峘 char(1)) DEFAULT CHARSET = utf8 engine=INNO CREATE TABLE `榫栭緰榫朻(`涓備競涓俙 char(1)) DEFAULT CHARSET = utf8 engine=INNODB; CREATE TABLE `榫楅緱榫梎(`涓勪竸涓刞 char(1)) DEFAULT CHARSET = utf8 engine=INNODB; CREATE TABLE IF NOT EXISTS `锝憋奖锝盽(`锝讹蕉锝禶 char(1)) DEFAULT CHARSET = utf8 engine=INNODB; +Warnings: +Note 1050 Table '锝憋奖锝' already exists CREATE TABLE IF NOT EXISTS `锝诧讲锝瞏(`锝凤椒锝穈 char(1)) DEFAULT CHARSET = utf8 engine=INNODB; +Warnings: +Note 1050 Table '锝诧讲锝' already exists CREATE TABLE IF NOT EXISTS `銇傘亗銇俙(`銇嬨亱銇媊 char(1)) DEFAULT CHARSET = utf8 engine=INNODB; +Warnings: +Note 1050 Table '銇傘亗銇' already exists CREATE TABLE IF NOT EXISTS `銇勩亜銇刞(`銇嶃亶銇峘 char(1)) DEFAULT CHARSET = utf8 engine=INNODB; +Warnings: +Note 1050 Table '銇勩亜銇' already exists CREATE TABLE IF NOT EXISTS `榫栭緰榫朻(`涓備競涓俙 char(1)) DEFAULT CHARSET = utf8 engine=INNODB; +Warnings: +Note 1050 Table '榫栭緰榫' already exists CREATE TABLE IF NOT EXISTS `榫楅緱榫梎(`涓勪竸涓刞 char(1)) DEFAULT CHARSET = utf8 engine=INNODB; +Warnings: +Note 1050 Table '榫楅緱榫' already exists CREATE TABLE IF NOT EXISTS `锝筹匠锝砢(`锝革礁锝竊 char(1)) DEFAULT CHARSET = utf8 engine=INNODB; CREATE TABLE IF NOT EXISTS `銇嗐亞銇哷(`銇忋亸銇廯 char(1)) DEFAULT CHARSET = utf8 engine=INNODB; CREATE TABLE IF NOT EXISTS `榫為緸榫瀈(`涓呬竻涓卄char(1)) DEFAULT CHARSET = utf8 engine=INNODB; @@ -178,11 +190,23 @@ CREATE TABLE `銇勩亜銇刞(`銇嶃亶銇峘 char(1)) DEFAULT CHARSET = utf8 engine=MyIS CREATE TABLE `榫栭緰榫朻(`涓備競涓俙 char(1)) DEFAULT CHARSET = utf8 engine=MyISAM; CREATE TABLE `榫楅緱榫梎(`涓勪竸涓刞 char(1)) DEFAULT CHARSET = utf8 engine=MyISAM; CREATE TABLE IF NOT EXISTS `锝憋奖锝盽(`锝讹蕉锝禶 char(1)) DEFAULT CHARSET = utf8 engine=MyISAM; +Warnings: +Note 1050 Table '锝憋奖锝' already exists CREATE TABLE IF NOT EXISTS `锝诧讲锝瞏(`锝凤椒锝穈 char(1)) DEFAULT CHARSET = utf8 engine=MyISAM; +Warnings: +Note 1050 Table '锝诧讲锝' already exists CREATE TABLE IF NOT EXISTS `銇傘亗銇俙(`銇嬨亱銇媊 char(1)) DEFAULT CHARSET = utf8 engine=MyISAM; +Warnings: +Note 1050 Table '銇傘亗銇' already exists CREATE TABLE IF NOT EXISTS `銇勩亜銇刞(`銇嶃亶銇峘 char(1)) DEFAULT CHARSET = utf8 engine=MyISAM; +Warnings: +Note 1050 Table '銇勩亜銇' already exists CREATE TABLE IF NOT EXISTS `榫栭緰榫朻(`涓備競涓俙 char(1)) DEFAULT CHARSET = utf8 engine=MyISAM; +Warnings: +Note 1050 Table '榫栭緰榫' already exists CREATE TABLE IF NOT EXISTS `榫楅緱榫梎(`涓勪竸涓刞 char(1)) DEFAULT CHARSET = utf8 engine=MyISAM; +Warnings: +Note 1050 Table '榫楅緱榫' already exists CREATE TABLE IF NOT EXISTS `锝筹匠锝砢(`锝革礁锝竊 char(1)) DEFAULT CHARSET = utf8 engine=MyISAM; CREATE TABLE IF NOT EXISTS `銇嗐亞銇哷(`銇忋亸銇廯 char(1)) DEFAULT CHARSET = utf8 engine=MyISAM; CREATE TABLE IF NOT EXISTS `榫為緸榫瀈(`涓呬竻涓卄char(1)) DEFAULT CHARSET = utf8 engine=MyISAM; @@ -334,11 +358,23 @@ CREATE TABLE `銇勩亜銇刞(`銇嶃亶銇峘 char(1)) DEFAULT CHARSET = utf8 engine=HEAP CREATE TABLE `榫栭緰榫朻(`涓備競涓俙 char(1)) DEFAULT CHARSET = utf8 engine=HEAP; CREATE TABLE `榫楅緱榫梎(`涓勪竸涓刞 char(1)) DEFAULT CHARSET = utf8 engine=HEAP; CREATE TABLE IF NOT EXISTS `锝憋奖锝盽(`锝讹蕉锝禶 char(1)) DEFAULT CHARSET = utf8 engine=HEAP; +Warnings: +Note 1050 Table '锝憋奖锝' already exists CREATE TABLE IF NOT EXISTS `锝诧讲锝瞏(`锝凤椒锝穈 char(1)) DEFAULT CHARSET = utf8 engine=HEAP; +Warnings: +Note 1050 Table '锝诧讲锝' already exists CREATE TABLE IF NOT EXISTS `銇傘亗銇俙(`銇嬨亱銇媊 char(1)) DEFAULT CHARSET = utf8 engine=HEAP; +Warnings: +Note 1050 Table '銇傘亗銇' already exists CREATE TABLE IF NOT EXISTS `銇勩亜銇刞(`銇嶃亶銇峘 char(1)) DEFAULT CHARSET = utf8 engine=HEAP; +Warnings: +Note 1050 Table '銇勩亜銇' already exists CREATE TABLE IF NOT EXISTS `榫栭緰榫朻(`涓備競涓俙 char(1)) DEFAULT CHARSET = utf8 engine=HEAP; +Warnings: +Note 1050 Table '榫栭緰榫' already exists CREATE TABLE IF NOT EXISTS `榫楅緱榫梎(`涓勪竸涓刞 char(1)) DEFAULT CHARSET = utf8 engine=HEAP; +Warnings: +Note 1050 Table '榫楅緱榫' already exists CREATE TABLE IF NOT EXISTS `锝筹匠锝砢(`锝革礁锝竊 char(1)) DEFAULT CHARSET = utf8 engine=HEAP; CREATE TABLE IF NOT EXISTS `銇嗐亞銇哷(`銇忋亸銇廯 char(1)) DEFAULT CHARSET = utf8 engine=HEAP; CREATE TABLE IF NOT EXISTS `榫為緸榫瀈(`涓呬竻涓卄char(1)) DEFAULT CHARSET = utf8 engine=HEAP; @@ -397,77 +433,77 @@ SHOW CREATE TABLE `锝憋奖锝盽; Table Create Table 锝憋奖锝 CREATE TABLE `锝憋奖锝盽 ( `锝讹蕉锝禶 char(1) default NULL -) ENGINE=HEAP DEFAULT CHARSET=utf8 +) ENGINE=MEMORY DEFAULT CHARSET=utf8 SHOW CREATE TABLE `锝诧讲锝瞏; Table Create Table 锝诧讲锝 CREATE TABLE `锝诧讲锝瞏 ( `锝凤椒锝穈 char(1) default NULL -) ENGINE=HEAP DEFAULT CHARSET=utf8 +) ENGINE=MEMORY DEFAULT CHARSET=utf8 SHOW CREATE TABLE `锝筹匠锝砢; Table Create Table 锝筹匠锝 CREATE TABLE `锝筹匠锝砢 ( `锝革礁锝竊 char(1) default NULL -) ENGINE=HEAP DEFAULT CHARSET=utf8 +) ENGINE=MEMORY DEFAULT CHARSET=utf8 SHOW CREATE TABLE `锝达酱锝碻; Table Create Table 锝达酱锝 CREATE TEMPORARY TABLE `锝达酱锝碻 ( `锝癸焦锝筦 char(1) default NULL -) ENGINE=HEAP DEFAULT CHARSET=utf8 +) ENGINE=MEMORY DEFAULT CHARSET=utf8 SHOW CREATE TABLE `锝碉降锝礰; Table Create Table 锝碉降锝 CREATE TEMPORARY TABLE `锝碉降锝礰 ( `锝猴胶锝篳 char(1) default NULL -) ENGINE=HEAP DEFAULT CHARSET=utf8 +) ENGINE=MEMORY DEFAULT CHARSET=utf8 SHOW CREATE TABLE `銇傘亗銇俙; Table Create Table 銇傘亗銇 CREATE TABLE `銇傘亗銇俙 ( `銇嬨亱銇媊 char(1) default NULL -) ENGINE=HEAP DEFAULT CHARSET=utf8 +) ENGINE=MEMORY DEFAULT CHARSET=utf8 SHOW CREATE TABLE `銇勩亜銇刞; Table Create Table 銇勩亜銇 CREATE TABLE `銇勩亜銇刞 ( `銇嶃亶銇峘 char(1) default NULL -) ENGINE=HEAP DEFAULT CHARSET=utf8 +) ENGINE=MEMORY DEFAULT CHARSET=utf8 SHOW CREATE TABLE `銇嗐亞銇哷; Table Create Table 銇嗐亞銇 CREATE TABLE `銇嗐亞銇哷 ( `銇忋亸銇廯 char(1) default NULL -) ENGINE=HEAP DEFAULT CHARSET=utf8 +) ENGINE=MEMORY DEFAULT CHARSET=utf8 SHOW CREATE TABLE `銇堛亪銇坄; Table Create Table 銇堛亪銇 CREATE TEMPORARY TABLE `銇堛亪銇坄 ( `銇戙亼銇慲 char(1) default NULL -) ENGINE=HEAP DEFAULT CHARSET=utf8 +) ENGINE=MEMORY DEFAULT CHARSET=utf8 SHOW CREATE TABLE `銇娿亰銇奰; Table Create Table 銇娿亰銇 CREATE TEMPORARY TABLE `銇娿亰銇奰 ( `銇撱亾銇揱 char(1) default NULL -) ENGINE=HEAP DEFAULT CHARSET=utf8 +) ENGINE=MEMORY DEFAULT CHARSET=utf8 SHOW CREATE TABLE `榫栭緰榫朻; Table Create Table 榫栭緰榫 CREATE TABLE `榫栭緰榫朻 ( `涓備競涓俙 char(1) default NULL -) ENGINE=HEAP DEFAULT CHARSET=utf8 +) ENGINE=MEMORY DEFAULT CHARSET=utf8 SHOW CREATE TABLE `榫楅緱榫梎; Table Create Table 榫楅緱榫 CREATE TABLE `榫楅緱榫梎 ( `涓勪竸涓刞 char(1) default NULL -) ENGINE=HEAP DEFAULT CHARSET=utf8 +) ENGINE=MEMORY DEFAULT CHARSET=utf8 SHOW CREATE TABLE `榫為緸榫瀈; Table Create Table 榫為緸榫 CREATE TABLE `榫為緸榫瀈 ( `涓呬竻涓卄 char(1) default NULL -) ENGINE=HEAP DEFAULT CHARSET=utf8 +) ENGINE=MEMORY DEFAULT CHARSET=utf8 SHOW CREATE TABLE `榫¢尽榫; Table Create Table 榫¢尽榫 CREATE TEMPORARY TABLE `榫¢尽榫 ( `涓屼笇涓宍 char(1) default NULL -) ENGINE=HEAP DEFAULT CHARSET=utf8 +) ENGINE=MEMORY DEFAULT CHARSET=utf8 SHOW CREATE TABLE `榫㈤劲榫; Table Create Table 榫㈤劲榫 CREATE TEMPORARY TABLE `榫㈤劲榫 ( `涓掍笒涓抈 char(1) default NULL -) ENGINE=HEAP DEFAULT CHARSET=utf8 +) ENGINE=MEMORY DEFAULT CHARSET=utf8 DROP TABLE `锝憋奖锝盽; DROP TABLE `锝诧讲锝瞏; DROP TABLE `锝筹匠锝砢; @@ -490,11 +526,23 @@ CREATE TABLE `銇勩亜銇刞(`銇嶃亶銇峘 char(1)) DEFAULT CHARSET = utf8 engine=BDB; CREATE TABLE `榫栭緰榫朻(`涓備競涓俙 char(1)) DEFAULT CHARSET = utf8 engine=BDB; CREATE TABLE `榫楅緱榫梎(`涓勪竸涓刞 char(1)) DEFAULT CHARSET = utf8 engine=BDB; CREATE TABLE IF NOT EXISTS `锝憋奖锝盽(`锝讹蕉锝禶 char(1)) DEFAULT CHARSET = utf8 engine=BDB; +Warnings: +Note 1050 Table '锝憋奖锝' already exists CREATE TABLE IF NOT EXISTS `锝诧讲锝瞏(`锝凤椒锝穈 char(1)) DEFAULT CHARSET = utf8 engine=BDB; +Warnings: +Note 1050 Table '锝诧讲锝' already exists CREATE TABLE IF NOT EXISTS `銇傘亗銇俙(`銇嬨亱銇媊 char(1)) DEFAULT CHARSET = utf8 engine=BDB; +Warnings: +Note 1050 Table '銇傘亗銇' already exists CREATE TABLE IF NOT EXISTS `銇勩亜銇刞(`銇嶃亶銇峘 char(1)) DEFAULT CHARSET = utf8 engine=BDB; +Warnings: +Note 1050 Table '銇勩亜銇' already exists CREATE TABLE IF NOT EXISTS `榫栭緰榫朻(`涓備競涓俙 char(1)) DEFAULT CHARSET = utf8 engine=BDB; +Warnings: +Note 1050 Table '榫栭緰榫' already exists CREATE TABLE IF NOT EXISTS `榫楅緱榫梎(`涓勪竸涓刞 char(1)) DEFAULT CHARSET = utf8 engine=BDB; +Warnings: +Note 1050 Table '榫楅緱榫' already exists CREATE TABLE IF NOT EXISTS `锝筹匠锝砢(`锝革礁锝竊 char(1)) DEFAULT CHARSET = utf8 engine=BDB; CREATE TABLE IF NOT EXISTS `銇嗐亞銇哷(`銇忋亸銇廯 char(1)) DEFAULT CHARSET = utf8 engine=BDB; CREATE TABLE IF NOT EXISTS `榫為緸榫瀈(`涓呬竻涓卄char(1)) DEFAULT CHARSET = utf8 engine=BDB; diff --git a/mysql-test/suite/jp/r/jp_enum_sjis.result b/mysql-test/suite/jp/r/jp_enum_sjis.result index 1e46dbffbb1..43994123e3b 100644 --- a/mysql-test/suite/jp/r/jp_enum_sjis.result +++ b/mysql-test/suite/jp/r/jp_enum_sjis.result @@ -137,19 +137,19 @@ Table Create Table 俿俈 CREATE TABLE `俿俈` ( `俠侾` enum('','','') default NULL, KEY `俠侾` (`俠侾`) -) ENGINE=HEAP DEFAULT CHARSET=sjis +) ENGINE=MEMORY DEFAULT CHARSET=sjis SHOW CREATE TABLE `俿俉`; Table Create Table 俿俉 CREATE TABLE `俿俉` ( `俠侾` enum('偁','偄','偆') default NULL, KEY `俠侾` (`俠侾`) -) ENGINE=HEAP DEFAULT CHARSET=sjis +) ENGINE=MEMORY DEFAULT CHARSET=sjis SHOW CREATE TABLE `俿俋`; Table Create Table 俿俋 CREATE TABLE `俿俋` ( `俠侾` enum('僜','廫','昞') default NULL, KEY `俠侾` (`俠侾`) -) ENGINE=HEAP DEFAULT CHARSET=sjis +) ENGINE=MEMORY DEFAULT CHARSET=sjis SHOW CREATE TABLE `俿侾侽`; Table Create Table 俿侾侽 CREATE TABLE `俿侾侽` ( @@ -219,134 +219,134 @@ ALTER TABLE ` SHOW CREATE TABLE `俿侾`; Table Create Table 俿侾 CREATE TABLE `俿侾` ( - `俠俀` char(1) NOT NULL default '', + `俠俀` char(1) NOT NULL, `俠侾` enum('','','') default NULL, KEY `俠侾` (`俠侾`) ) ENGINE=InnoDB DEFAULT CHARSET=sjis SHOW CREATE TABLE `俿俀`; Table Create Table 俿俀 CREATE TABLE `俿俀` ( - `俠俀` char(1) NOT NULL default '', + `俠俀` char(1) NOT NULL, `俠侾` enum('偁','偄','偆') default NULL, KEY `俠侾` (`俠侾`) ) ENGINE=InnoDB DEFAULT CHARSET=sjis SHOW CREATE TABLE `俿俁`; Table Create Table 俿俁 CREATE TABLE `俿俁` ( - `俠俀` char(1) NOT NULL default '', + `俠俀` char(1) NOT NULL, `俠侾` enum('僜','廫','昞') default NULL, KEY `俠侾` (`俠侾`) ) ENGINE=InnoDB DEFAULT CHARSET=sjis SHOW CREATE TABLE `俿係`; Table Create Table 俿係 CREATE TABLE `俿係` ( - `俠俀` char(1) NOT NULL default '', + `俠俀` char(1) NOT NULL, `俠侾` enum('','','') default NULL, KEY `俠侾` (`俠侾`) ) ENGINE=MyISAM DEFAULT CHARSET=sjis SHOW CREATE TABLE `俿俆`; Table Create Table 俿俆 CREATE TABLE `俿俆` ( - `俠俀` char(1) NOT NULL default '', + `俠俀` char(1) NOT NULL, `俠侾` enum('偁','偄','偆') default NULL, KEY `俠侾` (`俠侾`) ) ENGINE=MyISAM DEFAULT CHARSET=sjis SHOW CREATE TABLE `俿俇`; Table Create Table 俿俇 CREATE TABLE `俿俇` ( - `俠俀` char(1) NOT NULL default '', + `俠俀` char(1) NOT NULL, `俠侾` enum('僜','廫','昞') default NULL, KEY `俠侾` (`俠侾`) ) ENGINE=MyISAM DEFAULT CHARSET=sjis SHOW CREATE TABLE `俿俈`; Table Create Table 俿俈 CREATE TABLE `俿俈` ( - `俠俀` char(1) NOT NULL default '', + `俠俀` char(1) NOT NULL, `俠侾` enum('','','') default NULL, KEY `俠侾` (`俠侾`) -) ENGINE=HEAP DEFAULT CHARSET=sjis +) ENGINE=MEMORY DEFAULT CHARSET=sjis SHOW CREATE TABLE `俿俉`; Table Create Table 俿俉 CREATE TABLE `俿俉` ( - `俠俀` char(1) NOT NULL default '', + `俠俀` char(1) NOT NULL, `俠侾` enum('偁','偄','偆') default NULL, KEY `俠侾` (`俠侾`) -) ENGINE=HEAP DEFAULT CHARSET=sjis +) ENGINE=MEMORY DEFAULT CHARSET=sjis SHOW CREATE TABLE `俿俋`; Table Create Table 俿俋 CREATE TABLE `俿俋` ( - `俠俀` char(1) NOT NULL default '', + `俠俀` char(1) NOT NULL, `俠侾` enum('僜','廫','昞') default NULL, KEY `俠侾` (`俠侾`) -) ENGINE=HEAP DEFAULT CHARSET=sjis +) ENGINE=MEMORY DEFAULT CHARSET=sjis SHOW CREATE TABLE `俿侾侽`; Table Create Table 俿侾侽 CREATE TABLE `俿侾侽` ( - `俠俀` char(1) NOT NULL default '', + `俠俀` char(1) NOT NULL, `俠侾` enum('','','') default NULL, KEY `俠侾` (`俠侾`) ) ENGINE=BerkeleyDB DEFAULT CHARSET=sjis SHOW CREATE TABLE `俿侾侾`; Table Create Table 俿侾侾 CREATE TABLE `俿侾侾` ( - `俠俀` char(1) NOT NULL default '', + `俠俀` char(1) NOT NULL, `俠侾` enum('偁','偄','偆') default NULL, KEY `俠侾` (`俠侾`) ) ENGINE=BerkeleyDB DEFAULT CHARSET=sjis SHOW CREATE TABLE `俿侾俀`; Table Create Table 俿侾俀 CREATE TABLE `俿侾俀` ( - `俠俀` char(1) NOT NULL default '', + `俠俀` char(1) NOT NULL, `俠侾` enum('僜','廫','昞') default NULL, KEY `俠侾` (`俠侾`) ) ENGINE=BerkeleyDB DEFAULT CHARSET=sjis DESC `俿侾`; Field Type Null Key Default Extra -俠俀 char(1) +俠俀 char(1) NO NULL 俠侾 enum('','','') YES MUL NULL DESC `俿俀`; Field Type Null Key Default Extra -俠俀 char(1) +俠俀 char(1) NO NULL 俠侾 enum('偁','偄','偆') YES MUL NULL DESC `俿俁`; Field Type Null Key Default Extra -俠俀 char(1) +俠俀 char(1) NO NULL 俠侾 enum('僜','廫','昞') YES MUL NULL DESC `俿係`; Field Type Null Key Default Extra -俠俀 char(1) +俠俀 char(1) NO NULL 俠侾 enum('','','') YES MUL NULL DESC `俿俆`; Field Type Null Key Default Extra -俠俀 char(1) +俠俀 char(1) NO NULL 俠侾 enum('偁','偄','偆') YES MUL NULL DESC `俿俇`; Field Type Null Key Default Extra -俠俀 char(1) +俠俀 char(1) NO NULL 俠侾 enum('僜','廫','昞') YES MUL NULL DESC `俿俈`; Field Type Null Key Default Extra -俠俀 char(1) +俠俀 char(1) NO NULL 俠侾 enum('','','') YES MUL NULL DESC `俿俉`; Field Type Null Key Default Extra -俠俀 char(1) +俠俀 char(1) NO NULL 俠侾 enum('偁','偄','偆') YES MUL NULL DESC `俿俋`; Field Type Null Key Default Extra -俠俀 char(1) +俠俀 char(1) NO NULL 俠侾 enum('僜','廫','昞') YES MUL NULL DESC `俿侾侽`; Field Type Null Key Default Extra -俠俀 char(1) +俠俀 char(1) NO NULL 俠侾 enum('','','') YES MUL NULL DESC `俿侾侾`; Field Type Null Key Default Extra -俠俀 char(1) +俠俀 char(1) NO NULL 俠侾 enum('偁','偄','偆') YES MUL NULL DESC `俿侾俀`; Field Type Null Key Default Extra -俠俀 char(1) +俠俀 char(1) NO NULL 俠侾 enum('僜','廫','昞') YES MUL NULL DROP TABLE `俿侾`; DROP TABLE `俿俀`; diff --git a/mysql-test/suite/jp/r/jp_enum_ucs2.result b/mysql-test/suite/jp/r/jp_enum_ucs2.result index a84cace35fe..c41e6c262eb 100644 --- a/mysql-test/suite/jp/r/jp_enum_ucs2.result +++ b/mysql-test/suite/jp/r/jp_enum_ucs2.result @@ -138,19 +138,19 @@ Table Create Table T7 CREATE TABLE `T7` ( `C1` enum('幈','幉','幊') default NULL, KEY `C1` (`C1`) -) ENGINE=HEAP DEFAULT CHARSET=ucs2 +) ENGINE=MEMORY DEFAULT CHARSET=ucs2 SHOW CREATE TABLE `T8`; Table Create Table T8 CREATE TABLE `T8` ( `C1` enum('あ','い','う') default NULL, KEY `C1` (`C1`) -) ENGINE=HEAP DEFAULT CHARSET=ucs2 +) ENGINE=MEMORY DEFAULT CHARSET=ucs2 SHOW CREATE TABLE `T9`; Table Create Table T9 CREATE TABLE `T9` ( `C1` enum('忢','忢','忢') default NULL, KEY `C1` (`C1`) -) ENGINE=HEAP DEFAULT CHARSET=ucs2 +) ENGINE=MEMORY DEFAULT CHARSET=ucs2 SHOW CREATE TABLE `T10`; Table Create Table T10 CREATE TABLE `T10` ( diff --git a/mysql-test/suite/jp/r/jp_enum_ujis.result b/mysql-test/suite/jp/r/jp_enum_ujis.result index dbc850b1368..9ba445eaba5 100644 --- a/mysql-test/suite/jp/r/jp_enum_ujis.result +++ b/mysql-test/suite/jp/r/jp_enum_ujis.result @@ -137,19 +137,19 @@ Table Create Table T7 CREATE TABLE `T7` ( `C1` enum('幈','幉','幊') default NULL, KEY `C1` (`C1`) -) ENGINE=HEAP DEFAULT CHARSET=ujis +) ENGINE=MEMORY DEFAULT CHARSET=ujis SHOW CREATE TABLE `T8`; Table Create Table T8 CREATE TABLE `T8` ( `C1` enum('あ','い','う') default NULL, KEY `C1` (`C1`) -) ENGINE=HEAP DEFAULT CHARSET=ujis +) ENGINE=MEMORY DEFAULT CHARSET=ujis SHOW CREATE TABLE `T9`; Table Create Table T9 CREATE TABLE `T9` ( `C1` enum('忢','忢','忢') default NULL, KEY `C1` (`C1`) -) ENGINE=HEAP DEFAULT CHARSET=ujis +) ENGINE=MEMORY DEFAULT CHARSET=ujis SHOW CREATE TABLE `T10`; Table Create Table T10 CREATE TABLE `T10` ( @@ -219,134 +219,134 @@ ALTER TABLE ` SHOW CREATE TABLE `T1`; Table Create Table T1 CREATE TABLE `T1` ( - `C2` char(1) NOT NULL default '', + `C2` char(1) NOT NULL, `C1` enum('幈','幉','幊') default NULL, KEY `C1` (`C1`) ) ENGINE=InnoDB DEFAULT CHARSET=ujis SHOW CREATE TABLE `T2`; Table Create Table T2 CREATE TABLE `T2` ( - `C2` char(1) NOT NULL default '', + `C2` char(1) NOT NULL, `C1` enum('あ','い','う') default NULL, KEY `C1` (`C1`) ) ENGINE=InnoDB DEFAULT CHARSET=ujis SHOW CREATE TABLE `T3`; Table Create Table T3 CREATE TABLE `T3` ( - `C2` char(1) NOT NULL default '', + `C2` char(1) NOT NULL, `C1` enum('忢','忢','忢') default NULL, KEY `C1` (`C1`) ) ENGINE=InnoDB DEFAULT CHARSET=ujis SHOW CREATE TABLE `T4`; Table Create Table T4 CREATE TABLE `T4` ( - `C2` char(1) NOT NULL default '', + `C2` char(1) NOT NULL, `C1` enum('幈','幉','幊') default NULL, KEY `C1` (`C1`) ) ENGINE=MyISAM DEFAULT CHARSET=ujis SHOW CREATE TABLE `T5`; Table Create Table T5 CREATE TABLE `T5` ( - `C2` char(1) NOT NULL default '', + `C2` char(1) NOT NULL, `C1` enum('あ','い','う') default NULL, KEY `C1` (`C1`) ) ENGINE=MyISAM DEFAULT CHARSET=ujis SHOW CREATE TABLE `T6`; Table Create Table T6 CREATE TABLE `T6` ( - `C2` char(1) NOT NULL default '', + `C2` char(1) NOT NULL, `C1` enum('忢','忢','忢') default NULL, KEY `C1` (`C1`) ) ENGINE=MyISAM DEFAULT CHARSET=ujis SHOW CREATE TABLE `T7`; Table Create Table T7 CREATE TABLE `T7` ( - `C2` char(1) NOT NULL default '', + `C2` char(1) NOT NULL, `C1` enum('幈','幉','幊') default NULL, KEY `C1` (`C1`) -) ENGINE=HEAP DEFAULT CHARSET=ujis +) ENGINE=MEMORY DEFAULT CHARSET=ujis SHOW CREATE TABLE `T8`; Table Create Table T8 CREATE TABLE `T8` ( - `C2` char(1) NOT NULL default '', + `C2` char(1) NOT NULL, `C1` enum('あ','い','う') default NULL, KEY `C1` (`C1`) -) ENGINE=HEAP DEFAULT CHARSET=ujis +) ENGINE=MEMORY DEFAULT CHARSET=ujis SHOW CREATE TABLE `T9`; Table Create Table T9 CREATE TABLE `T9` ( - `C2` char(1) NOT NULL default '', + `C2` char(1) NOT NULL, `C1` enum('忢','忢','忢') default NULL, KEY `C1` (`C1`) -) ENGINE=HEAP DEFAULT CHARSET=ujis +) ENGINE=MEMORY DEFAULT CHARSET=ujis SHOW CREATE TABLE `T10`; Table Create Table T10 CREATE TABLE `T10` ( - `C2` char(1) NOT NULL default '', + `C2` char(1) NOT NULL, `C1` enum('幈','幉','幊') default NULL, KEY `C1` (`C1`) ) ENGINE=BerkeleyDB DEFAULT CHARSET=ujis SHOW CREATE TABLE `T11`; Table Create Table T11 CREATE TABLE `T11` ( - `C2` char(1) NOT NULL default '', + `C2` char(1) NOT NULL, `C1` enum('あ','い','う') default NULL, KEY `C1` (`C1`) ) ENGINE=BerkeleyDB DEFAULT CHARSET=ujis SHOW CREATE TABLE `T12`; Table Create Table T12 CREATE TABLE `T12` ( - `C2` char(1) NOT NULL default '', + `C2` char(1) NOT NULL, `C1` enum('忢','忢','忢') default NULL, KEY `C1` (`C1`) ) ENGINE=BerkeleyDB DEFAULT CHARSET=ujis DESC `T1`; Field Type Null Key Default Extra -C2 char(1) +C2 char(1) NO NULL C1 enum('幈','幉','幊') YES MUL NULL DESC `T2`; Field Type Null Key Default Extra -C2 char(1) +C2 char(1) NO NULL C1 enum('あ','い','う') YES MUL NULL DESC `T3`; Field Type Null Key Default Extra -C2 char(1) +C2 char(1) NO NULL C1 enum('忢','忢','忢') YES MUL NULL DESC `T4`; Field Type Null Key Default Extra -C2 char(1) +C2 char(1) NO NULL C1 enum('幈','幉','幊') YES MUL NULL DESC `T5`; Field Type Null Key Default Extra -C2 char(1) +C2 char(1) NO NULL C1 enum('あ','い','う') YES MUL NULL DESC `T6`; Field Type Null Key Default Extra -C2 char(1) +C2 char(1) NO NULL C1 enum('忢','忢','忢') YES MUL NULL DESC `T7`; Field Type Null Key Default Extra -C2 char(1) +C2 char(1) NO NULL C1 enum('幈','幉','幊') YES MUL NULL DESC `T8`; Field Type Null Key Default Extra -C2 char(1) +C2 char(1) NO NULL C1 enum('あ','い','う') YES MUL NULL DESC `T9`; Field Type Null Key Default Extra -C2 char(1) +C2 char(1) NO NULL C1 enum('忢','忢','忢') YES MUL NULL DESC `T10`; Field Type Null Key Default Extra -C2 char(1) +C2 char(1) NO NULL C1 enum('幈','幉','幊') YES MUL NULL DESC `T11`; Field Type Null Key Default Extra -C2 char(1) +C2 char(1) NO NULL C1 enum('あ','い','う') YES MUL NULL DESC `T12`; Field Type Null Key Default Extra -C2 char(1) +C2 char(1) NO NULL C1 enum('忢','忢','忢') YES MUL NULL DROP TABLE `T1`; DROP TABLE `T2`; diff --git a/mysql-test/suite/jp/r/jp_enum_utf8.result b/mysql-test/suite/jp/r/jp_enum_utf8.result index f2515871ece..c4ff9193447 100644 --- a/mysql-test/suite/jp/r/jp_enum_utf8.result +++ b/mysql-test/suite/jp/r/jp_enum_utf8.result @@ -137,19 +137,19 @@ Table Create Table 锛达紬 CREATE TABLE `锛达紬` ( `锛o紤` enum('锝','锝','锝') default NULL, KEY `锛o紤` (`锛o紤`) -) ENGINE=HEAP DEFAULT CHARSET=utf8 +) ENGINE=MEMORY DEFAULT CHARSET=utf8 SHOW CREATE TABLE `锛达紭`; Table Create Table 锛达紭 CREATE TABLE `锛达紭` ( `锛o紤` enum('銇','銇','銇') default NULL, KEY `锛o紤` (`锛o紤`) -) ENGINE=HEAP DEFAULT CHARSET=utf8 +) ENGINE=MEMORY DEFAULT CHARSET=utf8 SHOW CREATE TABLE `锛达紮`; Table Create Table 锛达紮 CREATE TABLE `锛达紮` ( `锛o紤` enum('榫','榫','榫') default NULL, KEY `锛o紤` (`锛o紤`) -) ENGINE=HEAP DEFAULT CHARSET=utf8 +) ENGINE=MEMORY DEFAULT CHARSET=utf8 SHOW CREATE TABLE `锛达紤锛恅; Table Create Table 锛达紤锛 CREATE TABLE `锛达紤锛恅 ( @@ -219,134 +219,134 @@ ALTER TABLE `锛达紤锛抈 ADD `锛o紥` CHAR(1) NOT NULL FIRST; SHOW CREATE TABLE `锛达紤`; Table Create Table 锛达紤 CREATE TABLE `锛达紤` ( - `锛o紥` char(1) NOT NULL default '', + `锛o紥` char(1) NOT NULL, `锛o紤` enum('锝','锝','锝') default NULL, KEY `锛o紤` (`锛o紤`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 SHOW CREATE TABLE `锛达紥`; Table Create Table 锛达紥 CREATE TABLE `锛达紥` ( - `锛o紥` char(1) NOT NULL default '', + `锛o紥` char(1) NOT NULL, `锛o紤` enum('銇','銇','銇') default NULL, KEY `锛o紤` (`锛o紤`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 SHOW CREATE TABLE `锛达紦`; Table Create Table 锛达紦 CREATE TABLE `锛达紦` ( - `锛o紥` char(1) NOT NULL default '', + `锛o紥` char(1) NOT NULL, `锛o紤` enum('榫','榫','榫') default NULL, KEY `锛o紤` (`锛o紤`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 SHOW CREATE TABLE `锛达紨`; Table Create Table 锛达紨 CREATE TABLE `锛达紨` ( - `锛o紥` char(1) NOT NULL default '', + `锛o紥` char(1) NOT NULL, `锛o紤` enum('锝','锝','锝') default NULL, KEY `锛o紤` (`锛o紤`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 SHOW CREATE TABLE `锛达紩`; Table Create Table 锛达紩 CREATE TABLE `锛达紩` ( - `锛o紥` char(1) NOT NULL default '', + `锛o紥` char(1) NOT NULL, `锛o紤` enum('銇','銇','銇') default NULL, KEY `锛o紤` (`锛o紤`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 SHOW CREATE TABLE `锛达紪`; Table Create Table 锛达紪 CREATE TABLE `锛达紪` ( - `锛o紥` char(1) NOT NULL default '', + `锛o紥` char(1) NOT NULL, `锛o紤` enum('榫','榫','榫') default NULL, KEY `锛o紤` (`锛o紤`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 SHOW CREATE TABLE `锛达紬`; Table Create Table 锛达紬 CREATE TABLE `锛达紬` ( - `锛o紥` char(1) NOT NULL default '', + `锛o紥` char(1) NOT NULL, `锛o紤` enum('锝','锝','锝') default NULL, KEY `锛o紤` (`锛o紤`) -) ENGINE=HEAP DEFAULT CHARSET=utf8 +) ENGINE=MEMORY DEFAULT CHARSET=utf8 SHOW CREATE TABLE `锛达紭`; Table Create Table 锛达紭 CREATE TABLE `锛达紭` ( - `锛o紥` char(1) NOT NULL default '', + `锛o紥` char(1) NOT NULL, `锛o紤` enum('銇','銇','銇') default NULL, KEY `锛o紤` (`锛o紤`) -) ENGINE=HEAP DEFAULT CHARSET=utf8 +) ENGINE=MEMORY DEFAULT CHARSET=utf8 SHOW CREATE TABLE `锛达紮`; Table Create Table 锛达紮 CREATE TABLE `锛达紮` ( - `锛o紥` char(1) NOT NULL default '', + `锛o紥` char(1) NOT NULL, `锛o紤` enum('榫','榫','榫') default NULL, KEY `锛o紤` (`锛o紤`) -) ENGINE=HEAP DEFAULT CHARSET=utf8 +) ENGINE=MEMORY DEFAULT CHARSET=utf8 SHOW CREATE TABLE `锛达紤锛恅; Table Create Table 锛达紤锛 CREATE TABLE `锛达紤锛恅 ( - `锛o紥` char(1) NOT NULL default '', + `锛o紥` char(1) NOT NULL, `锛o紤` enum('锝','锝','锝') default NULL, KEY `锛o紤` (`锛o紤`) ) ENGINE=BerkeleyDB DEFAULT CHARSET=utf8 SHOW CREATE TABLE `锛达紤锛慲; Table Create Table 锛达紤锛 CREATE TABLE `锛达紤锛慲 ( - `锛o紥` char(1) NOT NULL default '', + `锛o紥` char(1) NOT NULL, `锛o紤` enum('銇','銇','銇') default NULL, KEY `锛o紤` (`锛o紤`) ) ENGINE=BerkeleyDB DEFAULT CHARSET=utf8 SHOW CREATE TABLE `锛达紤锛抈; Table Create Table 锛达紤锛 CREATE TABLE `锛达紤锛抈 ( - `锛o紥` char(1) NOT NULL default '', + `锛o紥` char(1) NOT NULL, `锛o紤` enum('榫','榫','榫') default NULL, KEY `锛o紤` (`锛o紤`) ) ENGINE=BerkeleyDB DEFAULT CHARSET=utf8 DESC `锛达紤`; Field Type Null Key Default Extra -锛o紥 char(1) +锛o紥 char(1) NO NULL 锛o紤 enum('锝','锝','锝') YES MUL NULL DESC `锛达紥`; Field Type Null Key Default Extra -锛o紥 char(1) +锛o紥 char(1) NO NULL 锛o紤 enum('銇','銇','銇') YES MUL NULL DESC `锛达紦`; Field Type Null Key Default Extra -锛o紥 char(1) +锛o紥 char(1) NO NULL 锛o紤 enum('榫','榫','榫') YES MUL NULL DESC `锛达紨`; Field Type Null Key Default Extra -锛o紥 char(1) +锛o紥 char(1) NO NULL 锛o紤 enum('锝','锝','锝') YES MUL NULL DESC `锛达紩`; Field Type Null Key Default Extra -锛o紥 char(1) +锛o紥 char(1) NO NULL 锛o紤 enum('銇','銇','銇') YES MUL NULL DESC `锛达紪`; Field Type Null Key Default Extra -锛o紥 char(1) +锛o紥 char(1) NO NULL 锛o紤 enum('榫','榫','榫') YES MUL NULL DESC `锛达紬`; Field Type Null Key Default Extra -锛o紥 char(1) +锛o紥 char(1) NO NULL 锛o紤 enum('锝','锝','锝') YES MUL NULL DESC `锛达紭`; Field Type Null Key Default Extra -锛o紥 char(1) +锛o紥 char(1) NO NULL 锛o紤 enum('銇','銇','銇') YES MUL NULL DESC `锛达紮`; Field Type Null Key Default Extra -锛o紥 char(1) +锛o紥 char(1) NO NULL 锛o紤 enum('榫','榫','榫') YES MUL NULL DESC `锛达紤锛恅; Field Type Null Key Default Extra -锛o紥 char(1) +锛o紥 char(1) NO NULL 锛o紤 enum('锝','锝','锝') YES MUL NULL DESC `锛达紤锛慲; Field Type Null Key Default Extra -锛o紥 char(1) +锛o紥 char(1) NO NULL 锛o紤 enum('銇','銇','銇') YES MUL NULL DESC `锛达紤锛抈; Field Type Null Key Default Extra -锛o紥 char(1) +锛o紥 char(1) NO NULL 锛o紤 enum('榫','榫','榫') YES MUL NULL DROP TABLE `锛达紤`; DROP TABLE `锛达紥`; diff --git a/mysql-test/suite/jp/r/jp_join_sjis.result b/mysql-test/suite/jp/r/jp_join_sjis.result index a5ccc58ae4c..95df2d5488e 100644 --- a/mysql-test/suite/jp/r/jp_join_sjis.result +++ b/mysql-test/suite/jp/r/jp_join_sjis.result @@ -71,31 +71,31 @@ SELECT * FROM ` SELECT * FROM `俿侾a` JOIN `俿侾b` USING (`俠侾`); -俠侾 俠侾 - +俠侾 + SELECT * FROM `俿侾a` INNER JOIN `俿侾b` USING (`俠侾`); -俠侾 俠侾 - +俠侾 + SELECT * FROM `俿侾a` CROSS JOIN `俿侾b`; 俠侾 俠侾 SELECT * FROM `俿侾a` LEFT JOIN `俿侾b` USING (`俠侾`); -俠侾 俠侾 - - NULL - NULL +俠侾 + + + SELECT * FROM `俿侾a` LEFT JOIN `俿侾b` ON (`俿侾a`.`俠侾` = `俿侾b`.`俠侾`); 俠侾 俠侾 NULL NULL SELECT * FROM `俿侾b` RIGHT JOIN `俿侾a` USING (`俠侾`); -俠侾 俠侾 - -NULL -NULL +俠侾 + + + SELECT * FROM `俿侾b` RIGHT JOIN `俿侾a` ON (`俿侾a`.`俠侾` = `俿侾b`.`俠侾`); 俠侾 俠侾 @@ -112,31 +112,31 @@ SELECT * FROM ` 偐 偁 偝 偁 SELECT * FROM `俿俀a` JOIN `俿俀b` USING (`俠侾`); -俠侾 俠侾 -偁 偁 +俠侾 +偁 SELECT * FROM `俿俀a` INNER JOIN `俿俀b` USING (`俠侾`); -俠侾 俠侾 -偁 偁 +俠侾 +偁 SELECT * FROM `俿俀a` CROSS JOIN `俿俀b`; 俠侾 俠侾 偁 偁 偐 偁 偝 偁 SELECT * FROM `俿俀a` LEFT JOIN `俿俀b` USING (`俠侾`); -俠侾 俠侾 -偁 偁 -偐 NULL -偝 NULL +俠侾 +偁 +偐 +偝 SELECT * FROM `俿俀a` LEFT JOIN `俿俀b` ON (`俿俀a`.`俠侾` = `俿俀b`.`俠侾`); 俠侾 俠侾 偁 偁 偐 NULL 偝 NULL SELECT * FROM `俿俀b` RIGHT JOIN `俿俀a` USING (`俠侾`); -俠侾 俠侾 -偁 偁 -NULL 偐 -NULL 偝 +俠侾 +偁 +偐 +偝 SELECT * FROM `俿俀b` RIGHT JOIN `俿俀a` ON (`俿俀a`.`俠侾` = `俿俀b`.`俠侾`); 俠侾 俠侾 偁 偁 @@ -153,31 +153,31 @@ SELECT * FROM ` 廫 僜 昞 僜 SELECT * FROM `俿俁a` JOIN `俿俁b` USING (`俠侾`); -俠侾 俠侾 -僜 僜 +俠侾 +僜 SELECT * FROM `俿俁a` INNER JOIN `俿俁b` USING (`俠侾`); -俠侾 俠侾 -僜 僜 +俠侾 +僜 SELECT * FROM `俿俁a` CROSS JOIN `俿俁b`; 俠侾 俠侾 僜 僜 廫 僜 昞 僜 SELECT * FROM `俿俁a` LEFT JOIN `俿俁b` USING (`俠侾`); -俠侾 俠侾 -僜 僜 -廫 NULL -昞 NULL +俠侾 +僜 +廫 +昞 SELECT * FROM `俿俁a` LEFT JOIN `俿俁b` ON (`俿俁a`.`俠侾` = `俿俁b`.`俠侾`); 俠侾 俠侾 僜 僜 廫 NULL 昞 NULL SELECT * FROM `俿俁b` RIGHT JOIN `俿俁a` USING (`俠侾`); -俠侾 俠侾 -僜 僜 -NULL 廫 -NULL 昞 +俠侾 +僜 +廫 +昞 SELECT * FROM `俿俁b` RIGHT JOIN `俿俁a` ON (`俿俁a`.`俠侾` = `俿俁b`.`俠侾`); 俠侾 俠侾 僜 僜 @@ -194,31 +194,31 @@ SELECT * FROM ` SELECT * FROM `俿係a` JOIN `俿係b` USING (`俠侾`); -俠侾 俠侾 - +俠侾 + SELECT * FROM `俿係a` INNER JOIN `俿係b` USING (`俠侾`); -俠侾 俠侾 - +俠侾 + SELECT * FROM `俿係a` CROSS JOIN `俿係b`; 俠侾 俠侾 SELECT * FROM `俿係a` LEFT JOIN `俿係b` USING (`俠侾`); -俠侾 俠侾 - - NULL - NULL +俠侾 + + + SELECT * FROM `俿係a` LEFT JOIN `俿係b` ON (`俿係a`.`俠侾` = `俿係b`.`俠侾`); 俠侾 俠侾 NULL NULL SELECT * FROM `俿係b` RIGHT JOIN `俿係a` USING (`俠侾`); -俠侾 俠侾 - -NULL -NULL +俠侾 + + + SELECT * FROM `俿係b` RIGHT JOIN `俿係a` ON (`俿係a`.`俠侾` = `俿係b`.`俠侾`); 俠侾 俠侾 @@ -235,31 +235,31 @@ SELECT * FROM ` 偐 偁 偝 偁 SELECT * FROM `俿俆a` JOIN `俿俆b` USING (`俠侾`); -俠侾 俠侾 -偁 偁 +俠侾 +偁 SELECT * FROM `俿俆a` INNER JOIN `俿俆b` USING (`俠侾`); -俠侾 俠侾 -偁 偁 +俠侾 +偁 SELECT * FROM `俿俆a` CROSS JOIN `俿俆b`; 俠侾 俠侾 偁 偁 偐 偁 偝 偁 SELECT * FROM `俿俆a` LEFT JOIN `俿俆b` USING (`俠侾`); -俠侾 俠侾 -偁 偁 -偐 NULL -偝 NULL +俠侾 +偁 +偐 +偝 SELECT * FROM `俿俆a` LEFT JOIN `俿俆b` ON (`俿俆a`.`俠侾` = `俿俆b`.`俠侾`); 俠侾 俠侾 偁 偁 偐 NULL 偝 NULL SELECT * FROM `俿俆b` RIGHT JOIN `俿俆a` USING (`俠侾`); -俠侾 俠侾 -偁 偁 -NULL 偐 -NULL 偝 +俠侾 +偁 +偐 +偝 SELECT * FROM `俿俆b` RIGHT JOIN `俿俆a` ON (`俿俆a`.`俠侾` = `俿俆b`.`俠侾`); 俠侾 俠侾 偁 偁 @@ -276,31 +276,31 @@ SELECT * FROM ` 廫 僜 昞 僜 SELECT * FROM `俿俇a` JOIN `俿俇b` USING (`俠侾`); -俠侾 俠侾 -僜 僜 +俠侾 +僜 SELECT * FROM `俿俇a` INNER JOIN `俿俇b` USING (`俠侾`); -俠侾 俠侾 -僜 僜 +俠侾 +僜 SELECT * FROM `俿俇a` CROSS JOIN `俿俇b`; 俠侾 俠侾 僜 僜 廫 僜 昞 僜 SELECT * FROM `俿俇a` LEFT JOIN `俿俇b` USING (`俠侾`); -俠侾 俠侾 -僜 僜 -廫 NULL -昞 NULL +俠侾 +僜 +廫 +昞 SELECT * FROM `俿俇a` LEFT JOIN `俿俇b` ON (`俿俇a`.`俠侾` = `俿俇b`.`俠侾`); 俠侾 俠侾 僜 僜 廫 NULL 昞 NULL SELECT * FROM `俿俇b` RIGHT JOIN `俿俇a` USING (`俠侾`); -俠侾 俠侾 -僜 僜 -NULL 廫 -NULL 昞 +俠侾 +僜 +廫 +昞 SELECT * FROM `俿俇b` RIGHT JOIN `俿俇a` ON (`俿俇a`.`俠侾` = `俿俇b`.`俠侾`); 俠侾 俠侾 僜 僜 @@ -317,31 +317,31 @@ SELECT * FROM ` SELECT * FROM `俿俈a` JOIN `俿俈b` USING (`俠侾`); -俠侾 俠侾 - +俠侾 + SELECT * FROM `俿俈a` INNER JOIN `俿俈b` USING (`俠侾`); -俠侾 俠侾 - +俠侾 + SELECT * FROM `俿俈a` CROSS JOIN `俿俈b`; 俠侾 俠侾 SELECT * FROM `俿俈a` LEFT JOIN `俿俈b` USING (`俠侾`); -俠侾 俠侾 - - NULL - NULL +俠侾 + + + SELECT * FROM `俿俈a` LEFT JOIN `俿俈b` ON (`俿俈a`.`俠侾` = `俿俈b`.`俠侾`); 俠侾 俠侾 NULL NULL SELECT * FROM `俿俈b` RIGHT JOIN `俿俈a` USING (`俠侾`); -俠侾 俠侾 - -NULL -NULL +俠侾 + + + SELECT * FROM `俿俈b` RIGHT JOIN `俿俈a` ON (`俿俈a`.`俠侾` = `俿俈b`.`俠侾`); 俠侾 俠侾 @@ -358,31 +358,31 @@ SELECT * FROM ` 偐 偁 偝 偁 SELECT * FROM `俿俉a` JOIN `俿俉b` USING (`俠侾`); -俠侾 俠侾 -偁 偁 +俠侾 +偁 SELECT * FROM `俿俉a` INNER JOIN `俿俉b` USING (`俠侾`); -俠侾 俠侾 -偁 偁 +俠侾 +偁 SELECT * FROM `俿俉a` CROSS JOIN `俿俉b`; 俠侾 俠侾 偁 偁 偐 偁 偝 偁 SELECT * FROM `俿俉a` LEFT JOIN `俿俉b` USING (`俠侾`); -俠侾 俠侾 -偁 偁 -偐 NULL -偝 NULL +俠侾 +偁 +偐 +偝 SELECT * FROM `俿俉a` LEFT JOIN `俿俉b` ON (`俿俉a`.`俠侾` = `俿俉b`.`俠侾`); 俠侾 俠侾 偁 偁 偐 NULL 偝 NULL SELECT * FROM `俿俉b` RIGHT JOIN `俿俉a` USING (`俠侾`); -俠侾 俠侾 -偁 偁 -NULL 偐 -NULL 偝 +俠侾 +偁 +偐 +偝 SELECT * FROM `俿俉b` RIGHT JOIN `俿俉a` ON (`俿俉a`.`俠侾` = `俿俉b`.`俠侾`); 俠侾 俠侾 偁 偁 @@ -399,31 +399,31 @@ SELECT * FROM ` 廫 僜 昞 僜 SELECT * FROM `俿俋a` JOIN `俿俋b` USING (`俠侾`); -俠侾 俠侾 -僜 僜 +俠侾 +僜 SELECT * FROM `俿俋a` INNER JOIN `俿俋b` USING (`俠侾`); -俠侾 俠侾 -僜 僜 +俠侾 +僜 SELECT * FROM `俿俋a` CROSS JOIN `俿俋b`; 俠侾 俠侾 僜 僜 廫 僜 昞 僜 SELECT * FROM `俿俋a` LEFT JOIN `俿俋b` USING (`俠侾`); -俠侾 俠侾 -僜 僜 -廫 NULL -昞 NULL +俠侾 +僜 +廫 +昞 SELECT * FROM `俿俋a` LEFT JOIN `俿俋b` ON (`俿俋a`.`俠侾` = `俿俋b`.`俠侾`); 俠侾 俠侾 僜 僜 廫 NULL 昞 NULL SELECT * FROM `俿俋b` RIGHT JOIN `俿俋a` USING (`俠侾`); -俠侾 俠侾 -僜 僜 -NULL 廫 -NULL 昞 +俠侾 +僜 +廫 +昞 SELECT * FROM `俿俋b` RIGHT JOIN `俿俋a` ON (`俿俋a`.`俠侾` = `俿俋b`.`俠侾`); 俠侾 俠侾 僜 僜 @@ -440,31 +440,31 @@ SELECT * FROM ` SELECT * FROM `俿侾侽a` JOIN `俿侾侽b` USING (`俠侾`); -俠侾 俠侾 - +俠侾 + SELECT * FROM `俿侾侽a` INNER JOIN `俿侾侽b` USING (`俠侾`); -俠侾 俠侾 - +俠侾 + SELECT * FROM `俿侾侽a` CROSS JOIN `俿侾侽b`; 俠侾 俠侾 SELECT * FROM `俿侾侽a` LEFT JOIN `俿侾侽b` USING (`俠侾`); -俠侾 俠侾 - - NULL - NULL +俠侾 + + + SELECT * FROM `俿侾侽a` LEFT JOIN `俿侾侽b` ON (`俿侾侽a`.`俠侾` = `俿侾侽b`.`俠侾`); 俠侾 俠侾 NULL NULL SELECT * FROM `俿侾侽b` RIGHT JOIN `俿侾侽a` USING (`俠侾`); -俠侾 俠侾 - -NULL -NULL +俠侾 + + + SELECT * FROM `俿侾侽b` RIGHT JOIN `俿侾侽a` ON (`俿侾侽a`.`俠侾` = `俿侾侽b`.`俠侾`); 俠侾 俠侾 @@ -481,31 +481,31 @@ SELECT * FROM ` 偐 偁 偝 偁 SELECT * FROM `俿侾侾a` JOIN `俿侾侾b` USING (`俠侾`); -俠侾 俠侾 -偁 偁 +俠侾 +偁 SELECT * FROM `俿侾侾a` INNER JOIN `俿侾侾b` USING (`俠侾`); -俠侾 俠侾 -偁 偁 +俠侾 +偁 SELECT * FROM `俿侾侾a` CROSS JOIN `俿侾侾b`; 俠侾 俠侾 偁 偁 偐 偁 偝 偁 SELECT * FROM `俿侾侾a` LEFT JOIN `俿侾侾b` USING (`俠侾`); -俠侾 俠侾 -偁 偁 -偐 NULL -偝 NULL +俠侾 +偁 +偐 +偝 SELECT * FROM `俿侾侾a` LEFT JOIN `俿侾侾b` ON (`俿侾侾a`.`俠侾` = `俿侾侾b`.`俠侾`); 俠侾 俠侾 偁 偁 偐 NULL 偝 NULL SELECT * FROM `俿侾侾b` RIGHT JOIN `俿侾侾a` USING (`俠侾`); -俠侾 俠侾 -偁 偁 -NULL 偐 -NULL 偝 +俠侾 +偁 +偐 +偝 SELECT * FROM `俿侾侾b` RIGHT JOIN `俿侾侾a` ON (`俿侾侾a`.`俠侾` = `俿侾侾b`.`俠侾`); 俠侾 俠侾 偁 偁 @@ -522,31 +522,31 @@ SELECT * FROM ` 廫 僜 昞 僜 SELECT * FROM `俿侾俀a` JOIN `俿侾俀b` USING (`俠侾`); -俠侾 俠侾 -僜 僜 +俠侾 +僜 SELECT * FROM `俿侾俀a` INNER JOIN `俿侾俀b` USING (`俠侾`); -俠侾 俠侾 -僜 僜 +俠侾 +僜 SELECT * FROM `俿侾俀a` CROSS JOIN `俿侾俀b`; 俠侾 俠侾 僜 僜 廫 僜 昞 僜 SELECT * FROM `俿侾俀a` LEFT JOIN `俿侾俀b` USING (`俠侾`); -俠侾 俠侾 -僜 僜 -廫 NULL -昞 NULL +俠侾 +僜 +廫 +昞 SELECT * FROM `俿侾俀a` LEFT JOIN `俿侾俀b` ON (`俿侾俀a`.`俠侾` = `俿侾俀b`.`俠侾`); 俠侾 俠侾 僜 僜 廫 NULL 昞 NULL SELECT * FROM `俿侾俀b` RIGHT JOIN `俿侾俀a` USING (`俠侾`); -俠侾 俠侾 -僜 僜 -NULL 廫 -NULL 昞 +俠侾 +僜 +廫 +昞 SELECT * FROM `俿侾俀b` RIGHT JOIN `俿侾俀a` ON (`俿侾俀a`.`俠侾` = `俿侾俀b`.`俠侾`); 俠侾 俠侾 僜 僜 diff --git a/mysql-test/suite/jp/r/jp_join_ucs2.result b/mysql-test/suite/jp/r/jp_join_ucs2.result index 76988f15cc4..ac19554eb5a 100644 --- a/mysql-test/suite/jp/r/jp_join_ucs2.result +++ b/mysql-test/suite/jp/r/jp_join_ucs2.result @@ -72,31 +72,31 @@ SELECT * FROM ` 幎 幈 幓 幈 SELECT * FROM `T1a` JOIN `T1b` USING (`C1`); -C1 C1 -幈 幈 +C1 +幈 SELECT * FROM `T1a` INNER JOIN `T1b` USING (`C1`); -C1 C1 -幈 幈 +C1 +幈 SELECT * FROM `T1a` CROSS JOIN `T1b`; C1 C1 幈 幈 幎 幈 幓 幈 SELECT * FROM `T1a` LEFT JOIN `T1b` USING (`C1`); -C1 C1 -幈 幈 -幎 NULL -幓 NULL +C1 +幈 +幎 +幓 SELECT * FROM `T1a` LEFT JOIN `T1b` ON (`T1a`.`C1` = `T1b`.`C1`); C1 C1 幈 幈 幎 NULL 幓 NULL SELECT * FROM `T1b` RIGHT JOIN `T1a` USING (`C1`); -C1 C1 -幈 幈 -NULL 幎 -NULL 幓 +C1 +幈 +幎 +幓 SELECT * FROM `T1b` RIGHT JOIN `T1a` ON (`T1a`.`C1` = `T1b`.`C1`); C1 C1 幈 幈 @@ -113,31 +113,31 @@ SELECT * FROM ` か あ さ あ SELECT * FROM `T2a` JOIN `T2b` USING (`C1`); -C1 C1 -あ あ +C1 +あ SELECT * FROM `T2a` INNER JOIN `T2b` USING (`C1`); -C1 C1 -あ あ +C1 +あ SELECT * FROM `T2a` CROSS JOIN `T2b`; C1 C1 あ あ か あ さ あ SELECT * FROM `T2a` LEFT JOIN `T2b` USING (`C1`); -C1 C1 -あ あ -か NULL -さ NULL +C1 +あ +か +さ SELECT * FROM `T2a` LEFT JOIN `T2b` ON (`T2a`.`C1` = `T2b`.`C1`); C1 C1 あ あ か NULL さ NULL SELECT * FROM `T2b` RIGHT JOIN `T2a` USING (`C1`); -C1 C1 -あ あ -NULL か -NULL さ +C1 +あ +か +さ SELECT * FROM `T2b` RIGHT JOIN `T2a` ON (`T2a`.`C1` = `T2b`.`C1`); C1 C1 あ あ @@ -154,31 +154,31 @@ SELECT * FROM ` 忢 忢 忢 忢 SELECT * FROM `T3a` JOIN `T3b` USING (`C1`); -C1 C1 -忢 忢 +C1 +忢 SELECT * FROM `T3a` INNER JOIN `T3b` USING (`C1`); -C1 C1 -忢 忢 +C1 +忢 SELECT * FROM `T3a` CROSS JOIN `T3b`; C1 C1 忢 忢 忢 忢 忢 忢 SELECT * FROM `T3a` LEFT JOIN `T3b` USING (`C1`); -C1 C1 -忢 忢 -忢 NULL -忢 NULL +C1 +忢 +忢 +忢 SELECT * FROM `T3a` LEFT JOIN `T3b` ON (`T3a`.`C1` = `T3b`.`C1`); C1 C1 忢 忢 忢 NULL 忢 NULL SELECT * FROM `T3b` RIGHT JOIN `T3a` USING (`C1`); -C1 C1 -忢 忢 -NULL 忢 -NULL 忢 +C1 +忢 +忢 +忢 SELECT * FROM `T3b` RIGHT JOIN `T3a` ON (`T3a`.`C1` = `T3b`.`C1`); C1 C1 忢 忢 @@ -195,31 +195,31 @@ SELECT * FROM ` 幎 幈 幓 幈 SELECT * FROM `T4a` JOIN `T4b` USING (`C1`); -C1 C1 -幈 幈 +C1 +幈 SELECT * FROM `T4a` INNER JOIN `T4b` USING (`C1`); -C1 C1 -幈 幈 +C1 +幈 SELECT * FROM `T4a` CROSS JOIN `T4b`; C1 C1 幈 幈 幎 幈 幓 幈 SELECT * FROM `T4a` LEFT JOIN `T4b` USING (`C1`); -C1 C1 -幈 幈 -幎 NULL -幓 NULL +C1 +幈 +幎 +幓 SELECT * FROM `T4a` LEFT JOIN `T4b` ON (`T4a`.`C1` = `T4b`.`C1`); C1 C1 幈 幈 幎 NULL 幓 NULL SELECT * FROM `T4b` RIGHT JOIN `T4a` USING (`C1`); -C1 C1 -幈 幈 -NULL 幎 -NULL 幓 +C1 +幈 +幎 +幓 SELECT * FROM `T4b` RIGHT JOIN `T4a` ON (`T4a`.`C1` = `T4b`.`C1`); C1 C1 幈 幈 @@ -236,31 +236,31 @@ SELECT * FROM ` か あ さ あ SELECT * FROM `T5a` JOIN `T5b` USING (`C1`); -C1 C1 -あ あ +C1 +あ SELECT * FROM `T5a` INNER JOIN `T5b` USING (`C1`); -C1 C1 -あ あ +C1 +あ SELECT * FROM `T5a` CROSS JOIN `T5b`; C1 C1 あ あ か あ さ あ SELECT * FROM `T5a` LEFT JOIN `T5b` USING (`C1`); -C1 C1 -あ あ -か NULL -さ NULL +C1 +あ +か +さ SELECT * FROM `T5a` LEFT JOIN `T5b` ON (`T5a`.`C1` = `T5b`.`C1`); C1 C1 あ あ か NULL さ NULL SELECT * FROM `T5b` RIGHT JOIN `T5a` USING (`C1`); -C1 C1 -あ あ -NULL か -NULL さ +C1 +あ +か +さ SELECT * FROM `T5b` RIGHT JOIN `T5a` ON (`T5a`.`C1` = `T5b`.`C1`); C1 C1 あ あ @@ -277,31 +277,31 @@ SELECT * FROM ` 忢 忢 忢 忢 SELECT * FROM `T6a` JOIN `T6b` USING (`C1`); -C1 C1 -忢 忢 +C1 +忢 SELECT * FROM `T6a` INNER JOIN `T6b` USING (`C1`); -C1 C1 -忢 忢 +C1 +忢 SELECT * FROM `T6a` CROSS JOIN `T6b`; C1 C1 忢 忢 忢 忢 忢 忢 SELECT * FROM `T6a` LEFT JOIN `T6b` USING (`C1`); -C1 C1 -忢 忢 -忢 NULL -忢 NULL +C1 +忢 +忢 +忢 SELECT * FROM `T6a` LEFT JOIN `T6b` ON (`T6a`.`C1` = `T6b`.`C1`); C1 C1 忢 忢 忢 NULL 忢 NULL SELECT * FROM `T6b` RIGHT JOIN `T6a` USING (`C1`); -C1 C1 -忢 忢 -NULL 忢 -NULL 忢 +C1 +忢 +忢 +忢 SELECT * FROM `T6b` RIGHT JOIN `T6a` ON (`T6a`.`C1` = `T6b`.`C1`); C1 C1 忢 忢 @@ -318,31 +318,31 @@ SELECT * FROM ` 幎 幈 幓 幈 SELECT * FROM `T7a` JOIN `T7b` USING (`C1`); -C1 C1 -幈 幈 +C1 +幈 SELECT * FROM `T7a` INNER JOIN `T7b` USING (`C1`); -C1 C1 -幈 幈 +C1 +幈 SELECT * FROM `T7a` CROSS JOIN `T7b`; C1 C1 幈 幈 幎 幈 幓 幈 SELECT * FROM `T7a` LEFT JOIN `T7b` USING (`C1`); -C1 C1 -幈 幈 -幎 NULL -幓 NULL +C1 +幈 +幎 +幓 SELECT * FROM `T7a` LEFT JOIN `T7b` ON (`T7a`.`C1` = `T7b`.`C1`); C1 C1 幈 幈 幎 NULL 幓 NULL SELECT * FROM `T7b` RIGHT JOIN `T7a` USING (`C1`); -C1 C1 -幈 幈 -NULL 幎 -NULL 幓 +C1 +幈 +幎 +幓 SELECT * FROM `T7b` RIGHT JOIN `T7a` ON (`T7a`.`C1` = `T7b`.`C1`); C1 C1 幈 幈 @@ -359,31 +359,31 @@ SELECT * FROM ` か あ さ あ SELECT * FROM `T8a` JOIN `T8b` USING (`C1`); -C1 C1 -あ あ +C1 +あ SELECT * FROM `T8a` INNER JOIN `T8b` USING (`C1`); -C1 C1 -あ あ +C1 +あ SELECT * FROM `T8a` CROSS JOIN `T8b`; C1 C1 あ あ か あ さ あ SELECT * FROM `T8a` LEFT JOIN `T8b` USING (`C1`); -C1 C1 -あ あ -か NULL -さ NULL +C1 +あ +か +さ SELECT * FROM `T8a` LEFT JOIN `T8b` ON (`T8a`.`C1` = `T8b`.`C1`); C1 C1 あ あ か NULL さ NULL SELECT * FROM `T8b` RIGHT JOIN `T8a` USING (`C1`); -C1 C1 -あ あ -NULL か -NULL さ +C1 +あ +か +さ SELECT * FROM `T8b` RIGHT JOIN `T8a` ON (`T8a`.`C1` = `T8b`.`C1`); C1 C1 あ あ @@ -400,31 +400,31 @@ SELECT * FROM ` 忢 忢 忢 忢 SELECT * FROM `T9a` JOIN `T9b` USING (`C1`); -C1 C1 -忢 忢 +C1 +忢 SELECT * FROM `T9a` INNER JOIN `T9b` USING (`C1`); -C1 C1 -忢 忢 +C1 +忢 SELECT * FROM `T9a` CROSS JOIN `T9b`; C1 C1 忢 忢 忢 忢 忢 忢 SELECT * FROM `T9a` LEFT JOIN `T9b` USING (`C1`); -C1 C1 -忢 忢 -忢 NULL -忢 NULL +C1 +忢 +忢 +忢 SELECT * FROM `T9a` LEFT JOIN `T9b` ON (`T9a`.`C1` = `T9b`.`C1`); C1 C1 忢 忢 忢 NULL 忢 NULL SELECT * FROM `T9b` RIGHT JOIN `T9a` USING (`C1`); -C1 C1 -忢 忢 -NULL 忢 -NULL 忢 +C1 +忢 +忢 +忢 SELECT * FROM `T9b` RIGHT JOIN `T9a` ON (`T9a`.`C1` = `T9b`.`C1`); C1 C1 忢 忢 @@ -441,31 +441,31 @@ SELECT * FROM ` 幎 幈 幓 幈 SELECT * FROM `T10a` JOIN `T10b` USING (`C1`); -C1 C1 -幈 幈 +C1 +幈 SELECT * FROM `T10a` INNER JOIN `T10b` USING (`C1`); -C1 C1 -幈 幈 +C1 +幈 SELECT * FROM `T10a` CROSS JOIN `T10b`; C1 C1 幈 幈 幎 幈 幓 幈 SELECT * FROM `T10a` LEFT JOIN `T10b` USING (`C1`); -C1 C1 -幈 幈 -幎 NULL -幓 NULL +C1 +幈 +幎 +幓 SELECT * FROM `T10a` LEFT JOIN `T10b` ON (`T10a`.`C1` = `T10b`.`C1`); C1 C1 幈 幈 幎 NULL 幓 NULL SELECT * FROM `T10b` RIGHT JOIN `T10a` USING (`C1`); -C1 C1 -幈 幈 -NULL 幎 -NULL 幓 +C1 +幈 +幎 +幓 SELECT * FROM `T10b` RIGHT JOIN `T10a` ON (`T10a`.`C1` = `T10b`.`C1`); C1 C1 幈 幈 @@ -482,31 +482,31 @@ SELECT * FROM ` か あ さ あ SELECT * FROM `T11a` JOIN `T11b` USING (`C1`); -C1 C1 -あ あ +C1 +あ SELECT * FROM `T11a` INNER JOIN `T11b` USING (`C1`); -C1 C1 -あ あ +C1 +あ SELECT * FROM `T11a` CROSS JOIN `T11b`; C1 C1 あ あ か あ さ あ SELECT * FROM `T11a` LEFT JOIN `T11b` USING (`C1`); -C1 C1 -あ あ -か NULL -さ NULL +C1 +あ +か +さ SELECT * FROM `T11a` LEFT JOIN `T11b` ON (`T11a`.`C1` = `T11b`.`C1`); C1 C1 あ あ か NULL さ NULL SELECT * FROM `T11b` RIGHT JOIN `T11a` USING (`C1`); -C1 C1 -あ あ -NULL か -NULL さ +C1 +あ +か +さ SELECT * FROM `T11b` RIGHT JOIN `T11a` ON (`T11a`.`C1` = `T11b`.`C1`); C1 C1 あ あ @@ -523,31 +523,31 @@ SELECT * FROM ` 忢 忢 忢 忢 SELECT * FROM `T12a` JOIN `T12b` USING (`C1`); -C1 C1 -忢 忢 +C1 +忢 SELECT * FROM `T12a` INNER JOIN `T12b` USING (`C1`); -C1 C1 -忢 忢 +C1 +忢 SELECT * FROM `T12a` CROSS JOIN `T12b`; C1 C1 忢 忢 忢 忢 忢 忢 SELECT * FROM `T12a` LEFT JOIN `T12b` USING (`C1`); -C1 C1 -忢 忢 -忢 NULL -忢 NULL +C1 +忢 +忢 +忢 SELECT * FROM `T12a` LEFT JOIN `T12b` ON (`T12a`.`C1` = `T12b`.`C1`); C1 C1 忢 忢 忢 NULL 忢 NULL SELECT * FROM `T12b` RIGHT JOIN `T12a` USING (`C1`); -C1 C1 -忢 忢 -NULL 忢 -NULL 忢 +C1 +忢 +忢 +忢 SELECT * FROM `T12b` RIGHT JOIN `T12a` ON (`T12a`.`C1` = `T12b`.`C1`); C1 C1 忢 忢 diff --git a/mysql-test/suite/jp/r/jp_join_ujis.result b/mysql-test/suite/jp/r/jp_join_ujis.result index ac430cd9b5e..838d701cdcc 100644 --- a/mysql-test/suite/jp/r/jp_join_ujis.result +++ b/mysql-test/suite/jp/r/jp_join_ujis.result @@ -71,31 +71,31 @@ SELECT * FROM ` 幎 幈 幓 幈 SELECT * FROM `T1a` JOIN `T1b` USING (`C1`); -C1 C1 -幈 幈 +C1 +幈 SELECT * FROM `T1a` INNER JOIN `T1b` USING (`C1`); -C1 C1 -幈 幈 +C1 +幈 SELECT * FROM `T1a` CROSS JOIN `T1b`; C1 C1 幈 幈 幎 幈 幓 幈 SELECT * FROM `T1a` LEFT JOIN `T1b` USING (`C1`); -C1 C1 -幈 幈 -幎 NULL -幓 NULL +C1 +幈 +幎 +幓 SELECT * FROM `T1a` LEFT JOIN `T1b` ON (`T1a`.`C1` = `T1b`.`C1`); C1 C1 幈 幈 幎 NULL 幓 NULL SELECT * FROM `T1b` RIGHT JOIN `T1a` USING (`C1`); -C1 C1 -幈 幈 -NULL 幎 -NULL 幓 +C1 +幈 +幎 +幓 SELECT * FROM `T1b` RIGHT JOIN `T1a` ON (`T1a`.`C1` = `T1b`.`C1`); C1 C1 幈 幈 @@ -112,31 +112,31 @@ SELECT * FROM ` か あ さ あ SELECT * FROM `T2a` JOIN `T2b` USING (`C1`); -C1 C1 -あ あ +C1 +あ SELECT * FROM `T2a` INNER JOIN `T2b` USING (`C1`); -C1 C1 -あ あ +C1 +あ SELECT * FROM `T2a` CROSS JOIN `T2b`; C1 C1 あ あ か あ さ あ SELECT * FROM `T2a` LEFT JOIN `T2b` USING (`C1`); -C1 C1 -あ あ -か NULL -さ NULL +C1 +あ +か +さ SELECT * FROM `T2a` LEFT JOIN `T2b` ON (`T2a`.`C1` = `T2b`.`C1`); C1 C1 あ あ か NULL さ NULL SELECT * FROM `T2b` RIGHT JOIN `T2a` USING (`C1`); -C1 C1 -あ あ -NULL か -NULL さ +C1 +あ +か +さ SELECT * FROM `T2b` RIGHT JOIN `T2a` ON (`T2a`.`C1` = `T2b`.`C1`); C1 C1 あ あ @@ -153,31 +153,31 @@ SELECT * FROM ` 忢 忢 忢 忢 SELECT * FROM `T3a` JOIN `T3b` USING (`C1`); -C1 C1 -忢 忢 +C1 +忢 SELECT * FROM `T3a` INNER JOIN `T3b` USING (`C1`); -C1 C1 -忢 忢 +C1 +忢 SELECT * FROM `T3a` CROSS JOIN `T3b`; C1 C1 忢 忢 忢 忢 忢 忢 SELECT * FROM `T3a` LEFT JOIN `T3b` USING (`C1`); -C1 C1 -忢 忢 -忢 NULL -忢 NULL +C1 +忢 +忢 +忢 SELECT * FROM `T3a` LEFT JOIN `T3b` ON (`T3a`.`C1` = `T3b`.`C1`); C1 C1 忢 忢 忢 NULL 忢 NULL SELECT * FROM `T3b` RIGHT JOIN `T3a` USING (`C1`); -C1 C1 -忢 忢 -NULL 忢 -NULL 忢 +C1 +忢 +忢 +忢 SELECT * FROM `T3b` RIGHT JOIN `T3a` ON (`T3a`.`C1` = `T3b`.`C1`); C1 C1 忢 忢 @@ -194,31 +194,31 @@ SELECT * FROM ` 幎 幈 幓 幈 SELECT * FROM `T4a` JOIN `T4b` USING (`C1`); -C1 C1 -幈 幈 +C1 +幈 SELECT * FROM `T4a` INNER JOIN `T4b` USING (`C1`); -C1 C1 -幈 幈 +C1 +幈 SELECT * FROM `T4a` CROSS JOIN `T4b`; C1 C1 幈 幈 幎 幈 幓 幈 SELECT * FROM `T4a` LEFT JOIN `T4b` USING (`C1`); -C1 C1 -幈 幈 -幎 NULL -幓 NULL +C1 +幈 +幎 +幓 SELECT * FROM `T4a` LEFT JOIN `T4b` ON (`T4a`.`C1` = `T4b`.`C1`); C1 C1 幈 幈 幎 NULL 幓 NULL SELECT * FROM `T4b` RIGHT JOIN `T4a` USING (`C1`); -C1 C1 -幈 幈 -NULL 幎 -NULL 幓 +C1 +幈 +幎 +幓 SELECT * FROM `T4b` RIGHT JOIN `T4a` ON (`T4a`.`C1` = `T4b`.`C1`); C1 C1 幈 幈 @@ -235,31 +235,31 @@ SELECT * FROM ` か あ さ あ SELECT * FROM `T5a` JOIN `T5b` USING (`C1`); -C1 C1 -あ あ +C1 +あ SELECT * FROM `T5a` INNER JOIN `T5b` USING (`C1`); -C1 C1 -あ あ +C1 +あ SELECT * FROM `T5a` CROSS JOIN `T5b`; C1 C1 あ あ か あ さ あ SELECT * FROM `T5a` LEFT JOIN `T5b` USING (`C1`); -C1 C1 -あ あ -か NULL -さ NULL +C1 +あ +か +さ SELECT * FROM `T5a` LEFT JOIN `T5b` ON (`T5a`.`C1` = `T5b`.`C1`); C1 C1 あ あ か NULL さ NULL SELECT * FROM `T5b` RIGHT JOIN `T5a` USING (`C1`); -C1 C1 -あ あ -NULL か -NULL さ +C1 +あ +か +さ SELECT * FROM `T5b` RIGHT JOIN `T5a` ON (`T5a`.`C1` = `T5b`.`C1`); C1 C1 あ あ @@ -276,31 +276,31 @@ SELECT * FROM ` 忢 忢 忢 忢 SELECT * FROM `T6a` JOIN `T6b` USING (`C1`); -C1 C1 -忢 忢 +C1 +忢 SELECT * FROM `T6a` INNER JOIN `T6b` USING (`C1`); -C1 C1 -忢 忢 +C1 +忢 SELECT * FROM `T6a` CROSS JOIN `T6b`; C1 C1 忢 忢 忢 忢 忢 忢 SELECT * FROM `T6a` LEFT JOIN `T6b` USING (`C1`); -C1 C1 -忢 忢 -忢 NULL -忢 NULL +C1 +忢 +忢 +忢 SELECT * FROM `T6a` LEFT JOIN `T6b` ON (`T6a`.`C1` = `T6b`.`C1`); C1 C1 忢 忢 忢 NULL 忢 NULL SELECT * FROM `T6b` RIGHT JOIN `T6a` USING (`C1`); -C1 C1 -忢 忢 -NULL 忢 -NULL 忢 +C1 +忢 +忢 +忢 SELECT * FROM `T6b` RIGHT JOIN `T6a` ON (`T6a`.`C1` = `T6b`.`C1`); C1 C1 忢 忢 @@ -317,31 +317,31 @@ SELECT * FROM ` 幎 幈 幓 幈 SELECT * FROM `T7a` JOIN `T7b` USING (`C1`); -C1 C1 -幈 幈 +C1 +幈 SELECT * FROM `T7a` INNER JOIN `T7b` USING (`C1`); -C1 C1 -幈 幈 +C1 +幈 SELECT * FROM `T7a` CROSS JOIN `T7b`; C1 C1 幈 幈 幎 幈 幓 幈 SELECT * FROM `T7a` LEFT JOIN `T7b` USING (`C1`); -C1 C1 -幈 幈 -幎 NULL -幓 NULL +C1 +幈 +幎 +幓 SELECT * FROM `T7a` LEFT JOIN `T7b` ON (`T7a`.`C1` = `T7b`.`C1`); C1 C1 幈 幈 幎 NULL 幓 NULL SELECT * FROM `T7b` RIGHT JOIN `T7a` USING (`C1`); -C1 C1 -幈 幈 -NULL 幎 -NULL 幓 +C1 +幈 +幎 +幓 SELECT * FROM `T7b` RIGHT JOIN `T7a` ON (`T7a`.`C1` = `T7b`.`C1`); C1 C1 幈 幈 @@ -358,31 +358,31 @@ SELECT * FROM ` か あ さ あ SELECT * FROM `T8a` JOIN `T8b` USING (`C1`); -C1 C1 -あ あ +C1 +あ SELECT * FROM `T8a` INNER JOIN `T8b` USING (`C1`); -C1 C1 -あ あ +C1 +あ SELECT * FROM `T8a` CROSS JOIN `T8b`; C1 C1 あ あ か あ さ あ SELECT * FROM `T8a` LEFT JOIN `T8b` USING (`C1`); -C1 C1 -あ あ -か NULL -さ NULL +C1 +あ +か +さ SELECT * FROM `T8a` LEFT JOIN `T8b` ON (`T8a`.`C1` = `T8b`.`C1`); C1 C1 あ あ か NULL さ NULL SELECT * FROM `T8b` RIGHT JOIN `T8a` USING (`C1`); -C1 C1 -あ あ -NULL か -NULL さ +C1 +あ +か +さ SELECT * FROM `T8b` RIGHT JOIN `T8a` ON (`T8a`.`C1` = `T8b`.`C1`); C1 C1 あ あ @@ -399,31 +399,31 @@ SELECT * FROM ` 忢 忢 忢 忢 SELECT * FROM `T9a` JOIN `T9b` USING (`C1`); -C1 C1 -忢 忢 +C1 +忢 SELECT * FROM `T9a` INNER JOIN `T9b` USING (`C1`); -C1 C1 -忢 忢 +C1 +忢 SELECT * FROM `T9a` CROSS JOIN `T9b`; C1 C1 忢 忢 忢 忢 忢 忢 SELECT * FROM `T9a` LEFT JOIN `T9b` USING (`C1`); -C1 C1 -忢 忢 -忢 NULL -忢 NULL +C1 +忢 +忢 +忢 SELECT * FROM `T9a` LEFT JOIN `T9b` ON (`T9a`.`C1` = `T9b`.`C1`); C1 C1 忢 忢 忢 NULL 忢 NULL SELECT * FROM `T9b` RIGHT JOIN `T9a` USING (`C1`); -C1 C1 -忢 忢 -NULL 忢 -NULL 忢 +C1 +忢 +忢 +忢 SELECT * FROM `T9b` RIGHT JOIN `T9a` ON (`T9a`.`C1` = `T9b`.`C1`); C1 C1 忢 忢 @@ -440,31 +440,31 @@ SELECT * FROM ` 幎 幈 幓 幈 SELECT * FROM `T10a` JOIN `T10b` USING (`C1`); -C1 C1 -幈 幈 +C1 +幈 SELECT * FROM `T10a` INNER JOIN `T10b` USING (`C1`); -C1 C1 -幈 幈 +C1 +幈 SELECT * FROM `T10a` CROSS JOIN `T10b`; C1 C1 幈 幈 幎 幈 幓 幈 SELECT * FROM `T10a` LEFT JOIN `T10b` USING (`C1`); -C1 C1 -幈 幈 -幎 NULL -幓 NULL +C1 +幈 +幎 +幓 SELECT * FROM `T10a` LEFT JOIN `T10b` ON (`T10a`.`C1` = `T10b`.`C1`); C1 C1 幈 幈 幎 NULL 幓 NULL SELECT * FROM `T10b` RIGHT JOIN `T10a` USING (`C1`); -C1 C1 -幈 幈 -NULL 幎 -NULL 幓 +C1 +幈 +幎 +幓 SELECT * FROM `T10b` RIGHT JOIN `T10a` ON (`T10a`.`C1` = `T10b`.`C1`); C1 C1 幈 幈 @@ -481,31 +481,31 @@ SELECT * FROM ` か あ さ あ SELECT * FROM `T11a` JOIN `T11b` USING (`C1`); -C1 C1 -あ あ +C1 +あ SELECT * FROM `T11a` INNER JOIN `T11b` USING (`C1`); -C1 C1 -あ あ +C1 +あ SELECT * FROM `T11a` CROSS JOIN `T11b`; C1 C1 あ あ か あ さ あ SELECT * FROM `T11a` LEFT JOIN `T11b` USING (`C1`); -C1 C1 -あ あ -か NULL -さ NULL +C1 +あ +か +さ SELECT * FROM `T11a` LEFT JOIN `T11b` ON (`T11a`.`C1` = `T11b`.`C1`); C1 C1 あ あ か NULL さ NULL SELECT * FROM `T11b` RIGHT JOIN `T11a` USING (`C1`); -C1 C1 -あ あ -NULL か -NULL さ +C1 +あ +か +さ SELECT * FROM `T11b` RIGHT JOIN `T11a` ON (`T11a`.`C1` = `T11b`.`C1`); C1 C1 あ あ @@ -522,31 +522,31 @@ SELECT * FROM ` 忢 忢 忢 忢 SELECT * FROM `T12a` JOIN `T12b` USING (`C1`); -C1 C1 -忢 忢 +C1 +忢 SELECT * FROM `T12a` INNER JOIN `T12b` USING (`C1`); -C1 C1 -忢 忢 +C1 +忢 SELECT * FROM `T12a` CROSS JOIN `T12b`; C1 C1 忢 忢 忢 忢 忢 忢 SELECT * FROM `T12a` LEFT JOIN `T12b` USING (`C1`); -C1 C1 -忢 忢 -忢 NULL -忢 NULL +C1 +忢 +忢 +忢 SELECT * FROM `T12a` LEFT JOIN `T12b` ON (`T12a`.`C1` = `T12b`.`C1`); C1 C1 忢 忢 忢 NULL 忢 NULL SELECT * FROM `T12b` RIGHT JOIN `T12a` USING (`C1`); -C1 C1 -忢 忢 -NULL 忢 -NULL 忢 +C1 +忢 +忢 +忢 SELECT * FROM `T12b` RIGHT JOIN `T12a` ON (`T12a`.`C1` = `T12b`.`C1`); C1 C1 忢 忢 diff --git a/mysql-test/suite/jp/r/jp_join_utf8.result b/mysql-test/suite/jp/r/jp_join_utf8.result index 716e97a2bb3..8c222653c3e 100644 --- a/mysql-test/suite/jp/r/jp_join_utf8.result +++ b/mysql-test/suite/jp/r/jp_join_utf8.result @@ -71,31 +71,31 @@ SELECT * FROM `锛达紤a` INNER JOIN `锛达紤b`; 锝 锝 锝 锝 SELECT * FROM `锛达紤a` JOIN `锛达紤b` USING (`锛o紤`); -锛o紤 锛o紤 -锝 锝 +锛o紤 +锝 SELECT * FROM `锛达紤a` INNER JOIN `锛达紤b` USING (`锛o紤`); -锛o紤 锛o紤 -锝 锝 +锛o紤 +锝 SELECT * FROM `锛达紤a` CROSS JOIN `锛达紤b`; 锛o紤 锛o紤 锝 锝 锝 锝 锝 锝 SELECT * FROM `锛达紤a` LEFT JOIN `锛达紤b` USING (`锛o紤`); -锛o紤 锛o紤 -锝 锝 -锝 NULL -锝 NULL +锛o紤 +锝 +锝 +锝 SELECT * FROM `锛达紤a` LEFT JOIN `锛达紤b` ON (`锛达紤a`.`锛o紤` = `锛达紤b`.`锛o紤`); 锛o紤 锛o紤 锝 锝 锝 NULL 锝 NULL SELECT * FROM `锛达紤b` RIGHT JOIN `锛达紤a` USING (`锛o紤`); -锛o紤 锛o紤 -锝 锝 -NULL 锝 -NULL 锝 +锛o紤 +锝 +锝 +锝 SELECT * FROM `锛达紤b` RIGHT JOIN `锛达紤a` ON (`锛达紤a`.`锛o紤` = `锛达紤b`.`锛o紤`); 锛o紤 锛o紤 锝 锝 @@ -112,31 +112,31 @@ SELECT * FROM `锛达紥a` INNER JOIN `锛达紥b`; 銇 銇 銇 銇 SELECT * FROM `锛达紥a` JOIN `锛达紥b` USING (`锛o紤`); -锛o紤 锛o紤 -銇 銇 +锛o紤 +銇 SELECT * FROM `锛达紥a` INNER JOIN `锛达紥b` USING (`锛o紤`); -锛o紤 锛o紤 -銇 銇 +锛o紤 +銇 SELECT * FROM `锛达紥a` CROSS JOIN `锛达紥b`; 锛o紤 锛o紤 銇 銇 銇 銇 銇 銇 SELECT * FROM `锛达紥a` LEFT JOIN `锛达紥b` USING (`锛o紤`); -锛o紤 锛o紤 -銇 銇 -銇 NULL -銇 NULL +锛o紤 +銇 +銇 +銇 SELECT * FROM `锛达紥a` LEFT JOIN `锛达紥b` ON (`锛达紥a`.`锛o紤` = `锛达紥b`.`锛o紤`); 锛o紤 锛o紤 銇 銇 銇 NULL 銇 NULL SELECT * FROM `锛达紥b` RIGHT JOIN `锛达紥a` USING (`锛o紤`); -锛o紤 锛o紤 -銇 銇 -NULL 銇 -NULL 銇 +锛o紤 +銇 +銇 +銇 SELECT * FROM `锛达紥b` RIGHT JOIN `锛达紥a` ON (`锛达紥a`.`锛o紤` = `锛达紥b`.`锛o紤`); 锛o紤 锛o紤 銇 銇 @@ -153,31 +153,31 @@ SELECT * FROM `锛达紦a` INNER JOIN `锛达紦b`; 榫 榫 榫 榫 SELECT * FROM `锛达紦a` JOIN `锛达紦b` USING (`锛o紤`); -锛o紤 锛o紤 -榫 榫 +锛o紤 +榫 SELECT * FROM `锛达紦a` INNER JOIN `锛达紦b` USING (`锛o紤`); -锛o紤 锛o紤 -榫 榫 +锛o紤 +榫 SELECT * FROM `锛达紦a` CROSS JOIN `锛达紦b`; 锛o紤 锛o紤 榫 榫 榫 榫 榫 榫 SELECT * FROM `锛达紦a` LEFT JOIN `锛达紦b` USING (`锛o紤`); -锛o紤 锛o紤 -榫 榫 -榫 NULL -榫 NULL +锛o紤 +榫 +榫 +榫 SELECT * FROM `锛达紦a` LEFT JOIN `锛达紦b` ON (`锛达紦a`.`锛o紤` = `锛达紦b`.`锛o紤`); 锛o紤 锛o紤 榫 榫 榫 NULL 榫 NULL SELECT * FROM `锛达紦b` RIGHT JOIN `锛达紦a` USING (`锛o紤`); -锛o紤 锛o紤 -榫 榫 -NULL 榫 -NULL 榫 +锛o紤 +榫 +榫 +榫 SELECT * FROM `锛达紦b` RIGHT JOIN `锛达紦a` ON (`锛达紦a`.`锛o紤` = `锛达紦b`.`锛o紤`); 锛o紤 锛o紤 榫 榫 @@ -194,31 +194,31 @@ SELECT * FROM `锛达紨a` INNER JOIN `锛达紨b`; 锝 锝 锝 锝 SELECT * FROM `锛达紨a` JOIN `锛达紨b` USING (`锛o紤`); -锛o紤 锛o紤 -锝 锝 +锛o紤 +锝 SELECT * FROM `锛达紨a` INNER JOIN `锛达紨b` USING (`锛o紤`); -锛o紤 锛o紤 -锝 锝 +锛o紤 +锝 SELECT * FROM `锛达紨a` CROSS JOIN `锛达紨b`; 锛o紤 锛o紤 锝 锝 锝 锝 锝 锝 SELECT * FROM `锛达紨a` LEFT JOIN `锛达紨b` USING (`锛o紤`); -锛o紤 锛o紤 -锝 锝 -锝 NULL -锝 NULL +锛o紤 +锝 +锝 +锝 SELECT * FROM `锛达紨a` LEFT JOIN `锛达紨b` ON (`锛达紨a`.`锛o紤` = `锛达紨b`.`锛o紤`); 锛o紤 锛o紤 锝 锝 锝 NULL 锝 NULL SELECT * FROM `锛达紨b` RIGHT JOIN `锛达紨a` USING (`锛o紤`); -锛o紤 锛o紤 -锝 锝 -NULL 锝 -NULL 锝 +锛o紤 +锝 +锝 +锝 SELECT * FROM `锛达紨b` RIGHT JOIN `锛达紨a` ON (`锛达紨a`.`锛o紤` = `锛达紨b`.`锛o紤`); 锛o紤 锛o紤 锝 锝 @@ -235,31 +235,31 @@ SELECT * FROM `锛达紩a` INNER JOIN `锛达紩b`; 銇 銇 銇 銇 SELECT * FROM `锛达紩a` JOIN `锛达紩b` USING (`锛o紤`); -锛o紤 锛o紤 -銇 銇 +锛o紤 +銇 SELECT * FROM `锛达紩a` INNER JOIN `锛达紩b` USING (`锛o紤`); -锛o紤 锛o紤 -銇 銇 +锛o紤 +銇 SELECT * FROM `锛达紩a` CROSS JOIN `锛达紩b`; 锛o紤 锛o紤 銇 銇 銇 銇 銇 銇 SELECT * FROM `锛达紩a` LEFT JOIN `锛达紩b` USING (`锛o紤`); -锛o紤 锛o紤 -銇 銇 -銇 NULL -銇 NULL +锛o紤 +銇 +銇 +銇 SELECT * FROM `锛达紩a` LEFT JOIN `锛达紩b` ON (`锛达紩a`.`锛o紤` = `锛达紩b`.`锛o紤`); 锛o紤 锛o紤 銇 銇 銇 NULL 銇 NULL SELECT * FROM `锛达紩b` RIGHT JOIN `锛达紩a` USING (`锛o紤`); -锛o紤 锛o紤 -銇 銇 -NULL 銇 -NULL 銇 +锛o紤 +銇 +銇 +銇 SELECT * FROM `锛达紩b` RIGHT JOIN `锛达紩a` ON (`锛达紩a`.`锛o紤` = `锛达紩b`.`锛o紤`); 锛o紤 锛o紤 銇 銇 @@ -276,31 +276,31 @@ SELECT * FROM `锛达紪a` INNER JOIN `锛达紪b`; 榫 榫 榫 榫 SELECT * FROM `锛达紪a` JOIN `锛达紪b` USING (`锛o紤`); -锛o紤 锛o紤 -榫 榫 +锛o紤 +榫 SELECT * FROM `锛达紪a` INNER JOIN `锛达紪b` USING (`锛o紤`); -锛o紤 锛o紤 -榫 榫 +锛o紤 +榫 SELECT * FROM `锛达紪a` CROSS JOIN `锛达紪b`; 锛o紤 锛o紤 榫 榫 榫 榫 榫 榫 SELECT * FROM `锛达紪a` LEFT JOIN `锛达紪b` USING (`锛o紤`); -锛o紤 锛o紤 -榫 榫 -榫 NULL -榫 NULL +锛o紤 +榫 +榫 +榫 SELECT * FROM `锛达紪a` LEFT JOIN `锛达紪b` ON (`锛达紪a`.`锛o紤` = `锛达紪b`.`锛o紤`); 锛o紤 锛o紤 榫 榫 榫 NULL 榫 NULL SELECT * FROM `锛达紪b` RIGHT JOIN `锛达紪a` USING (`锛o紤`); -锛o紤 锛o紤 -榫 榫 -NULL 榫 -NULL 榫 +锛o紤 +榫 +榫 +榫 SELECT * FROM `锛达紪b` RIGHT JOIN `锛达紪a` ON (`锛达紪a`.`锛o紤` = `锛达紪b`.`锛o紤`); 锛o紤 锛o紤 榫 榫 @@ -317,31 +317,31 @@ SELECT * FROM `锛达紬a` INNER JOIN `锛达紬b`; 锝 锝 锝 锝 SELECT * FROM `锛达紬a` JOIN `锛达紬b` USING (`锛o紤`); -锛o紤 锛o紤 -锝 锝 +锛o紤 +锝 SELECT * FROM `锛达紬a` INNER JOIN `锛达紬b` USING (`锛o紤`); -锛o紤 锛o紤 -锝 锝 +锛o紤 +锝 SELECT * FROM `锛达紬a` CROSS JOIN `锛达紬b`; 锛o紤 锛o紤 锝 锝 锝 锝 锝 锝 SELECT * FROM `锛达紬a` LEFT JOIN `锛达紬b` USING (`锛o紤`); -锛o紤 锛o紤 -锝 锝 -锝 NULL -锝 NULL +锛o紤 +锝 +锝 +锝 SELECT * FROM `锛达紬a` LEFT JOIN `锛达紬b` ON (`锛达紬a`.`锛o紤` = `锛达紬b`.`锛o紤`); 锛o紤 锛o紤 锝 锝 锝 NULL 锝 NULL SELECT * FROM `锛达紬b` RIGHT JOIN `锛达紬a` USING (`锛o紤`); -锛o紤 锛o紤 -锝 锝 -NULL 锝 -NULL 锝 +锛o紤 +锝 +锝 +锝 SELECT * FROM `锛达紬b` RIGHT JOIN `锛达紬a` ON (`锛达紬a`.`锛o紤` = `锛达紬b`.`锛o紤`); 锛o紤 锛o紤 锝 锝 @@ -358,31 +358,31 @@ SELECT * FROM `锛达紭a` INNER JOIN `锛达紭b`; 銇 銇 銇 銇 SELECT * FROM `锛达紭a` JOIN `锛达紭b` USING (`锛o紤`); -锛o紤 锛o紤 -銇 銇 +锛o紤 +銇 SELECT * FROM `锛达紭a` INNER JOIN `锛达紭b` USING (`锛o紤`); -锛o紤 锛o紤 -銇 銇 +锛o紤 +銇 SELECT * FROM `锛达紭a` CROSS JOIN `锛达紭b`; 锛o紤 锛o紤 銇 銇 銇 銇 銇 銇 SELECT * FROM `锛达紭a` LEFT JOIN `锛达紭b` USING (`锛o紤`); -锛o紤 锛o紤 -銇 銇 -銇 NULL -銇 NULL +锛o紤 +銇 +銇 +銇 SELECT * FROM `锛达紭a` LEFT JOIN `锛达紭b` ON (`锛达紭a`.`锛o紤` = `锛达紭b`.`锛o紤`); 锛o紤 锛o紤 銇 銇 銇 NULL 銇 NULL SELECT * FROM `锛达紭b` RIGHT JOIN `锛达紭a` USING (`锛o紤`); -锛o紤 锛o紤 -銇 銇 -NULL 銇 -NULL 銇 +锛o紤 +銇 +銇 +銇 SELECT * FROM `锛达紭b` RIGHT JOIN `锛达紭a` ON (`锛达紭a`.`锛o紤` = `锛达紭b`.`锛o紤`); 锛o紤 锛o紤 銇 銇 @@ -399,31 +399,31 @@ SELECT * FROM `锛达紮a` INNER JOIN `锛达紮b`; 榫 榫 榫 榫 SELECT * FROM `锛达紮a` JOIN `锛达紮b` USING (`锛o紤`); -锛o紤 锛o紤 -榫 榫 +锛o紤 +榫 SELECT * FROM `锛达紮a` INNER JOIN `锛达紮b` USING (`锛o紤`); -锛o紤 锛o紤 -榫 榫 +锛o紤 +榫 SELECT * FROM `锛达紮a` CROSS JOIN `锛达紮b`; 锛o紤 锛o紤 榫 榫 榫 榫 榫 榫 SELECT * FROM `锛达紮a` LEFT JOIN `锛达紮b` USING (`锛o紤`); -锛o紤 锛o紤 -榫 榫 -榫 NULL -榫 NULL +锛o紤 +榫 +榫 +榫 SELECT * FROM `锛达紮a` LEFT JOIN `锛达紮b` ON (`锛达紮a`.`锛o紤` = `锛达紮b`.`锛o紤`); 锛o紤 锛o紤 榫 榫 榫 NULL 榫 NULL SELECT * FROM `锛达紮b` RIGHT JOIN `锛达紮a` USING (`锛o紤`); -锛o紤 锛o紤 -榫 榫 -NULL 榫 -NULL 榫 +锛o紤 +榫 +榫 +榫 SELECT * FROM `锛达紮b` RIGHT JOIN `锛达紮a` ON (`锛达紮a`.`锛o紤` = `锛达紮b`.`锛o紤`); 锛o紤 锛o紤 榫 榫 @@ -440,31 +440,31 @@ SELECT * FROM `锛达紤锛恆` INNER JOIN `锛达紤锛恇`; 锝 锝 锝 锝 SELECT * FROM `锛达紤锛恆` JOIN `锛达紤锛恇` USING (`锛o紤`); -锛o紤 锛o紤 -锝 锝 +锛o紤 +锝 SELECT * FROM `锛达紤锛恆` INNER JOIN `锛达紤锛恇` USING (`锛o紤`); -锛o紤 锛o紤 -锝 锝 +锛o紤 +锝 SELECT * FROM `锛达紤锛恆` CROSS JOIN `锛达紤锛恇`; 锛o紤 锛o紤 锝 锝 锝 锝 锝 锝 SELECT * FROM `锛达紤锛恆` LEFT JOIN `锛达紤锛恇` USING (`锛o紤`); -锛o紤 锛o紤 -锝 锝 -锝 NULL -锝 NULL +锛o紤 +锝 +锝 +锝 SELECT * FROM `锛达紤锛恆` LEFT JOIN `锛达紤锛恇` ON (`锛达紤锛恆`.`锛o紤` = `锛达紤锛恇`.`锛o紤`); 锛o紤 锛o紤 锝 锝 锝 NULL 锝 NULL SELECT * FROM `锛达紤锛恇` RIGHT JOIN `锛达紤锛恆` USING (`锛o紤`); -锛o紤 锛o紤 -锝 锝 -NULL 锝 -NULL 锝 +锛o紤 +锝 +锝 +锝 SELECT * FROM `锛达紤锛恇` RIGHT JOIN `锛达紤锛恆` ON (`锛达紤锛恆`.`锛o紤` = `锛达紤锛恇`.`锛o紤`); 锛o紤 锛o紤 锝 锝 @@ -481,31 +481,31 @@ SELECT * FROM `锛达紤锛慳` INNER JOIN `锛达紤锛慴`; 銇 銇 銇 銇 SELECT * FROM `锛达紤锛慳` JOIN `锛达紤锛慴` USING (`锛o紤`); -锛o紤 锛o紤 -銇 銇 +锛o紤 +銇 SELECT * FROM `锛达紤锛慳` INNER JOIN `锛达紤锛慴` USING (`锛o紤`); -锛o紤 锛o紤 -銇 銇 +锛o紤 +銇 SELECT * FROM `锛达紤锛慳` CROSS JOIN `锛达紤锛慴`; 锛o紤 锛o紤 銇 銇 銇 銇 銇 銇 SELECT * FROM `锛达紤锛慳` LEFT JOIN `锛达紤锛慴` USING (`锛o紤`); -锛o紤 锛o紤 -銇 銇 -銇 NULL -銇 NULL +锛o紤 +銇 +銇 +銇 SELECT * FROM `锛达紤锛慳` LEFT JOIN `锛达紤锛慴` ON (`锛达紤锛慳`.`锛o紤` = `锛达紤锛慴`.`锛o紤`); 锛o紤 锛o紤 銇 銇 銇 NULL 銇 NULL SELECT * FROM `锛达紤锛慴` RIGHT JOIN `锛达紤锛慳` USING (`锛o紤`); -锛o紤 锛o紤 -銇 銇 -NULL 銇 -NULL 銇 +锛o紤 +銇 +銇 +銇 SELECT * FROM `锛达紤锛慴` RIGHT JOIN `锛达紤锛慳` ON (`锛达紤锛慳`.`锛o紤` = `锛达紤锛慴`.`锛o紤`); 锛o紤 锛o紤 銇 銇 @@ -522,31 +522,31 @@ SELECT * FROM `锛达紤锛抋` INNER JOIN `锛达紤锛抌`; 榫 榫 榫 榫 SELECT * FROM `锛达紤锛抋` JOIN `锛达紤锛抌` USING (`锛o紤`); -锛o紤 锛o紤 -榫 榫 +锛o紤 +榫 SELECT * FROM `锛达紤锛抋` INNER JOIN `锛达紤锛抌` USING (`锛o紤`); -锛o紤 锛o紤 -榫 榫 +锛o紤 +榫 SELECT * FROM `锛达紤锛抋` CROSS JOIN `锛达紤锛抌`; 锛o紤 锛o紤 榫 榫 榫 榫 榫 榫 SELECT * FROM `锛达紤锛抋` LEFT JOIN `锛达紤锛抌` USING (`锛o紤`); -锛o紤 锛o紤 -榫 榫 -榫 NULL -榫 NULL +锛o紤 +榫 +榫 +榫 SELECT * FROM `锛达紤锛抋` LEFT JOIN `锛达紤锛抌` ON (`锛达紤锛抋`.`锛o紤` = `锛达紤锛抌`.`锛o紤`); 锛o紤 锛o紤 榫 榫 榫 NULL 榫 NULL SELECT * FROM `锛达紤锛抌` RIGHT JOIN `锛达紤锛抋` USING (`锛o紤`); -锛o紤 锛o紤 -榫 榫 -NULL 榫 -NULL 榫 +锛o紤 +榫 +榫 +榫 SELECT * FROM `锛达紤锛抌` RIGHT JOIN `锛达紤锛抋` ON (`锛达紤锛抋`.`锛o紤` = `锛达紤锛抌`.`锛o紤`); 锛o紤 锛o紤 榫 榫 diff --git a/mysql-test/suite/jp/r/jp_select_sjis.result b/mysql-test/suite/jp/r/jp_select_sjis.result index d48d08d745f..652b538fb88 100644 --- a/mysql-test/suite/jp/r/jp_select_sjis.result +++ b/mysql-test/suite/jp/r/jp_select_sjis.result @@ -118,6 +118,7 @@ SELECT * FROM ` 陳陸陹険陻陼陽陾陿隀隁隂隃隄隇丒丒丒丒丒 SELECT * FROM `俿俁`; 俠侾 + 僜廫昞梊峔塡嶾怽揬擻朶榎慭抃橽歕沑淺漒瀄 SELECT * FROM `俿係`; 俠侾 @@ -201,6 +202,7 @@ SELECT * FROM ` 陳陸陹険陻陼陽陾陿隀隁隂隃隄隇丒丒丒丒丒 SELECT * FROM `俿俇`; 俠侾 + 僜廫昞梊峔塡嶾怽揬擻朶榎慭抃橽歕沑淺漒瀄 SELECT * FROM `俿俈`; 俠侾 @@ -285,6 +287,7 @@ SELECT * FROM ` SELECT * FROM `俿俋`; 俠侾 僜廫昞梊峔塡嶾怽揬擻朶榎慭抃橽歕沑淺漒瀄 + SELECT * FROM `俿侾侽`; 俠侾 !"#$%&'()*+,-./ @@ -368,6 +371,7 @@ SELECT * FROM ` SELECT * FROM `俿侾俀`; 俠侾 僜廫昞梊峔塡嶾怽揬擻朶榎慭抃橽歕沑淺漒瀄 + drop table `俿侾`; drop table `俿俀`; drop table `俿俁`; diff --git a/mysql-test/suite/jp/t/jp_alter_sjis.test b/mysql-test/suite/jp/t/jp_alter_sjis.test index b7b31862599..f250afcf5dd 100644 --- a/mysql-test/suite/jp/t/jp_alter_sjis.test +++ b/mysql-test/suite/jp/t/jp_alter_sjis.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --character_set sjis SET NAMES sjis; SET character_set_database = sjis; diff --git a/mysql-test/suite/jp/t/jp_alter_ucs2.test b/mysql-test/suite/jp/t/jp_alter_ucs2.test index 6c5b3132edf..27cf5b72839 100644 --- a/mysql-test/suite/jp/t/jp_alter_ucs2.test +++ b/mysql-test/suite/jp/t/jp_alter_ucs2.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --source include/have_ucs2.inc --disable_warnings diff --git a/mysql-test/suite/jp/t/jp_alter_ujis.test b/mysql-test/suite/jp/t/jp_alter_ujis.test index d388d20c49b..b817f608446 100644 --- a/mysql-test/suite/jp/t/jp_alter_ujis.test +++ b/mysql-test/suite/jp/t/jp_alter_ujis.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --source include/have_ujis.inc --disable_warnings diff --git a/mysql-test/suite/jp/t/jp_alter_utf8.test b/mysql-test/suite/jp/t/jp_alter_utf8.test index 6771343f38f..60a67485ba5 100644 --- a/mysql-test/suite/jp/t/jp_alter_utf8.test +++ b/mysql-test/suite/jp/t/jp_alter_utf8.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --disable_warnings DROP TABLE IF EXISTS `锝憋奖锝盽; DROP TABLE IF EXISTS `锝诧讲锝瞏; diff --git a/mysql-test/suite/jp/t/jp_charlength_sjis.test b/mysql-test/suite/jp/t/jp_charlength_sjis.test index 5f3543bb7a6..350605450da 100644 --- a/mysql-test/suite/jp/t/jp_charlength_sjis.test +++ b/mysql-test/suite/jp/t/jp_charlength_sjis.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --character_set sjis --disable_warnings drop table if exists `俿侾`; diff --git a/mysql-test/suite/jp/t/jp_charlength_ucs2.test b/mysql-test/suite/jp/t/jp_charlength_ucs2.test index 2db9db7cfc6..714ced47ff8 100644 --- a/mysql-test/suite/jp/t/jp_charlength_ucs2.test +++ b/mysql-test/suite/jp/t/jp_charlength_ucs2.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --source include/have_ucs2.inc --disable_warnings diff --git a/mysql-test/suite/jp/t/jp_charlength_ujis.test b/mysql-test/suite/jp/t/jp_charlength_ujis.test index 08973231f27..923bffef540 100644 --- a/mysql-test/suite/jp/t/jp_charlength_ujis.test +++ b/mysql-test/suite/jp/t/jp_charlength_ujis.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --source include/have_ujis.inc --disable_warnings diff --git a/mysql-test/suite/jp/t/jp_charlength_utf8.test b/mysql-test/suite/jp/t/jp_charlength_utf8.test index a3f74db27ee..bc099caf74a 100644 --- a/mysql-test/suite/jp/t/jp_charlength_utf8.test +++ b/mysql-test/suite/jp/t/jp_charlength_utf8.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --disable_warnings drop table if exists `锛达紤`; drop table if exists `锛达紥`; diff --git a/mysql-test/suite/jp/t/jp_charset_sjis.test b/mysql-test/suite/jp/t/jp_charset_sjis.test index 3a9f264bdfe..276be86cd9d 100644 --- a/mysql-test/suite/jp/t/jp_charset_sjis.test +++ b/mysql-test/suite/jp/t/jp_charset_sjis.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --character_set sjis --disable_warnings drop table if exists `俿侾`; diff --git a/mysql-test/suite/jp/t/jp_charset_ucs2.test b/mysql-test/suite/jp/t/jp_charset_ucs2.test index 5183071033b..f7971095fa6 100644 --- a/mysql-test/suite/jp/t/jp_charset_ucs2.test +++ b/mysql-test/suite/jp/t/jp_charset_ucs2.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --source include/have_ucs2.inc --disable_warnings diff --git a/mysql-test/suite/jp/t/jp_charset_ujis.test b/mysql-test/suite/jp/t/jp_charset_ujis.test index de9ef318530..a8a6544537a 100644 --- a/mysql-test/suite/jp/t/jp_charset_ujis.test +++ b/mysql-test/suite/jp/t/jp_charset_ujis.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --source include/have_ujis.inc --disable_warnings diff --git a/mysql-test/suite/jp/t/jp_charset_utf8.test b/mysql-test/suite/jp/t/jp_charset_utf8.test index 2d73daba42a..7d8311c2f72 100644 --- a/mysql-test/suite/jp/t/jp_charset_utf8.test +++ b/mysql-test/suite/jp/t/jp_charset_utf8.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --disable_warnings drop table if exists `锛达紤`; drop table if exists `锛达紥`; diff --git a/mysql-test/suite/jp/t/jp_convert_sjis.test b/mysql-test/suite/jp/t/jp_convert_sjis.test index 93fa33029bf..835328c92eb 100644 --- a/mysql-test/suite/jp/t/jp_convert_sjis.test +++ b/mysql-test/suite/jp/t/jp_convert_sjis.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --character_set sjis SET NAMES sjis; SET character_set_database = sjis; diff --git a/mysql-test/suite/jp/t/jp_convert_ucs2.test b/mysql-test/suite/jp/t/jp_convert_ucs2.test index 88b0d0c9cba..3ed4efe158d 100644 --- a/mysql-test/suite/jp/t/jp_convert_ucs2.test +++ b/mysql-test/suite/jp/t/jp_convert_ucs2.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --source include/have_ucs2.inc --disable_warnings diff --git a/mysql-test/suite/jp/t/jp_convert_ujis.test b/mysql-test/suite/jp/t/jp_convert_ujis.test index d6303b66f34..4409b6cad90 100644 --- a/mysql-test/suite/jp/t/jp_convert_ujis.test +++ b/mysql-test/suite/jp/t/jp_convert_ujis.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --source include/have_ujis.inc --disable_warnings diff --git a/mysql-test/suite/jp/t/jp_convert_utf8.test b/mysql-test/suite/jp/t/jp_convert_utf8.test index a687b0f06cb..e7c180e72fc 100644 --- a/mysql-test/suite/jp/t/jp_convert_utf8.test +++ b/mysql-test/suite/jp/t/jp_convert_utf8.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --disable_warnings drop table if exists `锛达紤`; drop table if exists `锛达紥`; diff --git a/mysql-test/suite/jp/t/jp_create_tbl_sjis.test b/mysql-test/suite/jp/t/jp_create_tbl_sjis.test index 45c0b24388b..93f3ac3c4a3 100644 --- a/mysql-test/suite/jp/t/jp_create_tbl_sjis.test +++ b/mysql-test/suite/jp/t/jp_create_tbl_sjis.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --character_set sjis SET NAMES sjis; SET character_set_database = sjis; diff --git a/mysql-test/suite/jp/t/jp_create_tbl_ucs2.test b/mysql-test/suite/jp/t/jp_create_tbl_ucs2.test index 519697e3530..553ef8a4dad 100644 --- a/mysql-test/suite/jp/t/jp_create_tbl_ucs2.test +++ b/mysql-test/suite/jp/t/jp_create_tbl_ucs2.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --source include/have_ucs2.inc --disable_warnings diff --git a/mysql-test/suite/jp/t/jp_create_tbl_ujis.test b/mysql-test/suite/jp/t/jp_create_tbl_ujis.test index ac70facdce9..1106ddc1417 100644 --- a/mysql-test/suite/jp/t/jp_create_tbl_ujis.test +++ b/mysql-test/suite/jp/t/jp_create_tbl_ujis.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --source include/have_ujis.inc --disable_warnings diff --git a/mysql-test/suite/jp/t/jp_create_tbl_utf8.test b/mysql-test/suite/jp/t/jp_create_tbl_utf8.test index 5c816eb169a..9b0ece77e34 100644 --- a/mysql-test/suite/jp/t/jp_create_tbl_utf8.test +++ b/mysql-test/suite/jp/t/jp_create_tbl_utf8.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --disable_warnings DROP TABLE IF EXISTS `锝憋奖锝盽; DROP TABLE IF EXISTS `锝诧讲锝瞏; diff --git a/mysql-test/suite/jp/t/jp_enum_sjis.test b/mysql-test/suite/jp/t/jp_enum_sjis.test index 2ea1bf320e0..c433e0bcac4 100644 --- a/mysql-test/suite/jp/t/jp_enum_sjis.test +++ b/mysql-test/suite/jp/t/jp_enum_sjis.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --character_set sjis --disable_warnings drop table if exists `俿侾`; diff --git a/mysql-test/suite/jp/t/jp_enum_ucs2.test b/mysql-test/suite/jp/t/jp_enum_ucs2.test index 2239ebab478..79f5952cf97 100644 --- a/mysql-test/suite/jp/t/jp_enum_ucs2.test +++ b/mysql-test/suite/jp/t/jp_enum_ucs2.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --source include/have_ucs2.inc # half-with kana is not handled correctly in 4.1 diff --git a/mysql-test/suite/jp/t/jp_enum_ujis.test b/mysql-test/suite/jp/t/jp_enum_ujis.test index da41165aad0..f48d176ec6b 100644 --- a/mysql-test/suite/jp/t/jp_enum_ujis.test +++ b/mysql-test/suite/jp/t/jp_enum_ujis.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --source include/have_ujis.inc --disable_warnings diff --git a/mysql-test/suite/jp/t/jp_enum_utf8.test b/mysql-test/suite/jp/t/jp_enum_utf8.test index 4ce3576b604..64fe2129164 100644 --- a/mysql-test/suite/jp/t/jp_enum_utf8.test +++ b/mysql-test/suite/jp/t/jp_enum_utf8.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --disable_warnings drop table if exists `锛达紤`; drop table if exists `锛达紥`; diff --git a/mysql-test/suite/jp/t/jp_insert_sjis.test b/mysql-test/suite/jp/t/jp_insert_sjis.test index 0266ad1eaca..a940eeb5782 100644 --- a/mysql-test/suite/jp/t/jp_insert_sjis.test +++ b/mysql-test/suite/jp/t/jp_insert_sjis.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --character_set sjis --disable_warnings drop table if exists `俿侾`; diff --git a/mysql-test/suite/jp/t/jp_insert_ucs2.test b/mysql-test/suite/jp/t/jp_insert_ucs2.test index 9b0a02e57d8..443f6f1107b 100644 --- a/mysql-test/suite/jp/t/jp_insert_ucs2.test +++ b/mysql-test/suite/jp/t/jp_insert_ucs2.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --source include/have_ucs2.inc --disable_warnings diff --git a/mysql-test/suite/jp/t/jp_insert_ujis.test b/mysql-test/suite/jp/t/jp_insert_ujis.test index 7b6d2838386..ab82db59326 100644 --- a/mysql-test/suite/jp/t/jp_insert_ujis.test +++ b/mysql-test/suite/jp/t/jp_insert_ujis.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --source include/have_ujis.inc --disable_warnings diff --git a/mysql-test/suite/jp/t/jp_insert_utf8.test b/mysql-test/suite/jp/t/jp_insert_utf8.test index ef6acb90063..e8c41bab4ea 100644 --- a/mysql-test/suite/jp/t/jp_insert_utf8.test +++ b/mysql-test/suite/jp/t/jp_insert_utf8.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --disable_warnings drop table if exists `锛达紤`; drop table if exists `锛达紥`; diff --git a/mysql-test/suite/jp/t/jp_instr_sjis.test b/mysql-test/suite/jp/t/jp_instr_sjis.test index c19b5f2b14c..83480ea0267 100644 --- a/mysql-test/suite/jp/t/jp_instr_sjis.test +++ b/mysql-test/suite/jp/t/jp_instr_sjis.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --character_set sjis --disable_warnings drop table if exists `俿侾`; diff --git a/mysql-test/suite/jp/t/jp_instr_ucs2.test b/mysql-test/suite/jp/t/jp_instr_ucs2.test index b8f83961e90..7b442d09a3d 100644 --- a/mysql-test/suite/jp/t/jp_instr_ucs2.test +++ b/mysql-test/suite/jp/t/jp_instr_ucs2.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --source include/have_ucs2.inc --disable_warnings diff --git a/mysql-test/suite/jp/t/jp_instr_ujis.test b/mysql-test/suite/jp/t/jp_instr_ujis.test index 696e1147372..d0373ba73ce 100644 --- a/mysql-test/suite/jp/t/jp_instr_ujis.test +++ b/mysql-test/suite/jp/t/jp_instr_ujis.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --source include/have_ujis.inc --disable_warnings diff --git a/mysql-test/suite/jp/t/jp_instr_utf8.test b/mysql-test/suite/jp/t/jp_instr_utf8.test index b25b72bc8d0..c7491101872 100644 --- a/mysql-test/suite/jp/t/jp_instr_utf8.test +++ b/mysql-test/suite/jp/t/jp_instr_utf8.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --disable_warnings drop table if exists `锛达紤`; drop table if exists `锛达紥`; diff --git a/mysql-test/suite/jp/t/jp_join_sjis.test b/mysql-test/suite/jp/t/jp_join_sjis.test index 30b23913929..77d1dc15c5c 100644 --- a/mysql-test/suite/jp/t/jp_join_sjis.test +++ b/mysql-test/suite/jp/t/jp_join_sjis.test @@ -1,3 +1,4 @@ +-- source include/have_innodb.inc --character_set sjis --disable_warnings drop table if exists `俿侾`; diff --git a/mysql-test/suite/jp/t/jp_join_ucs2.test b/mysql-test/suite/jp/t/jp_join_ucs2.test index 27e49203dd2..276af80f7af 100644 --- a/mysql-test/suite/jp/t/jp_join_ucs2.test +++ b/mysql-test/suite/jp/t/jp_join_ucs2.test @@ -1,3 +1,4 @@ +-- source include/have_innodb.inc --source include/have_ucs2.inc --disable_warnings diff --git a/mysql-test/suite/jp/t/jp_join_ujis.test b/mysql-test/suite/jp/t/jp_join_ujis.test index 079f260cc26..5716ee12e60 100644 --- a/mysql-test/suite/jp/t/jp_join_ujis.test +++ b/mysql-test/suite/jp/t/jp_join_ujis.test @@ -1,3 +1,4 @@ +-- source include/have_innodb.inc --source include/have_ujis.inc --disable_warnings diff --git a/mysql-test/suite/jp/t/jp_join_utf8.test b/mysql-test/suite/jp/t/jp_join_utf8.test index 0b2f033f8bb..36f8e930bc3 100644 --- a/mysql-test/suite/jp/t/jp_join_utf8.test +++ b/mysql-test/suite/jp/t/jp_join_utf8.test @@ -1,3 +1,4 @@ +-- source include/have_innodb.inc --disable_warnings drop table if exists `锛达紤`; drop table if exists `锛达紥`; diff --git a/mysql-test/suite/jp/t/jp_left_sjis.test b/mysql-test/suite/jp/t/jp_left_sjis.test index 5d69d9892e2..e93e92493a1 100644 --- a/mysql-test/suite/jp/t/jp_left_sjis.test +++ b/mysql-test/suite/jp/t/jp_left_sjis.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --character_set sjis --disable_warnings drop table if exists `俿侾`; diff --git a/mysql-test/suite/jp/t/jp_left_ucs2.test b/mysql-test/suite/jp/t/jp_left_ucs2.test index 59d10b7d736..2c1be4a7e6a 100644 --- a/mysql-test/suite/jp/t/jp_left_ucs2.test +++ b/mysql-test/suite/jp/t/jp_left_ucs2.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --source include/have_ucs2.inc --disable_warnings diff --git a/mysql-test/suite/jp/t/jp_left_ujis.test b/mysql-test/suite/jp/t/jp_left_ujis.test index 718639cd8a4..f639bf643df 100644 --- a/mysql-test/suite/jp/t/jp_left_ujis.test +++ b/mysql-test/suite/jp/t/jp_left_ujis.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --source include/have_ujis.inc --disable_warnings diff --git a/mysql-test/suite/jp/t/jp_left_utf8.test b/mysql-test/suite/jp/t/jp_left_utf8.test index f9c99718e0f..63d9061a879 100644 --- a/mysql-test/suite/jp/t/jp_left_utf8.test +++ b/mysql-test/suite/jp/t/jp_left_utf8.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --disable_warnings drop table if exists `锛达紤`; drop table if exists `锛达紥`; diff --git a/mysql-test/suite/jp/t/jp_length_sjis.test b/mysql-test/suite/jp/t/jp_length_sjis.test index 7023891b7f0..81121a4432e 100644 --- a/mysql-test/suite/jp/t/jp_length_sjis.test +++ b/mysql-test/suite/jp/t/jp_length_sjis.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --character_set sjis --disable_warnings drop table if exists `俿侾`; diff --git a/mysql-test/suite/jp/t/jp_length_ucs2.test b/mysql-test/suite/jp/t/jp_length_ucs2.test index 9951c9b6cd1..1dcc975d868 100644 --- a/mysql-test/suite/jp/t/jp_length_ucs2.test +++ b/mysql-test/suite/jp/t/jp_length_ucs2.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --source include/have_ucs2.inc --disable_warnings diff --git a/mysql-test/suite/jp/t/jp_length_ujis.test b/mysql-test/suite/jp/t/jp_length_ujis.test index ac3aef2c768..ad41c7a7113 100644 --- a/mysql-test/suite/jp/t/jp_length_ujis.test +++ b/mysql-test/suite/jp/t/jp_length_ujis.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --source include/have_ujis.inc --disable_warnings diff --git a/mysql-test/suite/jp/t/jp_length_utf8.test b/mysql-test/suite/jp/t/jp_length_utf8.test index 5c5021f37be..7bfe1896034 100644 --- a/mysql-test/suite/jp/t/jp_length_utf8.test +++ b/mysql-test/suite/jp/t/jp_length_utf8.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --disable_warnings drop table if exists `锛达紤`; drop table if exists `锛达紥`; diff --git a/mysql-test/suite/jp/t/jp_like_sjis.test b/mysql-test/suite/jp/t/jp_like_sjis.test index 5c41b9ff7ef..1cb7aadb876 100644 --- a/mysql-test/suite/jp/t/jp_like_sjis.test +++ b/mysql-test/suite/jp/t/jp_like_sjis.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --character_set sjis --disable_warnings drop table if exists `俿侾`; diff --git a/mysql-test/suite/jp/t/jp_like_ucs2.test b/mysql-test/suite/jp/t/jp_like_ucs2.test index feae40de49e..1f9b7c09b9d 100644 --- a/mysql-test/suite/jp/t/jp_like_ucs2.test +++ b/mysql-test/suite/jp/t/jp_like_ucs2.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --source include/have_ucs2.inc --disable_warnings diff --git a/mysql-test/suite/jp/t/jp_like_ujis.test b/mysql-test/suite/jp/t/jp_like_ujis.test index 29ef7c5d48b..56c4fa8a8b0 100644 --- a/mysql-test/suite/jp/t/jp_like_ujis.test +++ b/mysql-test/suite/jp/t/jp_like_ujis.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --source include/have_ujis.inc --disable_warnings diff --git a/mysql-test/suite/jp/t/jp_like_utf8.test b/mysql-test/suite/jp/t/jp_like_utf8.test index 4247242029d..f6cc895d814 100644 --- a/mysql-test/suite/jp/t/jp_like_utf8.test +++ b/mysql-test/suite/jp/t/jp_like_utf8.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --disable_warnings drop table if exists `锛达紤`; drop table if exists `锛达紥`; diff --git a/mysql-test/suite/jp/t/jp_locate_sjis.test b/mysql-test/suite/jp/t/jp_locate_sjis.test index 92c671199b6..a015109e2a3 100644 --- a/mysql-test/suite/jp/t/jp_locate_sjis.test +++ b/mysql-test/suite/jp/t/jp_locate_sjis.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --character_set sjis --disable_warnings drop table if exists `俿侾`; diff --git a/mysql-test/suite/jp/t/jp_locate_ucs2.test b/mysql-test/suite/jp/t/jp_locate_ucs2.test index d00ad67235a..111caefb02e 100644 --- a/mysql-test/suite/jp/t/jp_locate_ucs2.test +++ b/mysql-test/suite/jp/t/jp_locate_ucs2.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --source include/have_ucs2.inc --disable_warnings diff --git a/mysql-test/suite/jp/t/jp_locate_ujis.test b/mysql-test/suite/jp/t/jp_locate_ujis.test index 5375fad75db..872555a4532 100644 --- a/mysql-test/suite/jp/t/jp_locate_ujis.test +++ b/mysql-test/suite/jp/t/jp_locate_ujis.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --source include/have_ujis.inc --disable_warnings diff --git a/mysql-test/suite/jp/t/jp_locate_utf8.test b/mysql-test/suite/jp/t/jp_locate_utf8.test index cbf6714e322..85d2e69fd60 100644 --- a/mysql-test/suite/jp/t/jp_locate_utf8.test +++ b/mysql-test/suite/jp/t/jp_locate_utf8.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --disable_warnings drop table if exists `锛达紤`; drop table if exists `锛达紥`; diff --git a/mysql-test/suite/jp/t/jp_lpad_sjis.test b/mysql-test/suite/jp/t/jp_lpad_sjis.test index 7038112cbc8..4b18402473d 100644 --- a/mysql-test/suite/jp/t/jp_lpad_sjis.test +++ b/mysql-test/suite/jp/t/jp_lpad_sjis.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --character_set sjis --disable_warnings drop table if exists `俿侾`; diff --git a/mysql-test/suite/jp/t/jp_lpad_ucs2.test b/mysql-test/suite/jp/t/jp_lpad_ucs2.test index e3bead0855a..95dd088abce 100644 --- a/mysql-test/suite/jp/t/jp_lpad_ucs2.test +++ b/mysql-test/suite/jp/t/jp_lpad_ucs2.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --source include/have_ucs2.inc --disable_warnings diff --git a/mysql-test/suite/jp/t/jp_lpad_ujis.test b/mysql-test/suite/jp/t/jp_lpad_ujis.test index eea4877ec3a..c1149a67207 100644 --- a/mysql-test/suite/jp/t/jp_lpad_ujis.test +++ b/mysql-test/suite/jp/t/jp_lpad_ujis.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --source include/have_ujis.inc --disable_warnings diff --git a/mysql-test/suite/jp/t/jp_lpad_utf8.test b/mysql-test/suite/jp/t/jp_lpad_utf8.test index 599bf5eba28..42aa2fd860b 100644 --- a/mysql-test/suite/jp/t/jp_lpad_utf8.test +++ b/mysql-test/suite/jp/t/jp_lpad_utf8.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --disable_warnings drop table if exists `锛达紤`; drop table if exists `锛达紥`; diff --git a/mysql-test/suite/jp/t/jp_ltrim_sjis.test b/mysql-test/suite/jp/t/jp_ltrim_sjis.test index 864238df07c..7b5e20ec9a4 100644 --- a/mysql-test/suite/jp/t/jp_ltrim_sjis.test +++ b/mysql-test/suite/jp/t/jp_ltrim_sjis.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --character_set sjis --disable_warnings drop table if exists `俿侾`; diff --git a/mysql-test/suite/jp/t/jp_ltrim_ucs2.test b/mysql-test/suite/jp/t/jp_ltrim_ucs2.test index 0ae647f5222..25a6eaabc60 100644 --- a/mysql-test/suite/jp/t/jp_ltrim_ucs2.test +++ b/mysql-test/suite/jp/t/jp_ltrim_ucs2.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --source include/have_ucs2.inc --disable_warnings diff --git a/mysql-test/suite/jp/t/jp_ltrim_ujis.test b/mysql-test/suite/jp/t/jp_ltrim_ujis.test index 64363aa330b..fbba90a38b5 100644 --- a/mysql-test/suite/jp/t/jp_ltrim_ujis.test +++ b/mysql-test/suite/jp/t/jp_ltrim_ujis.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --source include/have_ujis.inc --disable_warnings diff --git a/mysql-test/suite/jp/t/jp_ltrim_utf8.test b/mysql-test/suite/jp/t/jp_ltrim_utf8.test index 846ce11163b..b33d22e459d 100644 --- a/mysql-test/suite/jp/t/jp_ltrim_utf8.test +++ b/mysql-test/suite/jp/t/jp_ltrim_utf8.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --disable_warnings drop table if exists `锛达紤`; drop table if exists `锛达紥`; diff --git a/mysql-test/suite/jp/t/jp_ps_sjis.test b/mysql-test/suite/jp/t/jp_ps_sjis.test index cc93dca2a79..2e09c51cf7a 100644 --- a/mysql-test/suite/jp/t/jp_ps_sjis.test +++ b/mysql-test/suite/jp/t/jp_ps_sjis.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --character_set sjis --disable_warnings DROP TABLE IF EXISTS t1; diff --git a/mysql-test/suite/jp/t/jp_ps_ujis.test b/mysql-test/suite/jp/t/jp_ps_ujis.test index 7d61c12e496..ab64fcf5216 100644 --- a/mysql-test/suite/jp/t/jp_ps_ujis.test +++ b/mysql-test/suite/jp/t/jp_ps_ujis.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --source include/have_ujis.inc --disable_warnings diff --git a/mysql-test/suite/jp/t/jp_replace_sjis.test b/mysql-test/suite/jp/t/jp_replace_sjis.test index 811d3350a34..91996ba83e9 100644 --- a/mysql-test/suite/jp/t/jp_replace_sjis.test +++ b/mysql-test/suite/jp/t/jp_replace_sjis.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --character_set sjis --disable_warnings drop table if exists `俿侾`; diff --git a/mysql-test/suite/jp/t/jp_replace_ucs2.test b/mysql-test/suite/jp/t/jp_replace_ucs2.test index 7739a30cd9c..3043115ef62 100644 --- a/mysql-test/suite/jp/t/jp_replace_ucs2.test +++ b/mysql-test/suite/jp/t/jp_replace_ucs2.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --source include/have_ucs2.inc --disable_warnings diff --git a/mysql-test/suite/jp/t/jp_replace_ujis.test b/mysql-test/suite/jp/t/jp_replace_ujis.test index 3d8724e63d5..1ba29426010 100644 --- a/mysql-test/suite/jp/t/jp_replace_ujis.test +++ b/mysql-test/suite/jp/t/jp_replace_ujis.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --source include/have_ujis.inc --disable_warnings diff --git a/mysql-test/suite/jp/t/jp_replace_utf8.test b/mysql-test/suite/jp/t/jp_replace_utf8.test index 1d89a43648b..81b892a5df7 100644 --- a/mysql-test/suite/jp/t/jp_replace_utf8.test +++ b/mysql-test/suite/jp/t/jp_replace_utf8.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --disable_warnings drop table if exists `锛达紤`; drop table if exists `锛达紥`; diff --git a/mysql-test/suite/jp/t/jp_reverse_sjis.test b/mysql-test/suite/jp/t/jp_reverse_sjis.test index c1e2b2a17ca..5d9014dc3a6 100644 --- a/mysql-test/suite/jp/t/jp_reverse_sjis.test +++ b/mysql-test/suite/jp/t/jp_reverse_sjis.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --character_set sjis --disable_warnings drop table if exists `俿侾`; diff --git a/mysql-test/suite/jp/t/jp_reverse_ucs2.test b/mysql-test/suite/jp/t/jp_reverse_ucs2.test index d91ec7f70e8..95afeeda570 100644 --- a/mysql-test/suite/jp/t/jp_reverse_ucs2.test +++ b/mysql-test/suite/jp/t/jp_reverse_ucs2.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --source include/have_ucs2.inc --disable_warnings diff --git a/mysql-test/suite/jp/t/jp_reverse_ujis.test b/mysql-test/suite/jp/t/jp_reverse_ujis.test index d37d363f59a..0d66201c367 100644 --- a/mysql-test/suite/jp/t/jp_reverse_ujis.test +++ b/mysql-test/suite/jp/t/jp_reverse_ujis.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --source include/have_ujis.inc --disable_warnings diff --git a/mysql-test/suite/jp/t/jp_reverse_utf8.test b/mysql-test/suite/jp/t/jp_reverse_utf8.test index 4e53d4be049..ee323b64ada 100644 --- a/mysql-test/suite/jp/t/jp_reverse_utf8.test +++ b/mysql-test/suite/jp/t/jp_reverse_utf8.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --disable_warnings drop table if exists `锛达紤`; drop table if exists `锛达紥`; diff --git a/mysql-test/suite/jp/t/jp_right_sjis.test b/mysql-test/suite/jp/t/jp_right_sjis.test index f481ec532ec..edf3795c510 100644 --- a/mysql-test/suite/jp/t/jp_right_sjis.test +++ b/mysql-test/suite/jp/t/jp_right_sjis.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --character_set sjis --disable_warnings drop table if exists `俿侾`; diff --git a/mysql-test/suite/jp/t/jp_right_ucs2.test b/mysql-test/suite/jp/t/jp_right_ucs2.test index 23ca2fa4fae..d3132b3e11f 100644 --- a/mysql-test/suite/jp/t/jp_right_ucs2.test +++ b/mysql-test/suite/jp/t/jp_right_ucs2.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --source include/have_ucs2.inc --disable_warnings diff --git a/mysql-test/suite/jp/t/jp_right_ujis.test b/mysql-test/suite/jp/t/jp_right_ujis.test index b5284489c7e..92cd7ed83dc 100644 --- a/mysql-test/suite/jp/t/jp_right_ujis.test +++ b/mysql-test/suite/jp/t/jp_right_ujis.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --source include/have_ujis.inc --disable_warnings diff --git a/mysql-test/suite/jp/t/jp_right_utf8.test b/mysql-test/suite/jp/t/jp_right_utf8.test index 863755c1dcf..6d884e55771 100644 --- a/mysql-test/suite/jp/t/jp_right_utf8.test +++ b/mysql-test/suite/jp/t/jp_right_utf8.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --disable_warnings drop table if exists `锛达紤`; drop table if exists `锛达紥`; diff --git a/mysql-test/suite/jp/t/jp_rpad_sjis.test b/mysql-test/suite/jp/t/jp_rpad_sjis.test index cc008631548..1bf752020bb 100644 --- a/mysql-test/suite/jp/t/jp_rpad_sjis.test +++ b/mysql-test/suite/jp/t/jp_rpad_sjis.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --character_set sjis --disable_warnings drop table if exists `俿侾`; diff --git a/mysql-test/suite/jp/t/jp_rpad_ucs2.test b/mysql-test/suite/jp/t/jp_rpad_ucs2.test index ca5059497d3..f3876dafe2f 100644 --- a/mysql-test/suite/jp/t/jp_rpad_ucs2.test +++ b/mysql-test/suite/jp/t/jp_rpad_ucs2.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --source include/have_ucs2.inc --disable_warnings diff --git a/mysql-test/suite/jp/t/jp_rpad_ujis.test b/mysql-test/suite/jp/t/jp_rpad_ujis.test index d7725b80af7..6ace7442b8d 100644 --- a/mysql-test/suite/jp/t/jp_rpad_ujis.test +++ b/mysql-test/suite/jp/t/jp_rpad_ujis.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --source include/have_ujis.inc --disable_warnings diff --git a/mysql-test/suite/jp/t/jp_rpad_utf8.test b/mysql-test/suite/jp/t/jp_rpad_utf8.test index b5a335bc6ce..6c075e20cb9 100644 --- a/mysql-test/suite/jp/t/jp_rpad_utf8.test +++ b/mysql-test/suite/jp/t/jp_rpad_utf8.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --disable_warnings drop table if exists `锛达紤`; drop table if exists `锛达紥`; diff --git a/mysql-test/suite/jp/t/jp_rtrim_sjis.test b/mysql-test/suite/jp/t/jp_rtrim_sjis.test index c80cf9410f9..1a9511698ce 100644 --- a/mysql-test/suite/jp/t/jp_rtrim_sjis.test +++ b/mysql-test/suite/jp/t/jp_rtrim_sjis.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --character_set sjis --disable_warnings drop table if exists `俿侾`; diff --git a/mysql-test/suite/jp/t/jp_rtrim_ucs2.test b/mysql-test/suite/jp/t/jp_rtrim_ucs2.test index 0fac38d12d1..2132eaa5cbe 100644 --- a/mysql-test/suite/jp/t/jp_rtrim_ucs2.test +++ b/mysql-test/suite/jp/t/jp_rtrim_ucs2.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --source include/have_ucs2.inc --disable_warnings diff --git a/mysql-test/suite/jp/t/jp_rtrim_ujis.test b/mysql-test/suite/jp/t/jp_rtrim_ujis.test index 46cda84dd55..07b42b96dfd 100644 --- a/mysql-test/suite/jp/t/jp_rtrim_ujis.test +++ b/mysql-test/suite/jp/t/jp_rtrim_ujis.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --source include/have_ujis.inc --disable_warnings diff --git a/mysql-test/suite/jp/t/jp_rtrim_utf8.test b/mysql-test/suite/jp/t/jp_rtrim_utf8.test index 4880a42db3e..48f863d891c 100644 --- a/mysql-test/suite/jp/t/jp_rtrim_utf8.test +++ b/mysql-test/suite/jp/t/jp_rtrim_utf8.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --disable_warnings drop table if exists `锛达紤`; drop table if exists `锛达紥`; diff --git a/mysql-test/suite/jp/t/jp_select_sjis.test b/mysql-test/suite/jp/t/jp_select_sjis.test index d84ed7a4b2c..fc80ce01471 100644 --- a/mysql-test/suite/jp/t/jp_select_sjis.test +++ b/mysql-test/suite/jp/t/jp_select_sjis.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --character_set sjis --disable_warnings drop table if exists `俿侾`; diff --git a/mysql-test/suite/jp/t/jp_select_ucs2.test b/mysql-test/suite/jp/t/jp_select_ucs2.test index 2e4602e7ea4..6cebdb65db1 100644 --- a/mysql-test/suite/jp/t/jp_select_ucs2.test +++ b/mysql-test/suite/jp/t/jp_select_ucs2.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --source include/have_ucs2.inc --disable_warnings diff --git a/mysql-test/suite/jp/t/jp_select_ujis.test b/mysql-test/suite/jp/t/jp_select_ujis.test index 4ad9e581a92..0e4d1ffc771 100644 --- a/mysql-test/suite/jp/t/jp_select_ujis.test +++ b/mysql-test/suite/jp/t/jp_select_ujis.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --source include/have_ujis.inc --disable_warnings diff --git a/mysql-test/suite/jp/t/jp_select_utf8.test b/mysql-test/suite/jp/t/jp_select_utf8.test index e614b9ccfb0..88fd6677f7c 100644 --- a/mysql-test/suite/jp/t/jp_select_utf8.test +++ b/mysql-test/suite/jp/t/jp_select_utf8.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --disable_warnings drop table if exists `锛达紤`; drop table if exists `锛达紥`; diff --git a/mysql-test/suite/jp/t/jp_subquery_sjis.test b/mysql-test/suite/jp/t/jp_subquery_sjis.test index 5292c7a2519..b6aa3e52f51 100644 --- a/mysql-test/suite/jp/t/jp_subquery_sjis.test +++ b/mysql-test/suite/jp/t/jp_subquery_sjis.test @@ -1,3 +1,4 @@ +-- source include/have_innodb.inc --character_set sjis --disable_warnings drop table if exists `俿侾`; diff --git a/mysql-test/suite/jp/t/jp_subquery_ucs2.test b/mysql-test/suite/jp/t/jp_subquery_ucs2.test index 311433438f4..d2c1fd29358 100644 --- a/mysql-test/suite/jp/t/jp_subquery_ucs2.test +++ b/mysql-test/suite/jp/t/jp_subquery_ucs2.test @@ -1,3 +1,4 @@ +-- source include/have_innodb.inc --source include/have_ucs2.inc --disable_warnings diff --git a/mysql-test/suite/jp/t/jp_subquery_ujis.test b/mysql-test/suite/jp/t/jp_subquery_ujis.test index 67c9f00fd85..2fd0427481c 100644 --- a/mysql-test/suite/jp/t/jp_subquery_ujis.test +++ b/mysql-test/suite/jp/t/jp_subquery_ujis.test @@ -1,3 +1,4 @@ +-- source include/have_innodb.inc --source include/have_ujis.inc --disable_warnings diff --git a/mysql-test/suite/jp/t/jp_subquery_utf8.test b/mysql-test/suite/jp/t/jp_subquery_utf8.test index 97c2df8ce30..460f1c1a903 100644 --- a/mysql-test/suite/jp/t/jp_subquery_utf8.test +++ b/mysql-test/suite/jp/t/jp_subquery_utf8.test @@ -1,3 +1,4 @@ +-- source include/have_innodb.inc --disable_warnings drop table if exists `锛达紤`; drop table if exists `锛达紥`; diff --git a/mysql-test/suite/jp/t/jp_substring_sjis.test b/mysql-test/suite/jp/t/jp_substring_sjis.test index ac929114880..a6c9496a873 100644 --- a/mysql-test/suite/jp/t/jp_substring_sjis.test +++ b/mysql-test/suite/jp/t/jp_substring_sjis.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --character_set sjis --disable_warnings drop table if exists `俿侾`; diff --git a/mysql-test/suite/jp/t/jp_substring_ucs2.test b/mysql-test/suite/jp/t/jp_substring_ucs2.test index f3cd5550072..71c0f903aa8 100644 --- a/mysql-test/suite/jp/t/jp_substring_ucs2.test +++ b/mysql-test/suite/jp/t/jp_substring_ucs2.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --source include/have_ucs2.inc --disable_warnings diff --git a/mysql-test/suite/jp/t/jp_substring_ujis.test b/mysql-test/suite/jp/t/jp_substring_ujis.test index c201c7148da..c93ab761352 100644 --- a/mysql-test/suite/jp/t/jp_substring_ujis.test +++ b/mysql-test/suite/jp/t/jp_substring_ujis.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --source include/have_ujis.inc --disable_warnings diff --git a/mysql-test/suite/jp/t/jp_substring_utf8.test b/mysql-test/suite/jp/t/jp_substring_utf8.test index 9f88115c899..3bd1bbbb491 100644 --- a/mysql-test/suite/jp/t/jp_substring_utf8.test +++ b/mysql-test/suite/jp/t/jp_substring_utf8.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --disable_warnings drop table if exists `锛达紤`; drop table if exists `锛达紥`; diff --git a/mysql-test/suite/jp/t/jp_trim_sjis.test b/mysql-test/suite/jp/t/jp_trim_sjis.test index 0f6821605ed..04dc832d49f 100644 --- a/mysql-test/suite/jp/t/jp_trim_sjis.test +++ b/mysql-test/suite/jp/t/jp_trim_sjis.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --character_set sjis --disable_warnings drop table if exists `俿侾`; diff --git a/mysql-test/suite/jp/t/jp_trim_ucs2.test b/mysql-test/suite/jp/t/jp_trim_ucs2.test index 1d8a12650e0..7c82c249dcc 100644 --- a/mysql-test/suite/jp/t/jp_trim_ucs2.test +++ b/mysql-test/suite/jp/t/jp_trim_ucs2.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --source include/have_ucs2.inc --disable_warnings diff --git a/mysql-test/suite/jp/t/jp_trim_ujis.test b/mysql-test/suite/jp/t/jp_trim_ujis.test index de401217fcf..bcd9942f0ae 100644 --- a/mysql-test/suite/jp/t/jp_trim_ujis.test +++ b/mysql-test/suite/jp/t/jp_trim_ujis.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --source include/have_ujis.inc --disable_warnings diff --git a/mysql-test/suite/jp/t/jp_trim_utf8.test b/mysql-test/suite/jp/t/jp_trim_utf8.test index 0777de15c36..f6f487254bc 100644 --- a/mysql-test/suite/jp/t/jp_trim_utf8.test +++ b/mysql-test/suite/jp/t/jp_trim_utf8.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --disable_warnings drop table if exists `锛达紤`; drop table if exists `锛达紥`; diff --git a/mysql-test/suite/jp/t/jp_union_ujis.test b/mysql-test/suite/jp/t/jp_union_ujis.test index e36d18c85c0..c1252b9f5a2 100644 --- a/mysql-test/suite/jp/t/jp_union_ujis.test +++ b/mysql-test/suite/jp/t/jp_union_ujis.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --source include/have_ujis.inc --disable_warnings diff --git a/mysql-test/suite/jp/t/jp_update_sjis.test b/mysql-test/suite/jp/t/jp_update_sjis.test index 0dc7372ae92..4b3733cff76 100644 --- a/mysql-test/suite/jp/t/jp_update_sjis.test +++ b/mysql-test/suite/jp/t/jp_update_sjis.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --character_set sjis --disable_warnings drop table if exists `俿侾`; diff --git a/mysql-test/suite/jp/t/jp_update_ucs2.test b/mysql-test/suite/jp/t/jp_update_ucs2.test index 7a3c1233210..6ad7db9c5a0 100644 --- a/mysql-test/suite/jp/t/jp_update_ucs2.test +++ b/mysql-test/suite/jp/t/jp_update_ucs2.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --source include/have_ucs2.inc --disable_warnings diff --git a/mysql-test/suite/jp/t/jp_update_ujis.test b/mysql-test/suite/jp/t/jp_update_ujis.test index 852e45b9eeb..14ca6580f04 100644 --- a/mysql-test/suite/jp/t/jp_update_ujis.test +++ b/mysql-test/suite/jp/t/jp_update_ujis.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --source include/have_ujis.inc --disable_warnings diff --git a/mysql-test/suite/jp/t/jp_update_utf8.test b/mysql-test/suite/jp/t/jp_update_utf8.test index b4b3d18ecab..135f6e6981c 100644 --- a/mysql-test/suite/jp/t/jp_update_utf8.test +++ b/mysql-test/suite/jp/t/jp_update_utf8.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --disable_warnings drop table if exists `锛达紤`; drop table if exists `锛达紥`; diff --git a/mysql-test/suite/jp/t/jp_where_sjis.test b/mysql-test/suite/jp/t/jp_where_sjis.test index 452d137f643..890a4c28f3c 100644 --- a/mysql-test/suite/jp/t/jp_where_sjis.test +++ b/mysql-test/suite/jp/t/jp_where_sjis.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --character_set sjis --disable_warnings drop table if exists `俿侾`; diff --git a/mysql-test/suite/jp/t/jp_where_ucs2.test b/mysql-test/suite/jp/t/jp_where_ucs2.test index 3b82eacd615..7d90faaaa89 100644 --- a/mysql-test/suite/jp/t/jp_where_ucs2.test +++ b/mysql-test/suite/jp/t/jp_where_ucs2.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --source include/have_ucs2.inc --disable_warnings diff --git a/mysql-test/suite/jp/t/jp_where_ujis.test b/mysql-test/suite/jp/t/jp_where_ujis.test index e96404fbb17..2f0924e8c8e 100644 --- a/mysql-test/suite/jp/t/jp_where_ujis.test +++ b/mysql-test/suite/jp/t/jp_where_ujis.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --source include/have_ujis.inc --disable_warnings diff --git a/mysql-test/suite/jp/t/jp_where_utf8.test b/mysql-test/suite/jp/t/jp_where_utf8.test index 7280bc33f21..231553e8819 100644 --- a/mysql-test/suite/jp/t/jp_where_utf8.test +++ b/mysql-test/suite/jp/t/jp_where_utf8.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_bdb.inc --disable_warnings drop table if exists `锛达紤`; drop table if exists `锛达紥`; From 16c57d9099c4fee924be5b66642296850d922235 Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Wed, 9 Sep 2009 14:38:50 +0500 Subject: [PATCH 58/68] BUG#45638 - Create temporary table with engine innodb fails Create temporary InnoDB table fails on case insensitive filesystems, when lower_case_table_names is 2 (e.g. OS X) and temporary directory path contains upper case letters. The problem was that tmpdir prefix was converted to lower case when table was created, but was passed as is when table was opened. Fixed by leaving tmpdir prefix part intact. --- .../r/lowercase_mixed_tmpdir_innodb.result | 6 ++++ .../lowercase_mixed_tmpdir_innodb-master.opt | 2 ++ .../t/lowercase_mixed_tmpdir_innodb-master.sh | 6 ++++ .../t/lowercase_mixed_tmpdir_innodb.test | 12 ++++++++ sql/handler.cc | 30 +++++++++++++++++++ 5 files changed, 56 insertions(+) create mode 100755 mysql-test/r/lowercase_mixed_tmpdir_innodb.result create mode 100644 mysql-test/t/lowercase_mixed_tmpdir_innodb-master.opt create mode 100644 mysql-test/t/lowercase_mixed_tmpdir_innodb-master.sh create mode 100644 mysql-test/t/lowercase_mixed_tmpdir_innodb.test diff --git a/mysql-test/r/lowercase_mixed_tmpdir_innodb.result b/mysql-test/r/lowercase_mixed_tmpdir_innodb.result new file mode 100755 index 00000000000..a478b49cfda --- /dev/null +++ b/mysql-test/r/lowercase_mixed_tmpdir_innodb.result @@ -0,0 +1,6 @@ +drop table if exists t1; +create table t1 (id int) engine=InnoDB; +insert into t1 values (1); +create temporary table t2 engine=InnoDB select * from t1; +drop temporary table t2; +drop table t1; diff --git a/mysql-test/t/lowercase_mixed_tmpdir_innodb-master.opt b/mysql-test/t/lowercase_mixed_tmpdir_innodb-master.opt new file mode 100644 index 00000000000..272f91d629c --- /dev/null +++ b/mysql-test/t/lowercase_mixed_tmpdir_innodb-master.opt @@ -0,0 +1,2 @@ +--lower-case-table-names=2 +--tmpdir=$MYSQLTEST_VARDIR/tmp/MixedCase diff --git a/mysql-test/t/lowercase_mixed_tmpdir_innodb-master.sh b/mysql-test/t/lowercase_mixed_tmpdir_innodb-master.sh new file mode 100644 index 00000000000..95c26e3aa02 --- /dev/null +++ b/mysql-test/t/lowercase_mixed_tmpdir_innodb-master.sh @@ -0,0 +1,6 @@ +# This test requires a non-lowercase tmpdir directory on a case-sensitive +# filesystem. + +d="$MYSQLTEST_VARDIR/tmp/MixedCase" +test -d "$d" || mkdir "$d" +rm -f "$d"/* diff --git a/mysql-test/t/lowercase_mixed_tmpdir_innodb.test b/mysql-test/t/lowercase_mixed_tmpdir_innodb.test new file mode 100644 index 00000000000..e3b9b7b2a32 --- /dev/null +++ b/mysql-test/t/lowercase_mixed_tmpdir_innodb.test @@ -0,0 +1,12 @@ +--source include/have_lowercase2.inc +--source include/have_innodb.inc + +--disable_warnings +drop table if exists t1; +--enable_warnings + +create table t1 (id int) engine=InnoDB; +insert into t1 values (1); +create temporary table t2 engine=InnoDB select * from t1; +drop temporary table t2; +drop table t1; diff --git a/sql/handler.cc b/sql/handler.cc index e5c64452aaf..a4d88e84f4c 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -1885,12 +1885,42 @@ bool ha_flush_logs(handlerton *db_type) return FALSE; } + +/** + @brief make canonical filename + + @param[in] file table handler + @param[in] path original path + @param[out] tmp_path buffer for canonized path + + @details Lower case db name and table name path parts for + non file based tables when lower_case_table_names + is 2 (store as is, compare in lower case). + Filesystem path prefix (mysql_data_home or tmpdir) + is left intact. + + @note tmp_path may be left intact if no conversion was + performed. + + @retval canonized path + + @todo This may be done more efficiently when table path + gets built. Convert this function to something like + ASSERT_CANONICAL_FILENAME. +*/ const char *get_canonical_filename(handler *file, const char *path, char *tmp_path) { + uint i; if (lower_case_table_names != 2 || (file->ha_table_flags() & HA_FILE_BASED)) return path; + for (i= 0; i <= mysql_tmpdir_list.max; i++) + { + if (is_prefix(path, mysql_tmpdir_list.list[i])) + return path; + } + /* Ensure that table handler get path in lower case */ if (tmp_path != path) strmov(tmp_path, path); From f22baa9a1e85913b0dcafa0b651453df7ccdc7ad Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Wed, 9 Sep 2009 14:42:12 +0500 Subject: [PATCH 59/68] BUG#29203 - archive tables have weird values in show table status Archive engine returns wrong values for average record length and max data length. With this fix they're calculated as following: - max data length is 2 ^ 63 where large files are supported and INT_MAX32 where this is not supported; - average record length is data length / records in data file. --- mysql-test/r/archive.result | 11 +++++++++++ mysql-test/t/archive.test | 11 +++++++++++ storage/archive/ha_archive.cc | 5 +++-- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/archive.result b/mysql-test/r/archive.result index 8c26ea1ff82..3271e2f46d4 100644 --- a/mysql-test/r/archive.result +++ b/mysql-test/r/archive.result @@ -12695,3 +12695,14 @@ a b 1 NULL 2 NULL DROP TABLE t1; +CREATE TABLE t1(a INT, b BLOB) ENGINE=archive; +SELECT DATA_LENGTH, AVG_ROW_LENGTH FROM +INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='test'; +DATA_LENGTH AVG_ROW_LENGTH +8666 15 +INSERT INTO t1 VALUES(1, 'sampleblob1'),(2, 'sampleblob2'); +SELECT DATA_LENGTH, AVG_ROW_LENGTH FROM +INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='test'; +DATA_LENGTH AVG_ROW_LENGTH +8700 4350 +DROP TABLE t1; diff --git a/mysql-test/t/archive.test b/mysql-test/t/archive.test index 7139d95ab49..afb8e413b2c 100644 --- a/mysql-test/t/archive.test +++ b/mysql-test/t/archive.test @@ -1599,3 +1599,14 @@ INSERT INTO t1 VALUES (NULL, NULL),(NULL, NULL); FLUSH TABLE t1; SELECT * FROM t1 ORDER BY a; DROP TABLE t1; + +# +# BUG#29203 - archive tables have weird values in show table status +# +CREATE TABLE t1(a INT, b BLOB) ENGINE=archive; +SELECT DATA_LENGTH, AVG_ROW_LENGTH FROM + INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='test'; +INSERT INTO t1 VALUES(1, 'sampleblob1'),(2, 'sampleblob2'); +SELECT DATA_LENGTH, AVG_ROW_LENGTH FROM + INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='test'; +DROP TABLE t1; diff --git a/storage/archive/ha_archive.cc b/storage/archive/ha_archive.cc index 1146b2eb73a..49bf036c5a6 100644 --- a/storage/archive/ha_archive.cc +++ b/storage/archive/ha_archive.cc @@ -1472,11 +1472,12 @@ int ha_archive::info(uint flag) VOID(my_stat(share->data_file_name, &file_stat, MYF(MY_WME))); - stats.mean_rec_length= table->s->reclength + buffer.alloced_length(); stats.data_file_length= file_stat.st_size; stats.create_time= (ulong) file_stat.st_ctime; stats.update_time= (ulong) file_stat.st_mtime; - stats.max_data_file_length= share->rows_recorded * stats.mean_rec_length; + stats.mean_rec_length= stats.records ? + stats.data_file_length / stats.records : table->s->reclength; + stats.max_data_file_length= MAX_FILE_SIZE; } stats.delete_length= 0; stats.index_file_length=0; From 96c88435144750e647f28edb341a171ae049f1bf Mon Sep 17 00:00:00 2001 From: Alexander Nozdrin Date: Thu, 10 Sep 2009 11:40:57 +0400 Subject: [PATCH 60/68] A patch for Bug#45118 (mysqld.exe crashed in debug mode on Windows in dbug.c) -- part 2: a patch for the DBUG subsystem to detect misuse of DBUG_ENTER / DBUG_RETURN macros. 5.1 version. --- client/mysqltest.cc | 7 +- include/my_dbug.h | 51 ++++++++++++- sql/mysqld.cc | 4 +- sql/rpl_filter.cc | 2 + sql/set_var.cc | 1 + sql/sql_insert.cc | 85 ++++++++++++--------- sql/sql_parse.cc | 49 +++++++----- storage/ndb/src/kernel/blocks/suma/Suma.cpp | 18 ++--- 8 files changed, 144 insertions(+), 73 deletions(-) diff --git a/client/mysqltest.cc b/client/mysqltest.cc index b9535ba6b05..af2749e3191 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -1165,6 +1165,7 @@ void free_used_memory() mysql_server_end(); /* Don't use DBUG after mysql_server_end() */ + DBUG_VIOLATION_HELPER_LEAVE; return; } @@ -2487,7 +2488,7 @@ void do_source(struct st_command *command) } dynstr_free(&ds_filename); - return; + DBUG_VOID_RETURN; } @@ -7507,6 +7508,8 @@ static void init_signal_handling(void) #endif sigaction(SIGILL, &sa, NULL); sigaction(SIGFPE, &sa, NULL); + + DBUG_VOID_RETURN; } #endif /* !__WIN__ */ @@ -8121,6 +8124,8 @@ void do_get_replace_column(struct st_command *command) } my_free(start, MYF(0)); command->last_argument= command->end; + + DBUG_VOID_RETURN; } diff --git a/include/my_dbug.h b/include/my_dbug.h index a77e439b5db..71dc34791dc 100644 --- a/include/my_dbug.h +++ b/include/my_dbug.h @@ -16,6 +16,29 @@ #ifndef _dbug_h #define _dbug_h +#if defined(__cplusplus) && !defined(DBUG_OFF) +class Dbug_violation_helper +{ +public: + inline Dbug_violation_helper() : + _entered(TRUE) + { } + + inline ~Dbug_violation_helper() + { + assert(!_entered); + } + + inline void leave() + { + _entered= FALSE; + } + +private: + bool _entered; +}; +#endif /* C++ */ + #ifdef __cplusplus extern "C" { #endif @@ -47,11 +70,31 @@ extern void _db_lock_file_(void); extern void _db_unlock_file_(void); extern FILE *_db_fp_(void); -#define DBUG_ENTER(a) const char *_db_func_, *_db_file_; uint _db_level_; \ - char **_db_framep_; \ - _db_enter_ (a,__FILE__,__LINE__,&_db_func_,&_db_file_,&_db_level_, \ - &_db_framep_) +#ifdef __cplusplus + +#define DBUG_ENTER(a) \ + const char *_db_func_, *_db_file_; \ + uint _db_level_; \ + char **_db_framep_; \ + Dbug_violation_helper dbug_violation_helper; \ + _db_enter_ (a, __FILE__, __LINE__, &_db_func_, &_db_file_, \ + &_db_level_, &_db_framep_) +#define DBUG_VIOLATION_HELPER_LEAVE dbug_violation_helper.leave() + +#else /* C */ + +#define DBUG_ENTER(a) \ + const char *_db_func_, *_db_file_; \ + uint _db_level_; \ + char **_db_framep_; \ + _db_enter_ (a, __FILE__, __LINE__, &_db_func_, &_db_file_, \ + &_db_level_, &_db_framep_) +#define DBUG_VIOLATION_HELPER_LEAVE do { } while(0) + +#endif /* C++ */ + #define DBUG_LEAVE \ + DBUG_VIOLATION_HELPER_LEAVE; \ _db_return_ (__LINE__, &_db_func_, &_db_file_, &_db_level_) #define DBUG_RETURN(a1) do {DBUG_LEAVE; return(a1);} while(0) #define DBUG_VOID_RETURN do {DBUG_LEAVE; return;} while(0) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 3e2f8eabd39..3f536f01094 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -4789,10 +4789,10 @@ static bool read_init_file(char *file_name) DBUG_ENTER("read_init_file"); DBUG_PRINT("enter",("name: %s",file_name)); if (!(file=my_fopen(file_name,O_RDONLY,MYF(MY_WME)))) - return(1); + DBUG_RETURN(TRUE); bootstrap(file); (void) my_fclose(file,MYF(MY_WME)); - return 0; + DBUG_RETURN(FALSE); } diff --git a/sql/rpl_filter.cc b/sql/rpl_filter.cc index 3004a3905e5..68272c58bb1 100644 --- a/sql/rpl_filter.cc +++ b/sql/rpl_filter.cc @@ -350,6 +350,7 @@ Rpl_filter::add_do_db(const char* table_spec) DBUG_ENTER("Rpl_filter::add_do_db"); i_string *db = new i_string(table_spec); do_db.push_back(db); + DBUG_VOID_RETURN; } @@ -359,6 +360,7 @@ Rpl_filter::add_ignore_db(const char* table_spec) DBUG_ENTER("Rpl_filter::add_ignore_db"); i_string *db = new i_string(table_spec); ignore_db.push_back(db); + DBUG_VOID_RETURN; } extern "C" uchar *get_table_key(const uchar *, size_t *, my_bool); diff --git a/sql/set_var.cc b/sql/set_var.cc index 0b89333ce03..b64b54fdd29 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -1238,6 +1238,7 @@ void fix_slave_exec_mode(enum_var_type type) } if (bit_is_set(slave_exec_mode_options, SLAVE_EXEC_MODE_IDEMPOTENT) == 0) bit_do_set(slave_exec_mode_options, SLAVE_EXEC_MODE_STRICT); + DBUG_VOID_RETURN; } diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index b79b9b1ae9e..3ac40ae825a 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -2274,44 +2274,9 @@ void kill_delayed_threads(void) } -/* - * Create a new delayed insert thread -*/ - -pthread_handler_t handle_delayed_insert(void *arg) +static void handle_delayed_insert_impl(THD *thd, Delayed_insert *di) { - Delayed_insert *di=(Delayed_insert*) arg; - THD *thd= &di->thd; - - pthread_detach_this_thread(); - /* Add thread to THD list so that's it's visible in 'show processlist' */ - pthread_mutex_lock(&LOCK_thread_count); - thd->thread_id= thd->variables.pseudo_thread_id= thread_id++; - thd->set_current_time(); - threads.append(thd); - thd->killed=abort_loop ? THD::KILL_CONNECTION : THD::NOT_KILLED; - pthread_mutex_unlock(&LOCK_thread_count); - - /* - Wait until the client runs into pthread_cond_wait(), - where we free it after the table is opened and di linked in the list. - If we did not wait here, the client might detect the opened table - before it is linked to the list. It would release LOCK_delayed_create - and allow another thread to create another handler for the same table, - since it does not find one in the list. - */ - pthread_mutex_lock(&di->mutex); -#if !defined( __WIN__) /* Win32 calls this in pthread_create */ - if (my_thread_init()) - { - /* Can't use my_error since store_globals has not yet been called */ - thd->main_da.set_error_status(thd, ER_OUT_OF_RESOURCES, - ER(ER_OUT_OF_RESOURCES)); - goto end; - } -#endif - - DBUG_ENTER("handle_delayed_insert"); + DBUG_ENTER("handle_delayed_insert_impl"); thd->thread_stack= (char*) &thd; if (init_thr_lock() || thd->store_globals()) { @@ -2500,6 +2465,49 @@ err: */ ha_autocommit_or_rollback(thd, 1); + DBUG_VOID_RETURN; +} + + +/* + * Create a new delayed insert thread +*/ + +pthread_handler_t handle_delayed_insert(void *arg) +{ + Delayed_insert *di=(Delayed_insert*) arg; + THD *thd= &di->thd; + + pthread_detach_this_thread(); + /* Add thread to THD list so that's it's visible in 'show processlist' */ + pthread_mutex_lock(&LOCK_thread_count); + thd->thread_id= thd->variables.pseudo_thread_id= thread_id++; + thd->set_current_time(); + threads.append(thd); + thd->killed=abort_loop ? THD::KILL_CONNECTION : THD::NOT_KILLED; + pthread_mutex_unlock(&LOCK_thread_count); + + /* + Wait until the client runs into pthread_cond_wait(), + where we free it after the table is opened and di linked in the list. + If we did not wait here, the client might detect the opened table + before it is linked to the list. It would release LOCK_delayed_create + and allow another thread to create another handler for the same table, + since it does not find one in the list. + */ + pthread_mutex_lock(&di->mutex); +#if !defined( __WIN__) /* Win32 calls this in pthread_create */ + if (my_thread_init()) + { + /* Can't use my_error since store_globals has not yet been called */ + thd->main_da.set_error_status(thd, ER_OUT_OF_RESOURCES, + ER(ER_OUT_OF_RESOURCES)); + goto end; + } +#endif + + handle_delayed_insert_impl(thd, di); + #ifndef __WIN__ end: #endif @@ -2523,7 +2531,8 @@ end: my_thread_end(); pthread_exit(0); - DBUG_RETURN(0); + + return 0; } diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index ca27d476213..a977740ebe2 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -408,29 +408,12 @@ void execute_init_command(THD *thd, sys_var_str *init_command_var, } -/** - Execute commands from bootstrap_file. - - Used when creating the initial grant tables. -*/ - -pthread_handler_t handle_bootstrap(void *arg) +static void handle_bootstrap_impl(THD *thd) { - THD *thd=(THD*) arg; FILE *file=bootstrap_file; char *buff; const char* found_semicolon= NULL; - /* The following must be called before DBUG_ENTER */ - thd->thread_stack= (char*) &thd; - if (my_thread_init() || thd->store_globals()) - { -#ifndef EMBEDDED_LIBRARY - close_connection(thd, ER_OUT_OF_RESOURCES, 1); -#endif - thd->fatal_error(); - goto end; - } DBUG_ENTER("handle_bootstrap"); #ifndef EMBEDDED_LIBRARY @@ -525,6 +508,33 @@ pthread_handler_t handle_bootstrap(void *arg) #endif } + DBUG_VOID_RETURN; +} + + +/** + Execute commands from bootstrap_file. + + Used when creating the initial grant tables. +*/ + +pthread_handler_t handle_bootstrap(void *arg) +{ + THD *thd=(THD*) arg; + + /* The following must be called before DBUG_ENTER */ + thd->thread_stack= (char*) &thd; + if (my_thread_init() || thd->store_globals()) + { +#ifndef EMBEDDED_LIBRARY + close_connection(thd, ER_OUT_OF_RESOURCES, 1); +#endif + thd->fatal_error(); + goto end; + } + + handle_bootstrap_impl(thd); + end: net_end(&thd->net); thd->cleanup(); @@ -539,7 +549,8 @@ end: my_thread_end(); pthread_exit(0); #endif - DBUG_RETURN(0); + + return 0; } diff --git a/storage/ndb/src/kernel/blocks/suma/Suma.cpp b/storage/ndb/src/kernel/blocks/suma/Suma.cpp index 5f0510cf43a..9179cf7fbbd 100644 --- a/storage/ndb/src/kernel/blocks/suma/Suma.cpp +++ b/storage/ndb/src/kernel/blocks/suma/Suma.cpp @@ -274,7 +274,7 @@ Suma::execSTTOR(Signal* signal) { jam(); send_start_me_req(signal); - return; + DBUG_VOID_RETURN; } } @@ -322,7 +322,7 @@ Suma::execSTTOR(Signal* signal) { if (ERROR_INSERTED(13030)) { ndbout_c("Dont start handover"); - return; + DBUG_VOID_RETURN; } }//if @@ -332,7 +332,7 @@ Suma::execSTTOR(Signal* signal) { * Allow API's to connect */ sendSTTORRY(signal); - return; + DBUG_VOID_RETURN; } if(startphase == 101) @@ -345,7 +345,7 @@ Suma::execSTTOR(Signal* signal) { */ c_startup.m_wait_handover= true; check_start_handover(signal); - return; + DBUG_VOID_RETURN; } } sendSTTORRY(signal); @@ -575,19 +575,19 @@ void Suma::execAPI_FAILREQ(Signal* signal) jam(); sendSignalWithDelay(reference(), GSN_API_FAILREQ, signal, 200, signal->getLength()); - return; + DBUG_VOID_RETURN; } if (c_failedApiNodes.get(failedApiNode)) { jam(); - return; + DBUG_VOID_RETURN; } if (!c_subscriber_nodes.get(failedApiNode)) { jam(); - return; + DBUG_VOID_RETURN; } c_failedApiNodes.set(failedApiNode); @@ -2453,7 +2453,7 @@ Suma::execSUB_START_REQ(Signal* signal){ jam(); c_subscriberPool.release(subbPtr); sendSubStartRef(signal, SubStartRef::PartiallyConnected); - return; + DBUG_VOID_RETURN; } DBUG_PRINT("info",("c_subscriberPool size: %d free: %d", @@ -4289,7 +4289,7 @@ Suma::Restart::runSUMA_START_ME_REQ(Signal* signal, Uint32 sumaRef) ref->errorCode = SumaStartMeRef::Busy; suma.sendSignal(sumaRef, GSN_SUMA_START_ME_REF, signal, SumaStartMeRef::SignalLength, JBB); - return; + DBUG_VOID_RETURN; } nodeId = refToNode(sumaRef); From 242bb2634c8480c5f1b5bf13649eb0f47d9ac2e9 Mon Sep 17 00:00:00 2001 From: Sergey Glukhov Date: Thu, 10 Sep 2009 13:49:49 +0500 Subject: [PATCH 61/68] Bug#42364 SHOW ERRORS returns empty resultset after dropping non existent table partial backport of bug43138 fix --- mysql-test/r/warnings.result | 5 +++++ mysql-test/t/warnings.test | 7 +++++++ sql/sql_class.cc | 25 +++++++++++++++++++++++++ sql/sql_class.h | 25 +++++++++++++++++++++++++ sql/sql_table.cc | 8 ++++---- 5 files changed, 66 insertions(+), 4 deletions(-) diff --git a/mysql-test/r/warnings.result b/mysql-test/r/warnings.result index 2e393aea9e4..8a87852d582 100644 --- a/mysql-test/r/warnings.result +++ b/mysql-test/r/warnings.result @@ -313,4 +313,9 @@ ERROR 22001: Data too long for column 'c_tinytext' at row 1 insert into t2 values(@q); ERROR 22001: Data too long for column 'c_tinyblob' at row 1 drop table t1, t2; +DROP TABLE t1; +ERROR 42S02: Unknown table 't1' +SHOW ERRORS; +Level Code Message +Error 1051 Unknown table 't1' End of 5.0 tests diff --git a/mysql-test/t/warnings.test b/mysql-test/t/warnings.test index 12421170eba..176f320e390 100644 --- a/mysql-test/t/warnings.test +++ b/mysql-test/t/warnings.test @@ -225,4 +225,11 @@ insert into t2 values(@q); drop table t1, t2; +# +# Bug#42364 SHOW ERRORS returns empty resultset after dropping non existent table +# +--error ER_BAD_TABLE_ERROR +DROP TABLE t1; +SHOW ERRORS; + --echo End of 5.0 tests diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 3f568566c89..daef5a26742 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -399,6 +399,31 @@ char *thd_security_context(THD *thd, char *buffer, unsigned int length, return buffer; } + +/** + Implementation of Drop_table_error_handler::handle_error(). + The reason in having this implementation is to silence technical low-level + warnings during DROP TABLE operation. Currently we don't want to expose + the following warnings during DROP TABLE: + - Some of table files are missed or invalid (the table is going to be + deleted anyway, so why bother that something was missed); + - A trigger associated with the table does not have DEFINER (One of the + MySQL specifics now is that triggers are loaded for the table being + dropped. So, we may have a warning that trigger does not have DEFINER + attribute during DROP TABLE operation). + + @return TRUE if the condition is handled. +*/ +bool Drop_table_error_handler::handle_error(uint sql_errno, + const char *message, + MYSQL_ERROR::enum_warning_level level, + THD *thd) +{ + return ((sql_errno == EE_DELETE && my_errno == ENOENT) || + sql_errno == ER_TRG_NO_DEFINER); +} + + /** Clear this diagnostics area. diff --git a/sql/sql_class.h b/sql/sql_class.h index f52d5fae76f..c38eb17f191 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -1091,6 +1091,31 @@ public: }; +/** + This class is an internal error handler implementation for + DROP TABLE statements. The thing is that there may be warnings during + execution of these statements, which should not be exposed to the user. + This class is intended to silence such warnings. +*/ + +class Drop_table_error_handler : public Internal_error_handler +{ +public: + Drop_table_error_handler(Internal_error_handler *err_handler) + :m_err_handler(err_handler) + { } + +public: + bool handle_error(uint sql_errno, + const char *message, + MYSQL_ERROR::enum_warning_level level, + THD *thd); + +private: + Internal_error_handler *m_err_handler; +}; + + /** Stores status of the currently executed statement. Cleared at the beginning of the statement, and then diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 89a84ebc1fe..41e76211dd8 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -1772,6 +1772,7 @@ bool mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists, my_bool drop_temporary) { bool error= FALSE, need_start_waiters= FALSE; + Drop_table_error_handler err_handler(thd->get_internal_handler()); DBUG_ENTER("mysql_rm_table"); /* mark for close and remove all cached entries */ @@ -1792,7 +1793,10 @@ bool mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists, LOCK_open during wait_if_global_read_lock(), other threads could not close their tables. This would make a pretty deadlock. */ + thd->push_internal_handler(&err_handler); error= mysql_rm_table_part2(thd, tables, if_exists, drop_temporary, 0, 0); + thd->pop_internal_handler(); + if (need_start_waiters) start_waiting_global_read_lock(thd); @@ -1894,9 +1898,6 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists, DBUG_RETURN(1); } - /* Don't give warnings for not found errors, as we already generate notes */ - thd->no_warnings_for_error= 1; - for (table= tables; table; table= table->next_local) { char *db=table->db; @@ -2145,7 +2146,6 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists, err_with_placeholders: unlock_table_names(thd, tables, (TABLE_LIST*) 0); pthread_mutex_unlock(&LOCK_open); - thd->no_warnings_for_error= 0; DBUG_RETURN(error); } From df67d14983bb7ce1d879da6b6a9f861cc76a1ec2 Mon Sep 17 00:00:00 2001 From: Date: Thu, 10 Sep 2009 18:05:53 +0800 Subject: [PATCH 62/68] BUG#45999 Row based replication fails when auto_increment field = 0 In RBR, There is an inconsistency between slaves and master. When INSERT statement which includes an auto_increment field is executed, Store engine of master will check the value of the auto_increment field. It will generate a sequence number and then replace the value, if its value is NULL or empty. if the field's value is 0, the store engine will do like encountering the NULL values unless NO_AUTO_VALUE_ON_ZERO is set into SQL_MODE. In contrast, if the field's value is 0, Store engine of slave always generates a new sequence number whether or not NO_AUTO_VALUE_ON_ZERO is set into SQL_MODE. SQL MODE of slave sql thread is always consistency with master's. Another variable is related to this bug. If generateing a sequence number is decided by the values of table->auto_increment_field_not_null and SQL_MODE(if includes MODE_NO_AUTO_VALUE_ON_ZERO) The table->auto_increment_is_not_null is FALSE, which causes this bug to appear. .. --- .../extra/rpl_tests/rpl_auto_increment.test | 78 ++++++++++++++++++- .../suite/rpl/r/rpl_auto_increment.result | 68 ++++++++++++++++ sql/log_event.cc | 11 +++ 3 files changed, 156 insertions(+), 1 deletion(-) diff --git a/mysql-test/extra/rpl_tests/rpl_auto_increment.test b/mysql-test/extra/rpl_tests/rpl_auto_increment.test index 24448a38408..abf3b4ec676 100644 --- a/mysql-test/extra/rpl_tests/rpl_auto_increment.test +++ b/mysql-test/extra/rpl_tests/rpl_auto_increment.test @@ -163,5 +163,81 @@ show create table t1; connection master; drop table t1; -# End cleanup +# +# BUG#45999 Row based replication fails when auto_increment field = 0. +# Store engine of Slaves auto-generates new sequence numbers for +# auto_increment fields if the values of them are 0. There is an inconsistency +# between slave and master. When MODE_NO_AUTO_VALUE_ON_ZERO are masters treat +# +source include/master-slave-reset.inc; + +connection master; +--disable_warnings +DROP TABLE IF EXISTS t1; +DROP TABLE IF EXISTS t2; +--enable_warnings + +eval CREATE TABLE t1 (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY) ENGINE=$engine_type; +eval CREATE TABLE t2 (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY) ENGINE=$engine_type2; +SET SQL_MODE=''; +# Value of the id will be 1; +INSERT INTO t1 VALUES(NULL); +INSERT INTO t2 VALUES(NULL); +SELECT * FROM t1; +SELECT * FROM t2; +# Value of the id will be 2; +INSERT INTO t1 VALUES(); +INSERT INTO t2 VALUES(); +SELECT * FROM t1; +SELECT * FROM t2; +# Value of the id will be 3. The master treats 0 as NULL or empty because +# NO_AUTO_VALUE_ON_ZERO is not assign to SQL_MODE. +INSERT INTO t1 VALUES(0); +INSERT INTO t2 VALUES(0); +SELECT * FROM t1; +SELECT * FROM t2; + +SET SQL_MODE=NO_AUTO_VALUE_ON_ZERO; +# Value of the id will be 0. The master does not treat 0 as NULL or empty +# because NO_AUTO_VALUE_ON_ZERO has assigned to SQL_MODE. +INSERT INTO t1 VALUES(0); +INSERT INTO t2 VALUES(0); +SELECT * FROM t1; +SELECT * FROM t2; + +INSERT INTO t1 VALUES(4); +INSERT INTO t2 VALUES(4); +FLUSH LOGS; +sync_slave_with_master; + +let $diff_table_1= master:test.t1; +let $diff_table_2= slave:test.t1; +source include/diff_tables.inc; + +let $diff_table_1= master:test.t2; +let $diff_table_2= slave:test.t2; +source include/diff_tables.inc; + +connection master; +DROP TABLE t1; +DROP TABLE t2; +sync_slave_with_master; + +connection master; +let $MYSQLD_DATADIR= `SELECT @@DATADIR`; +--exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 | $MYSQL test +sync_slave_with_master; + +let $diff_table_1= master:test.t1; +let $diff_table_2= slave:test.t1; +source include/diff_tables.inc; + +let $diff_table_1= master:test.t2; +let $diff_table_2= slave:test.t2; +source include/diff_tables.inc; + +# End cleanup +DROP TABLE t1; +DROP TABLE t2; +SET SQL_MODE=''; sync_slave_with_master; diff --git a/mysql-test/suite/rpl/r/rpl_auto_increment.result b/mysql-test/suite/rpl/r/rpl_auto_increment.result index 2a4c3a09361..fdd94264041 100644 --- a/mysql-test/suite/rpl/r/rpl_auto_increment.result +++ b/mysql-test/suite/rpl/r/rpl_auto_increment.result @@ -244,3 +244,71 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 drop table t1; +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; +DROP TABLE IF EXISTS t1; +DROP TABLE IF EXISTS t2; +CREATE TABLE t1 (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY) ENGINE=innodb; +CREATE TABLE t2 (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY) ENGINE=myisam; +SET SQL_MODE=''; +INSERT INTO t1 VALUES(NULL); +INSERT INTO t2 VALUES(NULL); +SELECT * FROM t1; +id +1 +SELECT * FROM t2; +id +1 +INSERT INTO t1 VALUES(); +INSERT INTO t2 VALUES(); +SELECT * FROM t1; +id +1 +2 +SELECT * FROM t2; +id +1 +2 +INSERT INTO t1 VALUES(0); +INSERT INTO t2 VALUES(0); +SELECT * FROM t1; +id +1 +2 +3 +SELECT * FROM t2; +id +1 +2 +3 +SET SQL_MODE=NO_AUTO_VALUE_ON_ZERO; +INSERT INTO t1 VALUES(0); +INSERT INTO t2 VALUES(0); +SELECT * FROM t1; +id +0 +1 +2 +3 +SELECT * FROM t2; +id +0 +1 +2 +3 +INSERT INTO t1 VALUES(4); +INSERT INTO t2 VALUES(4); +FLUSH LOGS; +Comparing tables master:test.t1 and slave:test.t1 +Comparing tables master:test.t2 and slave:test.t2 +DROP TABLE t1; +DROP TABLE t2; +Comparing tables master:test.t1 and slave:test.t1 +Comparing tables master:test.t2 and slave:test.t2 +DROP TABLE t1; +DROP TABLE t2; +SET SQL_MODE=''; diff --git a/sql/log_event.cc b/sql/log_event.cc index 0cda724b698..08fe3aba8ed 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -8312,6 +8312,16 @@ Write_rows_log_event::do_before_row_operations(const Slave_reporting_capability /* Honor next number column if present */ m_table->next_number_field= m_table->found_next_number_field; + /* + * Fixed Bug#45999, In RBR, Store engine of Slave auto-generates new + * sequence numbers for auto_increment fields if the values of them are 0. + * If generateing a sequence number is decided by the values of + * table->auto_increment_field_not_null and SQL_MODE(if includes + * MODE_NO_AUTO_VALUE_ON_ZERO) in update_auto_increment function. + * SQL_MODE of slave sql thread is always consistency with master's. + * In RBR, auto_increment fields never are NULL. + */ + m_table->auto_increment_field_not_null= TRUE; return error; } @@ -8321,6 +8331,7 @@ Write_rows_log_event::do_after_row_operations(const Slave_reporting_capability * { int local_error= 0; m_table->next_number_field=0; + m_table->auto_increment_field_not_null= FALSE; if (bit_is_set(slave_exec_mode, SLAVE_EXEC_MODE_IDEMPOTENT) == 1 || m_table->s->db_type()->db_type == DB_TYPE_NDBCLUSTER) { From 5fbc2904bccbcd5e3609a4a660105ccab117c7c6 Mon Sep 17 00:00:00 2001 From: Sergey Glukhov Date: Thu, 10 Sep 2009 15:24:07 +0500 Subject: [PATCH 63/68] Bug#46815 CONCAT_WS returning wrong data The problem is that argument buffer can be used as result buffer and it leads to argument value change. The fix is to use 'old buffer' as result buffer only if first argument is not constant item. --- mysql-test/r/func_str.result | 9 +++++++++ mysql-test/t/func_str.test | 13 +++++++++++++ sql/item_strfunc.cc | 7 ++++++- 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result index 75f8983e838..bf2a9ca8901 100644 --- a/mysql-test/r/func_str.result +++ b/mysql-test/r/func_str.result @@ -2196,4 +2196,13 @@ SELECT LOAD_FILE(a) FROM t1; LOAD_FILE(a) NULL DROP TABLE t1; +CREATE TABLE t1 (f2 VARCHAR(20)); +CREATE TABLE t2 (f2 VARCHAR(20)); +INSERT INTO t1 VALUES ('MIN'),('MAX'); +INSERT INTO t2 VALUES ('LOAD'); +SELECT CONCAT_WS('_', (SELECT t2.f2 FROM t2), t1.f2) AS concat_name FROM t1; +concat_name +LOAD_MIN +LOAD_MAX +DROP TABLE t1, t2; End of 5.0 tests diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test index 4b0f91e4408..e396fbcebd8 100644 --- a/mysql-test/t/func_str.test +++ b/mysql-test/t/func_str.test @@ -1177,5 +1177,18 @@ INSERT INTO t1 VALUES ('aaaaaaaa'); SELECT LOAD_FILE(a) FROM t1; DROP TABLE t1; +# +# Bug#46815 CONCAT_WS returning wrong data +# +CREATE TABLE t1 (f2 VARCHAR(20)); +CREATE TABLE t2 (f2 VARCHAR(20)); + +INSERT INTO t1 VALUES ('MIN'),('MAX'); +INSERT INTO t2 VALUES ('LOAD'); + +SELECT CONCAT_WS('_', (SELECT t2.f2 FROM t2), t1.f2) AS concat_name FROM t1; + +DROP TABLE t1, t2; + --echo End of 5.0 tests diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index e3fe67f4324..6f697a1665a 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -600,6 +600,7 @@ String *Item_func_concat_ws::val_str(String *str) String tmp_sep_str(tmp_str_buff, sizeof(tmp_str_buff),default_charset_info), *sep_str, *res, *res2,*use_as_buff; uint i; + bool is_const= 0; null_value=0; if (!(sep_str= args[0]->val_str(&tmp_sep_str))) @@ -613,7 +614,11 @@ String *Item_func_concat_ws::val_str(String *str) // If not, return the empty string for (i=1; i < arg_count; i++) if ((res= args[i]->val_str(str))) + { + is_const= args[i]->const_item() || !args[i]->used_tables(); break; + } + if (i == arg_count) return &my_empty_string; @@ -631,7 +636,7 @@ String *Item_func_concat_ws::val_str(String *str) current_thd->variables.max_allowed_packet); goto null; } - if (res->alloced_length() >= + if (!is_const && res->alloced_length() >= res->length() + sep_str->length() + res2->length()) { // Use old buffer res->append(*sep_str); // res->length() > 0 always From 0bd2467ea2870aa6ab20bc8096591f6a177730cb Mon Sep 17 00:00:00 2001 From: Alexander Nozdrin Date: Thu, 10 Sep 2009 16:18:54 +0400 Subject: [PATCH 64/68] Add DBUG_VIOLATION_HELPER_LEAVE definition to non-debug build. --- include/my_dbug.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/my_dbug.h b/include/my_dbug.h index 71dc34791dc..474a46f29dd 100644 --- a/include/my_dbug.h +++ b/include/my_dbug.h @@ -128,6 +128,7 @@ extern FILE *_db_fp_(void); #define DBUG_ENTER(a1) #define DBUG_LEAVE +#define DBUG_VIOLATION_HELPER_LEAVE #define DBUG_RETURN(a1) do { return(a1); } while(0) #define DBUG_VOID_RETURN do { return; } while(0) #define DBUG_EXECUTE(keyword,a1) do { } while(0) From 4def19eeac03c09c6db0c5b52bff25909dacb177 Mon Sep 17 00:00:00 2001 From: Ramil Kalimullin Date: Fri, 11 Sep 2009 22:06:27 +0500 Subject: [PATCH 65/68] Fix for bug#47130: misplaced or redundant check for null pointer? Problem: LOGGER::general_log_write() relied on valid "thd" parameter passed but had inconsistent "if (thd)" check. Fix: as we always pass a valid "thd" parameter to the method, redundant check removed. --- sql/log.cc | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/sql/log.cc b/sql/log.cc index 1af2f3a4ddc..feaa5499912 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -1024,14 +1024,10 @@ bool LOGGER::general_log_write(THD *thd, enum enum_server_command command, Log_event_handler **current_handler= general_log_handler_list; char user_host_buff[MAX_USER_HOST_SIZE + 1]; Security_context *sctx= thd->security_ctx; - ulong id; uint user_host_len= 0; time_t current_time; - if (thd) - id= thd->thread_id; /* Normal thread */ - else - id= 0; /* Log from connect handler */ + DBUG_ASSERT(thd); lock_shared(); if (!opt_log) @@ -1050,7 +1046,7 @@ bool LOGGER::general_log_write(THD *thd, enum enum_server_command command, while (*current_handler) error|= (*current_handler++)-> log_general(thd, current_time, user_host_buff, - user_host_len, id, + user_host_len, thd->thread_id, command_name[(uint) command].str, command_name[(uint) command].length, query, query_length, From 4cce928ea662ca77875954cb1c7725cdeb4df3eb Mon Sep 17 00:00:00 2001 From: Luis Soares Date: Sun, 13 Sep 2009 21:52:14 +0100 Subject: [PATCH 66/68] BUG#47014: rpl_drop_temp fails on PB-2 with results mismatch The test case creates two temporary tables, then closes the connection, waits for it to disconnect, then syncs the slave with the master, checks for remaining opened temporary tables on slave (which should be 0) and finally drops the used database (mysqltest). Unfortunately, sometimes, the test fails with one open table on the slave. This seems to be caused by the fact that waiting for the connection to be closed is not sufficient. The test needs to wait for the DROP event to be logged and only then synchronize the slave with the master and proceed with the check. This is caused by the asynchronous nature of the disconnect wrt binlogging of the DROP temporary table statement. We fix this by deploying a call to wait_for_binlog_event.inc on the test case, which makes execution to wait for the DROP temp tables event before synchronizing master and slave. --- mysql-test/suite/rpl/t/rpl_drop_temp.test | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mysql-test/suite/rpl/t/rpl_drop_temp.test b/mysql-test/suite/rpl/t/rpl_drop_temp.test index df162d3b244..7827e16e45f 100644 --- a/mysql-test/suite/rpl/t/rpl_drop_temp.test +++ b/mysql-test/suite/rpl/t/rpl_drop_temp.test @@ -23,6 +23,8 @@ disconnect con_temp; --source include/wait_until_disconnected.inc connection master; +-- let $wait_binlog_event= DROP +-- source include/wait_for_binlog_event.inc sync_slave_with_master; connection slave; From 09f07bc1107c0facc32c16c58bae0215ce08eeea Mon Sep 17 00:00:00 2001 From: Luis Soares Date: Sun, 13 Sep 2009 22:43:47 +0100 Subject: [PATCH 67/68] BUG#47016: rpl_do_grant fails on PB-2 with a failing connect The test case rpl_do_grant fails sporadically on PB2 with "Access denied for user 'create_rout_db'@'localhost' ...". Inspecting the test case, one may find that if issues a GRANT on the master connection and immediately after it creates two new connections (one to the master and one to the slave) using the credentials set with the GRANT. Unfortunately, there is no synchronization between master and slave after the grant and before the connections are established. This can result in slave not having executed the GRANT by the time the connection is attempted. This patch fixes this by deploying a sync_slave_with_master between the grant and the connections attempt. --- mysql-test/suite/rpl/t/rpl_do_grant.test | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mysql-test/suite/rpl/t/rpl_do_grant.test b/mysql-test/suite/rpl/t/rpl_do_grant.test index 806de780086..fc793c03649 100644 --- a/mysql-test/suite/rpl/t/rpl_do_grant.test +++ b/mysql-test/suite/rpl/t/rpl_do_grant.test @@ -129,6 +129,9 @@ CREATE DATABASE bug42217_db; GRANT CREATE ROUTINE ON bug42217_db.* TO 'create_rout_db'@'localhost' IDENTIFIED BY 'create_rout_db' WITH GRANT OPTION; +-- sync_slave_with_master +-- connection master + connect (create_rout_db_master, localhost, create_rout_db, create_rout_db, bug42217_db,$MASTER_MYPORT,); connect (create_rout_db_slave, localhost, create_rout_db, create_rout_db, bug42217_db, $SLAVE_MYPORT,); From eee94649585b7495e80dfc206a9bd2c05662ce22 Mon Sep 17 00:00:00 2001 From: Alexander Nozdrin Date: Wed, 16 Sep 2009 14:02:07 +0400 Subject: [PATCH 68/68] Fix default.conf --- .bzr-mysql/default.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.bzr-mysql/default.conf b/.bzr-mysql/default.conf index 39ebdda8d7a..07179ac7dea 100644 --- a/.bzr-mysql/default.conf +++ b/.bzr-mysql/default.conf @@ -1,4 +1,4 @@ [MYSQL] post_commit_to = "commits@lists.mysql.com" post_push_to = "commits@lists.mysql.com" -tree_name = "mysql-5.4" +tree_name = "mysql-5.4.3-trunk"