summaryrefslogtreecommitdiff
path: root/sql/opt_range.cc
diff options
context:
space:
mode:
authorunknown <gshchepa@bk-internal.mysql.com>2007-09-12 11:52:42 +0200
committerunknown <gshchepa@bk-internal.mysql.com>2007-09-12 11:52:42 +0200
commitbdf0ab58bee8dcb312d5987b46109bc548b46282 (patch)
tree934c53a9002b4f308e82c525c72ce7e61e8eda30 /sql/opt_range.cc
parent4c2d50e426a9c93445a6759d5761e551c9da7ec7 (diff)
parentba39449e01c88f84a3a1b0cbc55fadb77ef20e82 (diff)
downloadmariadb-git-bdf0ab58bee8dcb312d5987b46109bc548b46282.tar.gz
Merge bk-internal.mysql.com:/data0/bk/mysql-5.0-opt
into bk-internal.mysql.com:/data0/bk/mysql-5.1-opt sql/opt_range.cc: Auto merged
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 c027ce20e89..7bb5ba831ab 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -1778,6 +1778,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;
/*
@@ -1787,7 +1788,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 &&