Commit 16179dbe authored by ram@gw.mysql.r18.ru's avatar ram@gw.mysql.r18.ru

Fix for the bug #3155: strange results with index (x, y) ... WHERE x=val_1 AND...

Fix for the bug #3155: strange results with index (x, y) ... WHERE x=val_1 AND y>=val_2 ORDER BY pk;
(test case is too big to be included, take a look at the bug database)
parent f54827e5
......@@ -3443,6 +3443,7 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
tab->type=JT_ALL;
use_quick_range=1;
tab->use_quick=1;
tab->ref.key= -1;
tab->ref.key_parts=0; // Don't use ref key.
join->best_positions[i].records_read= rows2double(tab->quick->records);
}
......@@ -7015,7 +7016,7 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
ref_key= -1;
/* Test if constant range in WHERE */
if (tab->ref.key >= 0)
if (tab->ref.key >= 0 && tab->ref.key_parts)
{
ref_key= tab->ref.key;
ref_key_parts= tab->ref.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