summaryrefslogtreecommitdiff
path: root/sql/opt_range.cc
diff options
context:
space:
mode:
authorunknown <sergefp@pylon.mylan>2007-09-11 02:24:08 +0400
committerunknown <sergefp@pylon.mylan>2007-09-11 02:24:08 +0400
commit9d466ad4791ef95d9201506099f2e6684d3d4b91 (patch)
tree0176beafdda7144ed0ab8ca49f84622901964b6b /sql/opt_range.cc
parent76e37a32b8a3c7c74a2cbee8b292632a4c04fb3d (diff)
parent732f05a642279a569c6ed2b67fafff05b9de76c3 (diff)
downloadmariadb-git-9d466ad4791ef95d9201506099f2e6684d3d4b91.tar.gz
Merge mysql.com:/home/psergey/mysql-4.1-bug30385
into mysql.com:/home/psergey/mysql-5.0-bug30385 sql/opt_range.cc: Auto merged mysql-test/r/delete.result: Manual merge mysql-test/t/delete.test: Manual merge
Diffstat (limited to 'sql/opt_range.cc')
-rw-r--r--sql/opt_range.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index b195e37920e..f57cb03ca53 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -1619,6 +1619,7 @@ uint get_index_for_order(TABLE *table, ORDER *order, ha_rows limit)
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;
/*
@@ -1628,7 +1629,7 @@ uint get_index_for_order(TABLE *table, ORDER *order, ha_rows limit)
*/
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 &&