summaryrefslogtreecommitdiff
path: root/sql/sql_select.cc
diff options
context:
space:
mode:
authorunknown <ingo@mysql.com>2005-11-07 12:16:49 +0100
committerunknown <ingo@mysql.com>2005-11-07 12:16:49 +0100
commit5412ee4f299a4a2d71db1b7e5f3e62132032fb00 (patch)
treea2a5cb9b8ca900cb6ef4eb4e876f7497fbf3bcba /sql/sql_select.cc
parentfb4c949f57b281a232ea581e26b8c48be6c1d873 (diff)
downloadmariadb-git-5412ee4f299a4a2d71db1b7e5f3e62132032fb00.tar.gz
Bug#14616 - Freshly imported table returns error 124 when using LIMIT
Initialized usable_keys from table->keys_in_use instead of ~0 in test_if_skip_sort_order(). It was possible that a disabled index was used for sorting. mysql-test/r/myisam.result: Bug#14616 - Freshly imported table returns error 124 when using LIMIT The test result. mysql-test/t/myisam.test: Bug#14616 - Freshly imported table returns error 124 when using LIMIT The test case.
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r--sql/sql_select.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 46f0139a608..6dd68a60f88 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -6003,8 +6003,12 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
key_map usable_keys;
DBUG_ENTER("test_if_skip_sort_order");
- /* Check which keys can be used to resolve ORDER BY */
- usable_keys= ~(key_map) 0;
+ /*
+ Check which keys can be used to resolve ORDER BY.
+ We must not try to use disabled keys.
+ */
+ usable_keys= table->keys_in_use;
+
for (ORDER *tmp_order=order; tmp_order ; tmp_order=tmp_order->next)
{
if ((*tmp_order->item)->type() != Item::FIELD_ITEM)