mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
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.
This commit is contained in:
@@ -1145,4 +1145,20 @@ create table t3 (c1 int) engine=myisam pack_keys=default;
|
||||
create table t4 (c1 int) engine=myisam pack_keys=2;
|
||||
drop table t1, t2, t3;
|
||||
|
||||
#
|
||||
# Bug#28476: force index on a disabled myisam index gives error 124
|
||||
#
|
||||
CREATE TABLE t1(a INT, b INT, KEY inx (a), UNIQUE KEY uinx (b)) ENGINE=MyISAM;
|
||||
INSERT INTO t1(a,b) VALUES (1,1),(2,2),(3,3),(4,4),(5,5);
|
||||
SELECT a FROM t1 FORCE INDEX (inx) WHERE a=1;
|
||||
ALTER TABLE t1 DISABLE KEYS;
|
||||
SELECT a FROM t1 FORCE INDEX (inx) WHERE a=1;
|
||||
SELECT a FROM t1 USE INDEX (inx) WHERE a=1;
|
||||
SELECT b FROM t1 FORCE INDEX (uinx) WHERE b=1;
|
||||
SELECT b FROM t1 USE INDEX (uinx) WHERE b=1;
|
||||
SELECT a FROM t1 FORCE INDEX (inx,uinx) WHERE a=1;
|
||||
ALTER TABLE t1 ENABLE KEYS;
|
||||
SELECT a FROM t1 FORCE INDEX (inx) WHERE a=1;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
||||
Reference in New Issue
Block a user