From d1ddc24a1ae8bff060ac721f94c6948010a04642 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 20 Oct 2007 21:48:15 +0400 Subject: Fix for BUG#31148: bool close_thread_table(THD*, TABLE**): Assertion `table->key_read == 0' failed. The problem was that key_read on a table in a sub-select was not properly reset. That happens because the code responsible for that is copy&pasted all around the server. In some place, it was obviously forgotten to be pasted. The fix is to reset key_read properly. mysql-test/r/key.result: Update result file. mysql-test/t/key.test: A test case for BUG#31148: bool close_thread_table(THD*, TABLE**): Assertion `table->key_read == 0' failed. sql/sql_select.cc: Reset key_read before closing index. --- mysql-test/r/key.result | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'mysql-test/r/key.result') diff --git a/mysql-test/r/key.result b/mysql-test/r/key.result index a2bed75a709..6c115435fb6 100644 --- a/mysql-test/r/key.result +++ b/mysql-test/r/key.result @@ -530,3 +530,18 @@ ORDER BY c.b, c.d a b c d e f g h i j a b c d 2 2 1 2004-11-30 12:00:00 1 0 0 0 0 0 2 3388000 -553000 NULL DROP TABLE t1, t2; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (a INT PRIMARY KEY AUTO_INCREMENT); +INSERT INTO t1 VALUES (), (), (); +SELECT 1 AS c1 +FROM t1 +ORDER BY ( +SELECT 1 AS c2 +FROM t1 +GROUP BY GREATEST(LAST_INSERT_ID(), t1.a) ASC +LIMIT 1); +c1 +1 +1 +1 +DROP TABLE t1; -- cgit v1.2.1