diff options
-rwxr-xr-x | mysql-test/mysql-test-run.pl | 2 | ||||
-rw-r--r-- | mysql-test/r/case.result | 8 | ||||
-rw-r--r-- | mysql-test/r/func_compress.result | 7 | ||||
-rw-r--r-- | mysql-test/r/rpl_temporary.result | 14 | ||||
-rw-r--r-- | mysql-test/t/case.test | 11 | ||||
-rw-r--r-- | mysql-test/t/func_compress.test | 9 | ||||
-rw-r--r-- | mysql-test/t/rpl_temporary.test | 30 | ||||
-rw-r--r-- | sql/item_cmpfunc.cc | 23 | ||||
-rw-r--r-- | sql/item_strfunc.cc | 1 | ||||
-rw-r--r-- | storage/myisam/myisam_ftdump.c | 14 |
10 files changed, 106 insertions, 13 deletions
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index a095b4535fe..c8d50990c14 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -3580,7 +3580,7 @@ sub valgrind_arguments { if ( $opt_valgrind_options ) { - mtr_add_arg($args, split(' ', $opt_valgrind_options)); + mtr_add_arg($args, '%s', $_) for (split(' ', $opt_valgrind_options)); } diff --git a/mysql-test/r/case.result b/mysql-test/r/case.result index d28c3af4e0b..9d2706f64fa 100644 --- a/mysql-test/r/case.result +++ b/mysql-test/r/case.result @@ -175,6 +175,14 @@ SELECT CASE '1' WHEN '2' THEN 'BUG' ELSE 'nobug' END; case+union+test case+union+test nobug +create table t1(a float, b int default 3); +insert into t1 (a) values (2), (11), (8); +select min(a), min(case when 1=1 then a else NULL end), +min(case when 1!=1 then NULL else a end) +from t1 where b=3 group by b; +min(a) min(case when 1=1 then a else NULL end) min(case when 1!=1 then NULL else a end) +2 2 2 +drop table t1; CREATE TABLE t1 (EMPNUM INT); INSERT INTO t1 VALUES (0), (2); CREATE TABLE t2 (EMPNUM DECIMAL (4, 2)); diff --git a/mysql-test/r/func_compress.result b/mysql-test/r/func_compress.result index 9bc8e417e19..8d6fa9927ce 100644 --- a/mysql-test/r/func_compress.result +++ b/mysql-test/r/func_compress.result @@ -72,3 +72,10 @@ set @@max_allowed_packet=1048576*100; select compress(repeat('aaaaaaaaaa', IF(XXX, 10, 10000000))) is null; compress(repeat('aaaaaaaaaa', IF(XXX, 10, 10000000))) is null 0 +create table t1(a blob); +insert into t1 values(NULL), (compress('a')); +select uncompress(a), uncompressed_length(a) from t1; +uncompress(a) uncompressed_length(a) +NULL NULL +a 1 +drop table t1; diff --git a/mysql-test/r/rpl_temporary.result b/mysql-test/r/rpl_temporary.result index bc5cc262079..929dc33c447 100644 --- a/mysql-test/r/rpl_temporary.result +++ b/mysql-test/r/rpl_temporary.result @@ -88,3 +88,17 @@ f 1 drop temporary table t4; drop table t5; +set @session.pseudo_thread_id=100; +create temporary table t101 (id int); +create temporary table t102 (id int); +set @session.pseudo_thread_id=200; +create temporary table t201 (id int); +create temporary table `#not_user_table_prefixed_with_hash_sign_no_harm` (id int); +set @con1_id=connection_id(); +kill @con1_id; +create table t1(f int); +insert into t1 values (1); +select * from t1 /* must be 1 */; +f +1 +drop table t1; diff --git a/mysql-test/t/case.test b/mysql-test/t/case.test index 42536ce8a3b..1bdfc5cc10f 100644 --- a/mysql-test/t/case.test +++ b/mysql-test/t/case.test @@ -122,6 +122,17 @@ SELECT 'case+union+test' UNION SELECT CASE '1' WHEN '2' THEN 'BUG' ELSE 'nobug' END; +# +# Bug #17896: problem with MIN(CASE...) +# + +create table t1(a float, b int default 3); +insert into t1 (a) values (2), (11), (8); +select min(a), min(case when 1=1 then a else NULL end), + min(case when 1!=1 then NULL else a end) +from t1 where b=3 group by b; +drop table t1; + # End of 4.1 tests diff --git a/mysql-test/t/func_compress.test b/mysql-test/t/func_compress.test index a78017ddb2f..4ae749f2343 100644 --- a/mysql-test/t/func_compress.test +++ b/mysql-test/t/func_compress.test @@ -47,4 +47,13 @@ set @@max_allowed_packet=1048576*100; --replace_result "''" XXX "'1'" XXX eval select compress(repeat('aaaaaaaaaa', IF('$LOW_MEMORY', 10, 10000000))) is null; +# +# Bug #18643: problem with null values +# + +create table t1(a blob); +insert into t1 values(NULL), (compress('a')); +select uncompress(a), uncompressed_length(a) from t1; +drop table t1; + # End of 4.1 tests diff --git a/mysql-test/t/rpl_temporary.test b/mysql-test/t/rpl_temporary.test index 7269b54556b..612ab54dff1 100644 --- a/mysql-test/t/rpl_temporary.test +++ b/mysql-test/t/rpl_temporary.test @@ -131,6 +131,8 @@ drop table t1,t2; create temporary table t3 (f int); sync_with_master; +# The server will now close done + # # Bug#17284 erroneous temp table cleanup on slave # @@ -156,5 +158,31 @@ connection master; drop temporary table t4; drop table t5; -# The server will now close done +# +# BUG#17263 incorrect generation DROP temp tables +# Temporary tables of connection are dropped in batches +# where a batch correspond to pseudo_thread_id +# value was set up at the moment of temp table creation +# +connection con1; +set @session.pseudo_thread_id=100; +create temporary table t101 (id int); +create temporary table t102 (id int); +set @session.pseudo_thread_id=200; +create temporary table t201 (id int); +create temporary table `#not_user_table_prefixed_with_hash_sign_no_harm` (id int); +set @con1_id=connection_id(); +kill @con1_id; + +#now do something to show that slave is ok after DROP temp tables +connection master; +create table t1(f int); +insert into t1 values (1); + +sync_slave_with_master; +#connection slave; +select * from t1 /* must be 1 */; + +connection master; +drop table t1; # End of 5.1 tests diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index acee912c912..eb26f7ff960 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -41,10 +41,25 @@ static Item_result item_store_type(Item_result a,Item_result b) static void agg_result_type(Item_result *type, Item **items, uint nitems) { - uint i; - type[0]= items[0]->result_type(); - for (i=1 ; i < nitems ; i++) - type[0]= item_store_type(type[0], items[i]->result_type()); + Item **item, **item_end; + + *type= STRING_RESULT; + /* Skip beginning NULL items */ + for (item= items, item_end= item + nitems; item < item_end; item++) + { + if ((*item)->type() != Item::NULL_ITEM) + { + *type= (*item)->result_type(); + item++; + break; + } + } + /* Combine result types. Note: NULL items don't affect the result */ + for (; item < item_end; item++) + { + if ((*item)->type() != Item::NULL_ITEM) + *type= item_store_type(type[0], (*item)->result_type()); + } } diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index cbdfdeef05f..1e483f32b02 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -2941,6 +2941,7 @@ String *Item_func_uncompress::val_str(String *str) if (!res) goto err; + null_value= 0; if (res->is_empty()) return res; diff --git a/storage/myisam/myisam_ftdump.c b/storage/myisam/myisam_ftdump.c index edf1af144d4..990971cface 100644 --- a/storage/myisam/myisam_ftdump.c +++ b/storage/myisam/myisam_ftdump.c @@ -34,20 +34,20 @@ static uint lengths[256]; static struct my_option my_long_options[] = { - {"dump", 'd', "Dump index (incl. data offsets and word weights).", + {"help", 'h', "Display help and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"stats", 's', "Report global stats.", + {"help", '?', "Synonym for -h.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"verbose", 'v', "Be verbose.", - (gptr*) &verbose, (gptr*) &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"count", 'c', "Calculate per-word stats (counts and global weights).", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"length", 'l', "Report length distribution.", + {"dump", 'd', "Dump index (incl. data offsets and word weights).", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"help", 'h', "Display help and exit.", + {"length", 'l', "Report length distribution.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"help", '?', "Synonym for -h.", + {"stats", 's', "Report global stats.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"verbose", 'v', "Be verbose.", + (gptr*) &verbose, (gptr*) &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; |