From: Date: March 18 2005 5:18am Subject: bk commit into 4.1 tree (igor:1.2134) BUG#8617 List-Archive: http://lists.mysql.com/internals/23168 X-Bug: 8617 Message-Id: <20050318041826.9DD3AED48F@rurik.mysql.com> Below is the list of changes that have just been committed into a local 4.1 repository of igor. When igor does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet 1.2134 05/03/17 20:18:19 igor@stripped +3 -0 olap.test: Added a test case for bug #8617. sql_select.cc: Fixed bug #8617. Queries with ROLLUP and LIMIT n returned more than n rows if SQL_CALC_FOUND_ROWS was used. mysql-test/r/olap.result 1.15 05/03/17 20:16:30 igor@stripped +13 -0 mysql-test/t/olap.test 1.12 05/03/17 20:16:01 igor@stripped +16 -0 Added a test case for bug #8617. sql/sql_select.cc 1.388 05/03/17 20:09:30 igor@stripped +1 -1 Fixed bug #8617. Queries with ROLLUP and LIMIT n returned more than n rows if SQL_CALC_FOUND_ROWS was used. # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: igor # Host: rurik.mysql.com # Root: /home/igor/dev/mysql-4.1-0 --- 1.387/sql/sql_select.cc Wed Mar 16 15:50:06 2005 +++ 1.388/sql/sql_select.cc Thu Mar 17 20:09:30 2005 @@ -9210,7 +9210,7 @@ ref_pointer_array_size); if ((!having || having->val_int())) { - if (send_records < unit->select_limit_cnt && + if (send_records < unit->select_limit_cnt && do_send_rows && result->send_data(rollup.fields[i])) return 1; send_records++; --- 1.14/mysql-test/r/olap.result Wed Mar 16 15:51:55 2005 +++ 1.15/mysql-test/r/olap.result Thu Mar 17 20:16:30 2005 @@ -379,3 +379,16 @@ 4 4 NULL 14 DROP TABLE t1; +CREATE TABLE t1 (a int, b int); +INSERT INTO t1 VALUES +(1,4), +(2,2), (2,2), +(4,1), (4,1), (4,1), (4,1), +(2,1), (2,1); +SELECT a, SUM(b) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1; +a SUM(b) +1 4 +SELECT SQL_CALC_FOUND_ROWS a, SUM(b) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1; +a SUM(b) +1 4 +DROP TABLE t1; --- 1.11/mysql-test/t/olap.test Wed Mar 16 15:51:24 2005 +++ 1.12/mysql-test/t/olap.test Thu Mar 17 20:16:01 2005 @@ -155,3 +155,19 @@ DROP TABLE t1; +# +# Tests for bugs #8617: SQL_CACL_FOUND_ROWS with rollup and limit +# + +CREATE TABLE t1 (a int, b int); + +INSERT INTO t1 VALUES + (1,4), + (2,2), (2,2), + (4,1), (4,1), (4,1), (4,1), + (2,1), (2,1); + +SELECT a, SUM(b) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1; +SELECT SQL_CALC_FOUND_ROWS a, SUM(b) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1; + +DROP TABLE t1;