mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
BUG#20357 - Got error 124 from storage engine using MIN and MAX
functions in queries Using MAX()/MIN() on table with disabled indexes (by ALTER TABLE) results in error 124 (wrong index) from storage engine. The problem was that optimizer use disabled index to optimize MAX()/MIN(). Normally it must skip disabled index and perform table scan. This patch skips disabled indexes for min/max optimization. mysql-test/r/myisam.result: Test case for BUG#20357. mysql-test/t/myisam.test: Test case for BUG#20357. sql/opt_sum.cc: Skip disabled/ignored indexes for min/max optimization.
This commit is contained in:
@ -748,3 +748,16 @@ select count(id1) from t1 where id2 = 10;
|
||||
count(id1)
|
||||
5
|
||||
drop table t1;
|
||||
CREATE TABLE t1(a TINYINT, KEY(a)) ENGINE=MyISAM;
|
||||
INSERT INTO t1 VALUES(1);
|
||||
SELECT MAX(a) FROM t1 IGNORE INDEX(a);
|
||||
MAX(a)
|
||||
1
|
||||
ALTER TABLE t1 DISABLE KEYS;
|
||||
SELECT MAX(a) FROM t1;
|
||||
MAX(a)
|
||||
1
|
||||
SELECT MAX(a) FROM t1 IGNORE INDEX(a);
|
||||
MAX(a)
|
||||
1
|
||||
DROP TABLE t1;
|
||||
|
Reference in New Issue
Block a user