From: Joerg Bruehe Date: April 23 2012 5:26pm Subject: bzr push into mysql-trunk branch (joerg.bruehe:3714 to 3715) Bug#13960056 List-Archive: http://lists.mysql.com/commits/143626 X-Bug: 13960056 Message-Id: <201204231726.q3NHQMu2027916@acsmt357.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 3715 Joerg Bruehe 2012-04-23 Request from Amrendra Kumar to chase a memory leak: bug#13960056 modified: VERSION 3714 Jorgen Loland 2012-03-01 BUG#12640437 - USING SQL_BUFFER_RESULT RESULTS IN A DIFFERENT QUERY OUTPUT For all but simple grouped queries, temporary tables are used to resolve grouping. In these cases, the list of grouping fields is stored in the temporary table and grouping is resolved there (e.g. by adding a unique constraint on the involved fields). Because of this, grouping is already done when the rows are read from the temporary table. In the case where a group clause may be optimized away, grouping does not have to be resolved using a temporary table. However, if a temporary table is explicitly requested (e.g. because the SQL_BUFFER_RESULT hint is used, or the statement is INSERT...SELECT), a temporary table is used anyway. In this case, the temporary table is created with an empty group list (because the group clause was optimized away) and it will therefore not create groups. Since the temporary table does not take care of grouping, JOIN::group shall not be set to false in make_simple_join(). This was fixed in bug 12578908. However, there is an exception where make_simple_join() should set JOIN::group to false even if the query uses a temporary table that was explicitly requested but is not strictly needed. That exception is if the loose index scan access method (explain says "Using index for group-by") is used to read into the temporary table. With loose index scan, grouping is resolved by the access method. This is exactly what happens in this bug. @ mysql-test/r/group_by.result Add test for BUG#12640437 @ mysql-test/t/group_by.test Add test for BUG#12640437 modified: mysql-test/r/group_by.result mysql-test/t/group_by.test sql/sql_executor.cc === modified file 'VERSION' --- a/VERSION 2012-02-21 09:14:32 +0000 +++ b/VERSION 2012-04-23 17:23:40 +0000 @@ -1,4 +1,4 @@ MYSQL_VERSION_MAJOR=5 MYSQL_VERSION_MINOR=6 MYSQL_VERSION_PATCH=5 -MYSQL_VERSION_EXTRA=-m8 +MYSQL_VERSION_EXTRA=-March1 No bundle (reason: useless for push emails).