From 16179dbef0745c6f2d59a9b29771d7b4cdd22282 Mon Sep 17 00:00:00 2001 From: "ram@gw.mysql.r18.ru" <> Date: Wed, 17 Mar 2004 15:30:17 +0400 Subject: [PATCH] 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) --- sql/sql_select.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 7605016dbe1..b4b0b18ebc2 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -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;