summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgluh@mysql.com <>2005-09-12 20:49:48 +0500
committergluh@mysql.com <>2005-09-12 20:49:48 +0500
commitc398940326dc4362c6071b29a17e5cbf06dffac4 (patch)
treedcd41fb19e884d78d0343f201864d83f6499d1a2
parent96e2471a32f5a0af16400f4bcc54a0e97a75a6a1 (diff)
parentbdc33e2356cb960f7efe66c4131fa65ca4382c9c (diff)
downloadmariadb-git-c398940326dc4362c6071b29a17e5cbf06dffac4.tar.gz
Merge sgluhov@bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/home/gluh/MySQL/Bugs/4.1.6008
-rw-r--r--client/mysqltest.c3
-rw-r--r--mysql-test/r/innodb.result11
-rw-r--r--mysql-test/t/innodb.test10
-rw-r--r--sql/filesort.cc2
-rw-r--r--sql/item_cmpfunc.cc16
-rw-r--r--sql/sql_select.cc12
6 files changed, 39 insertions, 15 deletions
diff --git a/client/mysqltest.c b/client/mysqltest.c
index 3e2cde92aa9..374f0cb1336 100644
--- a/client/mysqltest.c
+++ b/client/mysqltest.c
@@ -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;
}
diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result
index 858daacffe9..f47c78c9768 100644
--- a/mysql-test/r/innodb.result
+++ b/mysql-test/r/innodb.result
@@ -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;
diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test
index 33432209e65..a14370c6543 100644
--- a/mysql-test/t/innodb.test
+++ b/mysql-test/t/innodb.test
@@ -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
diff --git a/sql/filesort.cc b/sql/filesort.cc
index 75b114fc140..63a8515020b 100644
--- a/sql/filesort.cc
+++ b/sql/filesort.cc
@@ -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)
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index f547a8a50a8..74eed7fa41a 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -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;
}
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 3de546fd619..f702e531a4d 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -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;