Loading client/mysqltest.c +1 −0 Original line number Diff line number Diff line Loading @@ -3914,6 +3914,7 @@ int main(int argc, char **argv) error|= run_query(&cur_con->mysql, q, QUERY_REAP|QUERY_SEND); display_result_vertically= old_display_result_vertically; q->last_argument= q->end; query_executed= 1; break; } case Q_QUERY: Loading myisam/mi_check.c +1 −1 Original line number Diff line number Diff line Loading @@ -3994,7 +3994,7 @@ void update_auto_increment_key(MI_CHECK *param, MI_INFO *info, ... The 'unique' array is collected in one sequential scan through the entire index. This is done in two places: in chk_index() and in sort_key_write(). Statistics collection may consider NULLs as either equal or inequal (see Statistics collection may consider NULLs as either equal or unequal (see SEARCH_NULL_ARE_NOT_EQUAL, MI_STATS_METHOD_*). Output is an array: Loading myisam/myisamchk.c +4 −4 Original line number Diff line number Diff line Loading @@ -67,7 +67,7 @@ static const char *field_pack[]= "no zeros", "blob", "constant", "table-lockup", "always zero","varchar","unique-hash","?","?"}; static const char *myisam_stats_method_str="nulls_inequal"; static const char *myisam_stats_method_str="nulls_unequal"; static void get_options(int *argc,char * * *argv); static void print_version(void); Loading Loading @@ -339,7 +339,7 @@ static struct my_option my_long_options[] = REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"stats_method", OPT_STATS_METHOD, "Specifies how index statistics collection code should threat NULLs. " "Possible values of name are \"nulls_inequal\" (default behavior for 4.1/5.0), and \"nulls_equal\" (emulate 4.0 behavior).", "Possible values of name are \"nulls_unequal\" (default behavior for 4.1/5.0), and \"nulls_equal\" (emulate 4.0 behavior).", (gptr*) &myisam_stats_method_str, (gptr*) &myisam_stats_method_str, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} Loading Loading @@ -471,7 +471,7 @@ static void usage(void) #include <help_end.h> const char *myisam_stats_method_names[] = {"nulls_inequal", "nulls_equal", const char *myisam_stats_method_names[] = {"nulls_unequal", "nulls_equal", NullS}; TYPELIB myisam_stats_method_typelib= { array_elements(myisam_stats_method_names) - 1, "", Loading Loading @@ -698,8 +698,8 @@ get_one_option(int optid, break; case OPT_STATS_METHOD: { myisam_stats_method_str= argument; int method; myisam_stats_method_str= argument; if ((method=find_type(argument, &myisam_stats_method_typelib, 2)) <= 0) { fprintf(stderr, "Invalid value of stats_method: %s.\n", argument); Loading mysql-test/r/func_group.result +136 −0 Original line number Diff line number Diff line Loading @@ -780,3 +780,139 @@ SELECT MAX(id) FROM t1 WHERE id < 3 AND a=2 AND b=6; MAX(id) NULL DROP TABLE t1; create table t1m (a int) engine=myisam; create table t1i (a int) engine=innodb; create table t2m (a int) engine=myisam; create table t2i (a int) engine=innodb; insert into t2m values (5); insert into t2i values (5); select min(a) from t1m; min(a) NULL select min(7) from t1m; min(7) NULL select min(7) from DUAL; min(7) NULL explain select min(7) from t2m join t1m; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away select min(7) from t2m join t1m; min(7) NULL select max(a) from t1m; max(a) NULL select max(7) from t1m; max(7) NULL select max(7) from DUAL; max(7) NULL explain select max(7) from t2m join t1m; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away select max(7) from t2m join t1m; max(7) NULL select 1, min(a) from t1m where a=99; 1 min(a) 1 NULL select 1, min(a) from t1m where 1=99; 1 min(a) 1 NULL select 1, min(1) from t1m where a=99; 1 min(1) select 1, min(1) from t1m where 1=99; 1 min(1) 1 NULL select 1, max(a) from t1m where a=99; 1 max(a) 1 NULL select 1, max(a) from t1m where 1=99; 1 max(a) 1 NULL select 1, max(1) from t1m where a=99; 1 max(1) select 1, max(1) from t1m where 1=99; 1 max(1) 1 NULL select min(a) from t1i; min(a) NULL select min(7) from t1i; min(7) NULL select min(7) from DUAL; min(7) NULL explain select min(7) from t2i join t1i; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2i ALL NULL NULL NULL NULL 1 1 SIMPLE t1i ALL NULL NULL NULL NULL 1 select min(7) from t2i join t1i; min(7) NULL select max(a) from t1i; max(a) NULL select max(7) from t1i; max(7) NULL select max(7) from DUAL; max(7) NULL explain select max(7) from t2i join t1i; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2i ALL NULL NULL NULL NULL 1 1 SIMPLE t1i ALL NULL NULL NULL NULL 1 select max(7) from t2i join t1i; max(7) NULL select 1, min(a) from t1i where a=99; 1 min(a) 1 NULL select 1, min(a) from t1i where 1=99; 1 min(a) 1 NULL select 1, min(1) from t1i where a=99; 1 min(1) 1 NULL select 1, min(1) from t1i where 1=99; 1 min(1) 1 NULL select 1, max(a) from t1i where a=99; 1 max(a) 1 NULL select 1, max(a) from t1i where 1=99; 1 max(a) 1 NULL select 1, max(1) from t1i where a=99; 1 max(1) 1 NULL select 1, max(1) from t1i where 1=99; 1 max(1) 1 NULL explain select count(*), min(7), max(7) from t1m, t1i; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1m system NULL NULL NULL NULL 0 const row not found 1 SIMPLE t1i ALL NULL NULL NULL NULL 1 select count(*), min(7), max(7) from t1m, t1i; count(*) min(7) max(7) 0 NULL NULL explain select count(*), min(7), max(7) from t1m, t2i; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1m system NULL NULL NULL NULL 0 const row not found 1 SIMPLE t2i ALL NULL NULL NULL NULL 1 select count(*), min(7), max(7) from t1m, t2i; count(*) min(7) max(7) 0 NULL NULL explain select count(*), min(7), max(7) from t2m, t1i; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2m system NULL NULL NULL NULL 1 1 SIMPLE t1i ALL NULL NULL NULL NULL 1 select count(*), min(7), max(7) from t2m, t1i; count(*) min(7) max(7) 0 NULL NULL drop table t1m, t1i, t2m, t2i; mysql-test/r/func_in.result +9 −0 Original line number Diff line number Diff line Loading @@ -193,3 +193,12 @@ select * from t1 where a in (NULL, 'aa'); a aa drop table t1; create table t1 (id int, key(id)); insert into t1 values (1),(2),(3); select count(*) from t1 where id not in (1); count(*) 2 select count(*) from t1 where id not in (1,2); count(*) 1 drop table t1; Loading
client/mysqltest.c +1 −0 Original line number Diff line number Diff line Loading @@ -3914,6 +3914,7 @@ int main(int argc, char **argv) error|= run_query(&cur_con->mysql, q, QUERY_REAP|QUERY_SEND); display_result_vertically= old_display_result_vertically; q->last_argument= q->end; query_executed= 1; break; } case Q_QUERY: Loading
myisam/mi_check.c +1 −1 Original line number Diff line number Diff line Loading @@ -3994,7 +3994,7 @@ void update_auto_increment_key(MI_CHECK *param, MI_INFO *info, ... The 'unique' array is collected in one sequential scan through the entire index. This is done in two places: in chk_index() and in sort_key_write(). Statistics collection may consider NULLs as either equal or inequal (see Statistics collection may consider NULLs as either equal or unequal (see SEARCH_NULL_ARE_NOT_EQUAL, MI_STATS_METHOD_*). Output is an array: Loading
myisam/myisamchk.c +4 −4 Original line number Diff line number Diff line Loading @@ -67,7 +67,7 @@ static const char *field_pack[]= "no zeros", "blob", "constant", "table-lockup", "always zero","varchar","unique-hash","?","?"}; static const char *myisam_stats_method_str="nulls_inequal"; static const char *myisam_stats_method_str="nulls_unequal"; static void get_options(int *argc,char * * *argv); static void print_version(void); Loading Loading @@ -339,7 +339,7 @@ static struct my_option my_long_options[] = REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"stats_method", OPT_STATS_METHOD, "Specifies how index statistics collection code should threat NULLs. " "Possible values of name are \"nulls_inequal\" (default behavior for 4.1/5.0), and \"nulls_equal\" (emulate 4.0 behavior).", "Possible values of name are \"nulls_unequal\" (default behavior for 4.1/5.0), and \"nulls_equal\" (emulate 4.0 behavior).", (gptr*) &myisam_stats_method_str, (gptr*) &myisam_stats_method_str, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} Loading Loading @@ -471,7 +471,7 @@ static void usage(void) #include <help_end.h> const char *myisam_stats_method_names[] = {"nulls_inequal", "nulls_equal", const char *myisam_stats_method_names[] = {"nulls_unequal", "nulls_equal", NullS}; TYPELIB myisam_stats_method_typelib= { array_elements(myisam_stats_method_names) - 1, "", Loading Loading @@ -698,8 +698,8 @@ get_one_option(int optid, break; case OPT_STATS_METHOD: { myisam_stats_method_str= argument; int method; myisam_stats_method_str= argument; if ((method=find_type(argument, &myisam_stats_method_typelib, 2)) <= 0) { fprintf(stderr, "Invalid value of stats_method: %s.\n", argument); Loading
mysql-test/r/func_group.result +136 −0 Original line number Diff line number Diff line Loading @@ -780,3 +780,139 @@ SELECT MAX(id) FROM t1 WHERE id < 3 AND a=2 AND b=6; MAX(id) NULL DROP TABLE t1; create table t1m (a int) engine=myisam; create table t1i (a int) engine=innodb; create table t2m (a int) engine=myisam; create table t2i (a int) engine=innodb; insert into t2m values (5); insert into t2i values (5); select min(a) from t1m; min(a) NULL select min(7) from t1m; min(7) NULL select min(7) from DUAL; min(7) NULL explain select min(7) from t2m join t1m; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away select min(7) from t2m join t1m; min(7) NULL select max(a) from t1m; max(a) NULL select max(7) from t1m; max(7) NULL select max(7) from DUAL; max(7) NULL explain select max(7) from t2m join t1m; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away select max(7) from t2m join t1m; max(7) NULL select 1, min(a) from t1m where a=99; 1 min(a) 1 NULL select 1, min(a) from t1m where 1=99; 1 min(a) 1 NULL select 1, min(1) from t1m where a=99; 1 min(1) select 1, min(1) from t1m where 1=99; 1 min(1) 1 NULL select 1, max(a) from t1m where a=99; 1 max(a) 1 NULL select 1, max(a) from t1m where 1=99; 1 max(a) 1 NULL select 1, max(1) from t1m where a=99; 1 max(1) select 1, max(1) from t1m where 1=99; 1 max(1) 1 NULL select min(a) from t1i; min(a) NULL select min(7) from t1i; min(7) NULL select min(7) from DUAL; min(7) NULL explain select min(7) from t2i join t1i; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2i ALL NULL NULL NULL NULL 1 1 SIMPLE t1i ALL NULL NULL NULL NULL 1 select min(7) from t2i join t1i; min(7) NULL select max(a) from t1i; max(a) NULL select max(7) from t1i; max(7) NULL select max(7) from DUAL; max(7) NULL explain select max(7) from t2i join t1i; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2i ALL NULL NULL NULL NULL 1 1 SIMPLE t1i ALL NULL NULL NULL NULL 1 select max(7) from t2i join t1i; max(7) NULL select 1, min(a) from t1i where a=99; 1 min(a) 1 NULL select 1, min(a) from t1i where 1=99; 1 min(a) 1 NULL select 1, min(1) from t1i where a=99; 1 min(1) 1 NULL select 1, min(1) from t1i where 1=99; 1 min(1) 1 NULL select 1, max(a) from t1i where a=99; 1 max(a) 1 NULL select 1, max(a) from t1i where 1=99; 1 max(a) 1 NULL select 1, max(1) from t1i where a=99; 1 max(1) 1 NULL select 1, max(1) from t1i where 1=99; 1 max(1) 1 NULL explain select count(*), min(7), max(7) from t1m, t1i; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1m system NULL NULL NULL NULL 0 const row not found 1 SIMPLE t1i ALL NULL NULL NULL NULL 1 select count(*), min(7), max(7) from t1m, t1i; count(*) min(7) max(7) 0 NULL NULL explain select count(*), min(7), max(7) from t1m, t2i; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1m system NULL NULL NULL NULL 0 const row not found 1 SIMPLE t2i ALL NULL NULL NULL NULL 1 select count(*), min(7), max(7) from t1m, t2i; count(*) min(7) max(7) 0 NULL NULL explain select count(*), min(7), max(7) from t2m, t1i; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2m system NULL NULL NULL NULL 1 1 SIMPLE t1i ALL NULL NULL NULL NULL 1 select count(*), min(7), max(7) from t2m, t1i; count(*) min(7) max(7) 0 NULL NULL drop table t1m, t1i, t2m, t2i;
mysql-test/r/func_in.result +9 −0 Original line number Diff line number Diff line Loading @@ -193,3 +193,12 @@ select * from t1 where a in (NULL, 'aa'); a aa drop table t1; create table t1 (id int, key(id)); insert into t1 values (1),(2),(3); select count(*) from t1 where id not in (1); count(*) 2 select count(*) from t1 where id not in (1,2); count(*) 1 drop table t1;