From f4b7c50d6e1860b8f28ff387118f27eeea812f48 Mon Sep 17 00:00:00 2001 From: Ramil Kalimullin Date: Wed, 9 Jun 2010 14:45:04 +0400 Subject: Fix for bug #54007: assert in ha_myisam::index_next, HANDLER Problem: the server missed the fact that one can read from 2 indexes alternately using HANDLER interface. Fix: check if the same (initialized) index is involved reading next/prev values from the index. mysql-test/r/handler_myisam.result: Fix for bug #54007: assert in ha_myisam::index_next, HANDLER - test result. mysql-test/t/handler_myisam.test: Fix for bug #54007: assert in ha_myisam::index_next, HANDLER - test case. sql/sql_handler.cc: Fix for bug #54007: assert in ha_myisam::index_next, HANDLER - check if we use the same (initialized) index to read next/prev values from the index. --- mysql-test/r/handler_myisam.result | 93 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) (limited to 'mysql-test/r/handler_myisam.result') diff --git a/mysql-test/r/handler_myisam.result b/mysql-test/r/handler_myisam.result index a970e20a2c0..b20b8dbb138 100644 --- a/mysql-test/r/handler_myisam.result +++ b/mysql-test/r/handler_myisam.result @@ -769,4 +769,97 @@ a 1 HANDLER t1 CLOSE; DROP TABLE t1; +# +# Bug #54007: assert in ha_myisam::index_next , HANDLER +# +CREATE TABLE t1(a INT, b INT, PRIMARY KEY(a), KEY b(b), KEY ab(a, b)); +HANDLER t1 OPEN; +HANDLER t1 READ FIRST; +a b +HANDLER t1 READ `PRIMARY` NEXT; +a b +HANDLER t1 READ ab NEXT; +a b +HANDLER t1 READ b NEXT; +a b +HANDLER t1 READ NEXT; +a b +HANDLER t1 CLOSE; +INSERT INTO t1 VALUES (2, 20), (1, 10), (4, 40), (3, 30); +HANDLER t1 OPEN; +HANDLER t1 READ FIRST; +a b +2 20 +HANDLER t1 READ NEXT; +a b +1 10 +HANDLER t1 READ `PRIMARY` NEXT; +a b +1 10 +HANDLER t1 READ `PRIMARY` NEXT; +a b +2 20 +HANDLER t1 READ ab NEXT; +a b +1 10 +HANDLER t1 READ ab NEXT; +a b +2 20 +HANDLER t1 READ b NEXT; +a b +1 10 +HANDLER t1 READ b NEXT; +a b +2 20 +HANDLER t1 READ b NEXT; +a b +3 30 +HANDLER t1 READ b NEXT; +a b +4 40 +HANDLER t1 READ b NEXT; +a b +HANDLER t1 READ NEXT; +a b +4 40 +HANDLER t1 READ NEXT; +a b +3 30 +HANDLER t1 READ NEXT; +a b +HANDLER t1 CLOSE; +HANDLER t1 OPEN; +HANDLER t1 READ FIRST; +a b +2 20 +HANDLER t1 READ `PRIMARY` PREV; +a b +4 40 +HANDLER t1 READ `PRIMARY` PREV; +a b +3 30 +HANDLER t1 READ b PREV; +a b +4 40 +HANDLER t1 READ b PREV; +a b +3 30 +HANDLER t1 CLOSE; +HANDLER t1 OPEN; +HANDLER t1 READ FIRST; +a b +2 20 +HANDLER t1 READ `PRIMARY` PREV LIMIT 3; +a b +4 40 +3 30 +2 20 +HANDLER t1 READ b NEXT LIMIT 5; +a b +1 10 +2 20 +3 30 +4 40 +HANDLER t1 CLOSE; +DROP TABLE t1; End of 5.1 tests -- cgit v1.2.1