Commit 6a40b8e8 authored by serg@serg.mylan's avatar serg@serg.mylan

merge + order by (bug #515) temporary fix

properly fixed in 4.1
parent ede742b6
...@@ -607,4 +607,6 @@ x y ...@@ -607,4 +607,6 @@ x y
1 3 1 3
select * from t3 where x = 1 and y < 5 order by y desc; select * from t3 where x = 1 and y < 5 order by y desc;
x y x y
1 3
1 2
drop table t1,t2,t3; drop table t1,t2,t3;
...@@ -40,7 +40,8 @@ class ha_myisammrg: public handler ...@@ -40,7 +40,8 @@ class ha_myisammrg: public handler
} }
ulong index_flags(uint inx) const ulong index_flags(uint inx) const
{ {
ulong flags=(HA_READ_NEXT | HA_READ_PREV | HA_READ_ORDER); ulong flags=(HA_READ_NEXT | HA_READ_PREV | HA_READ_ORDER |
HA_NOT_READ_PREFIX_LAST); // This - last - flag is ONLY for 4.0 !!!
return (flags | ((table->key_info[inx].algorithm == HA_KEY_ALG_FULLTEXT) ? return (flags | ((table->key_info[inx].algorithm == HA_KEY_ALG_FULLTEXT) ?
0 : HA_KEY_READ_ONLY)); 0 : HA_KEY_READ_ONLY));
} }
......
...@@ -5843,6 +5843,8 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit, ...@@ -5843,6 +5843,8 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
*/ */
if (!select->quick->reverse_sorted()) if (!select->quick->reverse_sorted())
{ {
if (table->file->index_flags(ref_key) & HA_NOT_READ_PREFIX_LAST)
DBUG_RETURN(0); // Use filesort
// ORDER BY range_key DESC // ORDER BY range_key DESC
QUICK_SELECT_DESC *tmp=new QUICK_SELECT_DESC(select->quick, QUICK_SELECT_DESC *tmp=new QUICK_SELECT_DESC(select->quick,
used_key_parts); used_key_parts);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment