summaryrefslogtreecommitdiff
path: root/mysql-test/r/key.result
diff options
context:
space:
mode:
authormhansson/martin@linux-st28.site <>2007-01-29 15:07:11 +0100
committermhansson/martin@linux-st28.site <>2007-01-29 15:07:11 +0100
commit6d7a6097426ae90ee99aa4b5a65085057ba95204 (patch)
tree095a56104c6851c2cc0302f9706e589365bf5539 /mysql-test/r/key.result
parent8a3592d4e2c621aa9bac7886a32a0c9a5159d00f (diff)
downloadmariadb-git-6d7a6097426ae90ee99aa4b5a65085057ba95204.tar.gz
BUG#20604: FORCE INDEX uses keys disabled by ALTER TABLE
The function that checks whether we can use keys for aggregates, find_key_for_maxmin(), assumes that keys disabled by ALTER TABLE ... DISABLE KEYS are not in the set table->keys_in_use_for_query. I.E., if a key is in this set, the optimizer assumes it is free to use it. The bug is that keys disabled with ALTER TABLE ... DISABLE KEYS still appear in table->keys_in_use_for_query When the TABLE object has been initialized with setup_tables(). Before setup_tables is called, however, keys that are disabled in the aforementioned way are not included in TABLE::keys_in_use_for_query. The provided patch changes the code that updates keys_is_use_for_query so that it assumes that keys_is_use_for_query already takes into account all disabled keys, and generally all keys that should be used by the query.
Diffstat (limited to 'mysql-test/r/key.result')
-rw-r--r--mysql-test/r/key.result7
1 files changed, 7 insertions, 0 deletions
diff --git a/mysql-test/r/key.result b/mysql-test/r/key.result
index ea8d4338d08..853b837c46e 100644
--- a/mysql-test/r/key.result
+++ b/mysql-test/r/key.result
@@ -482,3 +482,10 @@ alter table t1 drop index i3, drop index i2, drop index i1;
alter table t1 add index i3 (c3), add index i2 (c2), add unique index i1 (c1);
ERROR 23000: Duplicate entry '1' for key 'i1'
drop table t1;
+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;