Commit c3989403 authored by gluh@mysql.com's avatar gluh@mysql.com

Merge sgluhov@bk-internal.mysql.com:/home/bk/mysql-4.1

into mysql.com:/home/gluh/MySQL/Bugs/4.1.6008
parents 96e2471a bdc33e23
......@@ -2170,7 +2170,8 @@ int read_line(char *buf, int size)
if (feof(cur_file->file))
{
found_eof:
if (cur_file->file != stdin){
if (cur_file->file != stdin)
{
my_fclose(cur_file->file, MYF(0));
cur_file->file= 0;
}
......
......@@ -1674,3 +1674,14 @@ select * from t1;
a
42
drop table t1;
create table t1 (a int not null, b int not null, c blob not null, d int not null, e int, primary key (a,b,c(255),d)) engine=innodb;
insert into t1 values (2,2,"b",2,2),(1,1,"a",1,1),(3,3,"ab",3,3);
select * from t1 order by a,b,c,d;
a b c d e
1 1 a 1 1
2 2 b 2 2
3 3 ab 3 3
explain select * from t1 order by a,b,c,d;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using filesort
drop table t1;
......@@ -1220,4 +1220,14 @@ insert into t1 values (42);
select * from t1;
drop table t1;
#
# Bug #13025 Server crash during filesort
#
create table t1 (a int not null, b int not null, c blob not null, d int not null, e int, primary key (a,b,c(255),d)) engine=innodb;
insert into t1 values (2,2,"b",2,2),(1,1,"a",1,1),(3,3,"ab",3,3);
select * from t1 order by a,b,c,d;
explain select * from t1 order by a,b,c,d;
drop table t1;
# End of 4.1 tests
......@@ -443,7 +443,7 @@ static ha_rows find_all_keys(SORTPARAM *param, SQL_SELECT *select,
ha_store_ptr(ref_pos,ref_length,record); // Position to row
record+=sort_form->db_record_offset;
}
else
else if (!error)
file->position(sort_form->record[0]);
}
if (error && error != HA_ERR_RECORD_DELETED)
......
......@@ -51,7 +51,8 @@ static void agg_cmp_type(Item_result *type, Item **items, uint nitems)
type[0]= item_cmp_type(type[0], items[i]->result_type());
}
static void my_coll_agg_error(DTCollation &c1, DTCollation &c2, const char *fname)
static void my_coll_agg_error(DTCollation &c1, DTCollation &c2,
const char *fname)
{
my_error(ER_CANT_AGGREGATE_2COLLATIONS,MYF(0),
c1.collation->name,c1.derivation_name(),
......@@ -850,8 +851,8 @@ longlong Item_func_interval::val_int()
1 got error
*/
bool
Item_func_between::fix_fields(THD *thd, struct st_table_list *tables, Item **ref)
bool Item_func_between::fix_fields(THD *thd, struct st_table_list *tables,
Item **ref)
{
if (Item_func_opt_neg::fix_fields(thd, tables, ref))
return 1;
......@@ -861,8 +862,9 @@ Item_func_between::fix_fields(THD *thd, struct st_table_list *tables, Item **ref
return 0;
/* not_null_tables_cache == union(T1(e), intersection(T1(e1),T1(e2))) */
not_null_tables_cache= args[0]->not_null_tables() |
(args[1]->not_null_tables() & args[2]->not_null_tables());
not_null_tables_cache= (args[0]->not_null_tables() |
(args[1]->not_null_tables() &
args[2]->not_null_tables()));
return 0;
}
......@@ -1106,8 +1108,8 @@ Item_func_if::fix_fields(THD *thd, struct st_table_list *tlist, Item **ref)
if (Item_func::fix_fields(thd, tlist, ref))
return 1;
not_null_tables_cache= (args[1]->not_null_tables()
& args[2]->not_null_tables());
not_null_tables_cache= (args[1]->not_null_tables() &
args[2]->not_null_tables());
return 0;
}
......
......@@ -9307,12 +9307,12 @@ static bool change_group_ref(THD *thd, Item_func *expr, ORDER *group_list,
if (expr->arg_count)
{
Item **arg,**arg_end;
bool arg_changed= FALSE;
for (arg= expr->arguments(),
arg_end= expr->arguments()+expr->arg_count;
arg != arg_end; arg++)
{
Item *item= *arg;
bool arg_changed= FALSE;
if (item->type() == Item::FIELD_ITEM || item->type() == Item::REF_ITEM)
{
ORDER *group_tmp;
......@@ -9333,11 +9333,11 @@ static bool change_group_ref(THD *thd, Item_func *expr, ORDER *group_list,
if (change_group_ref(thd, (Item_func *) item, group_list, &arg_changed))
return 1;
}
if (arg_changed)
{
expr->maybe_null= 1;
*changed= TRUE;
}
}
if (arg_changed)
{
expr->maybe_null= 1;
*changed= TRUE;
}
}
return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment