Below is the list of changes that have just been committed into a local
4.1 repository of psergey. When psergey does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2007-09-10 16:26:51+04:00, sergefp@stripped +3 -0
BUG#30385: Server crash when deleting with ORDER BY and LIMIT
in get_index_for_order(), don't walk over the end of the index key parts
when matching index description and needed ordering.
mysql-test/r/delete.result@stripped, 2007-09-10 16:26:49+04:00, sergefp@stripped +11 -0
BUG#30385: Testcase
mysql-test/t/delete.test@stripped, 2007-09-10 16:26:49+04:00, sergefp@stripped +13 -0
BUG#30385: Testcase
sql/opt_range.cc@stripped, 2007-09-10 16:26:49+04:00, sergefp@stripped +2 -1
BUG#30385: Server crash when deleting with ORDER BY and LIMIT
in get_index_for_order(), don't walk over the end of the index key parts
when matching index description and needed ordering.
diff -Nrup a/mysql-test/r/delete.result b/mysql-test/r/delete.result
--- a/mysql-test/r/delete.result 2007-01-11 16:04:02 +03:00
+++ b/mysql-test/r/delete.result 2007-09-10 16:26:49 +04:00
@@ -193,4 +193,15 @@ select @a;
@a
1
drop table t1;
+CREATE TABLE t1 (
+`date` date ,
+`time` time ,
+`seq` int(10) unsigned NOT NULL auto_increment,
+PRIMARY KEY (`seq`),
+KEY `seq` (`seq`),
+KEY `time` (`time`),
+KEY `date` (`date`)
+);
+DELETE FROM t1 ORDER BY date ASC, time ASC LIMIT 1;
+drop table t1;
End of 4.1 tests
diff -Nrup a/mysql-test/t/delete.test b/mysql-test/t/delete.test
--- a/mysql-test/t/delete.test 2007-01-11 16:03:54 +03:00
+++ b/mysql-test/t/delete.test 2007-09-10 16:26:49 +04:00
@@ -184,4 +184,17 @@ delete from t1 where (@a:= f1) order by
select @a;
drop table t1;
+# BUG#30385 "Server crash when deleting with order by and limit"
+CREATE TABLE t1 (
+ `date` date ,
+ `time` time ,
+ `seq` int(10) unsigned NOT NULL auto_increment,
+ PRIMARY KEY (`seq`),
+ KEY `seq` (`seq`),
+ KEY `time` (`time`),
+ KEY `date` (`date`)
+);
+DELETE FROM t1 ORDER BY date ASC, time ASC LIMIT 1;
+drop table t1;
+
--echo End of 4.1 tests
diff -Nrup a/sql/opt_range.cc b/sql/opt_range.cc
--- a/sql/opt_range.cc 2007-03-31 00:29:16 +04:00
+++ b/sql/opt_range.cc 2007-09-10 16:26:49 +04:00
@@ -825,6 +825,7 @@ uint get_index_for_order(TABLE *table, O
if (!(table->keys_in_use_for_query.is_set(idx)))
continue;
KEY_PART_INFO *keyinfo= table->key_info[idx].key_part;
+ uint n_parts= table->key_info[idx].key_parts;
uint partno= 0;
/*
@@ -834,7 +835,7 @@ uint get_index_for_order(TABLE *table, O
*/
if (!(table->file->index_flags(idx, 0, 1) & HA_READ_ORDER))
continue;
- for (ord= order; ord; ord= ord->next, partno++)
+ for (ord= order; ord && partno < n_parts; ord= ord->next, partno++)
{
Item *item= order->item[0];
if (!(item->type() == Item::FIELD_ITEM &&
| Thread |
|---|
| • bk commit into 4.1 tree (sergefp:1.2683) BUG#30385 | Sergey Petrunia | 10 Sep |