summaryrefslogtreecommitdiff
path: root/sql/opt_sum.cc
diff options
context:
space:
mode:
authorunknown <serg@serg.mylan>2004-06-30 10:40:15 +0200
committerunknown <serg@serg.mylan>2004-06-30 10:40:15 +0200
commit7b1b7bc6669eeeffc107ecb80cbd5513106bd098 (patch)
tree144b9398823e84c91d2dedbcfd4046720e29f314 /sql/opt_sum.cc
parent3b95283baaf7afc0e865b54204061afa3c3f461e (diff)
downloadmariadb-git-7b1b7bc6669eeeffc107ecb80cbd5513106bd098.tar.gz
fowwlowup fixes for index_flags()
Diffstat (limited to 'sql/opt_sum.cc')
-rw-r--r--sql/opt_sum.cc13
1 files changed, 7 insertions, 6 deletions
diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc
index 75b00b97ce7..27f3f476fe7 100644
--- a/sql/opt_sum.cc
+++ b/sql/opt_sum.cc
@@ -629,7 +629,7 @@ static bool find_key_for_maxmin(bool max_fl, TABLE_REF *ref,
if (!(field->flags & PART_KEY_FLAG))
return 0; // Not key field
*prefix_len= 0;
-
+
TABLE *table= field->table;
uint idx= 0;
@@ -637,16 +637,17 @@ static bool find_key_for_maxmin(bool max_fl, TABLE_REF *ref,
for (keyinfo= table->key_info, keyinfo_end= keyinfo+table->keys ;
keyinfo != keyinfo_end;
keyinfo++,idx++)
- {
- if (!(table->file->index_flags(idx) & HA_READ_ORDER))
- break;
-
+ {
KEY_PART_INFO *part,*part_end;
key_part_map key_part_to_use= 0;
+ uint jdx= 0;
for (part= keyinfo->key_part, part_end= part+keyinfo->key_parts ;
part != part_end ;
- part++, key_part_to_use= (key_part_to_use << 1) | 1)
+ part++, jdx++, key_part_to_use= (key_part_to_use << 1) | 1)
{
+ if (!(table->file->index_flags(idx, jdx) & HA_READ_ORDER))
+ return 0;
+
if (field->eq(part->field))
{
ref->key= idx;