From 7d915f01934d73cf2500618fc7f5148768cfd1b8 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 28 Sep 2006 22:10:06 +0500 Subject: BUG#21617 - crash when selecting from merge table with inconsistent indexes Crash may happen when selecting from a merge table that has underlying tables with less indexes than in a merge table itself. If number of keys in merge table is not bigger than requested key number, return error. myisammrg/myrg_open.c: Store min(number of keys) in m_info instead of number of keys in last underlying table. myisammrg/myrg_queue.c: Return error if inx passed to _myrg_init_queue function is not less than number of keys. mysql-test/r/merge.result: A test case for bug#21617. mysql-test/t/merge.test: A test case for bug#21617. mysys/queues.c: Replaced annoying ifndef DBUG_OFF with DBUG_ASSERT, fixed coding style. The problem was that having queue overrun in debug build was hidden with this ifdef. --- mysql-test/r/merge.result | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'mysql-test/r') diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result index 038ea43cabc..bd9be0ae8b2 100644 --- a/mysql-test/r/merge.result +++ b/mysql-test/r/merge.result @@ -766,3 +766,9 @@ Table Op Msg_type Msg_text test.t1 check status OK test.t2 check status OK drop table t1, t2, t3; +CREATE TABLE t1(a INT); +INSERT INTO t1 VALUES(2),(1); +CREATE TABLE t2(a INT, KEY(a)) ENGINE=MERGE UNION=(t1); +SELECT * FROM t2 WHERE a=2; +ERROR HY000: Got error 124 from storage engine +DROP TABLE t1, t2; -- cgit v1.2.1