From 3332b80130172656c1e483e5bc9aa2bcfe741a8f Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 22 May 2007 15:58:30 +0300 Subject: Bug #28476: force index on a disabled myisam index gives error 124 When processing the USE/FORCE index hints the optimizer was not checking if the indexes specified are enabled (see ALTER TABLE). Fixed by: Backporting the fix for bug 20604 to 5.0 mysql-test/r/key.result: Test for BUG 20604. The important part of the test is the explain output that tests what indexes are used. mysql-test/r/myisam.result: Bug #28476: test cases mysql-test/t/key.test: Bug 20604: The minimal test case that reveals the bug. The optimizer for aggregates relies on keys disabled with ALTER TABLE ... DISABLE KEYS not being in the set TABLE::keys_in_use_for_query. When the execution engine tries to use a disabled index, MyISAM returns an error. mysql-test/t/myisam.test: Bug #28476: test cases sql/sql_base.cc: Bug #28476: - Ignore disabled indexes in USE/FORCE index sql/sql_select.cc: Bug 20604 : The intersection operation between table->s->keys_in_use and table->keys_in_use_for_query is no longer necessary. We can trust that the latter is a subset of the former. sql/table.h: Bug 20604: Added comments to TABLE_SHARE::keys_in_use and TABLE::keys_in_use_for_query. --- mysql-test/r/key.result | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'mysql-test/r/key.result') diff --git a/mysql-test/r/key.result b/mysql-test/r/key.result index ec15eaa97f5..3abc95ec3bf 100644 --- a/mysql-test/r/key.result +++ b/mysql-test/r/key.result @@ -455,3 +455,11 @@ ORDER BY c.b, c.d a b c d e f g h i j a b c d 2 2 1 2004-11-30 12:00:00 1 0 0 0 0 0 2 3388000 -553000 NULL DROP TABLE t1, t2; +CREATE TABLE t1( a TINYINT, KEY(a) ) ENGINE=MyISAM; +INSERT INTO t1 VALUES( 1 ); +ALTER TABLE t1 DISABLE KEYS; +EXPLAIN SELECT MAX(a) FROM t1 FORCE INDEX(a); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 system NULL NULL NULL NULL 1 +DROP TABLE t1; +End of 5.0 tests. -- cgit v1.2.1