1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Bug #35206: select query result different if the key is indexed or not

The code for executing indexed ORDER BY was not setting all the 
internal fields correctly when selecting to execute ORDER BY over
and index.
Fixed by change the access method to one that will use the 
quick indexed access if one is selected while selecting indexed
ORDER BY.
This commit is contained in:
gkodinov/kgeorge@magare.gmz
2008-03-27 19:39:21 +02:00
parent 079a174801
commit cde380ea50
3 changed files with 509 additions and 0 deletions

View File

@ -13177,6 +13177,23 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
tab->limit= select_limit;
}
}
else if (tab->type != JT_ALL)
{
/*
We're about to use a quick access to the table.
We need to change the access method so as the quick access
method is actually used.
*/
DBUG_ASSERT(tab->select->quick);
tab->type=JT_ALL;
tab->use_quick=1;
tab->ref.key= -1;
tab->ref.key_parts=0; // Don't use ref key.
tab->read_first_record= join_init_read_record;
/*
TODO: update the number of records in join->best_positions[tablenr]
*/
}
}
used_key_parts= best_key_parts;
order_direction= best_key_direction;