#At file:///home/mysql_src/bzrrepos_new/mysql-trunk-bugfixing/ based on revid:luis.soares@stripped
3098 Guilhem Bichot 2010-07-08
backport of guilhem@stripped
from next-mr-bugfixing:
BUG#54682 "set sql_select_limit=0 does not work"; let SQL_SELECT_LIMIT=0
work like it does in 5.1.
@ mysql-test/suite/sys_vars/r/sql_select_limit_func.result
before the fix, the SET would emit a warning (0 being rounded up to 1)
and SELECTs would return one row.
@ sql/sys_vars.cc
0 is allowed, it means an implicit LIMIT 0 (i.e. no rows returned)
modified:
mysql-test/suite/sys_vars/r/sql_select_limit_func.result
mysql-test/suite/sys_vars/t/sql_select_limit_func.test
sql/sys_vars.cc
=== modified file 'mysql-test/suite/sys_vars/r/sql_select_limit_func.result'
--- a/mysql-test/suite/sys_vars/r/sql_select_limit_func.result 2008-12-19 15:12:15 +0000
+++ b/mysql-test/suite/sys_vars/r/sql_select_limit_func.result 2010-07-08 12:36:10 +0000
@@ -62,6 +62,16 @@ a b a b
6 val6 6 val6
affected rows: 2
Expecting affected rows: 2
+SET SESSION sql_select_limit = 0;
+affected rows: 0
+SELECT * FROM t1;
+a b
+affected rows: 0
+Expecting affected rows: 0
+SELECT * FROM t1 INNER JOIN t2 ON t1.a = t2.a;
+a b a b
+affected rows: 0
+Expecting affected rows: 0
'#-----------------------------FN_DYNVARS_165_03---------------#'
SET SESSION sql_select_limit = 2;
affected rows: 0
=== modified file 'mysql-test/suite/sys_vars/t/sql_select_limit_func.test'
--- a/mysql-test/suite/sys_vars/t/sql_select_limit_func.test 2008-12-19 15:12:15 +0000
+++ b/mysql-test/suite/sys_vars/t/sql_select_limit_func.test 2010-07-08 12:36:10 +0000
@@ -86,6 +86,14 @@ SELECT * FROM t1;
SELECT * FROM t1 INNER JOIN t2 ON t1.a = t2.a;
--echo Expecting affected rows: 2
+SET SESSION sql_select_limit = 0;
+
+SELECT * FROM t1;
+--echo Expecting affected rows: 0
+
+SELECT * FROM t1 INNER JOIN t2 ON t1.a = t2.a;
+--echo Expecting affected rows: 0
+
--echo '#-----------------------------FN_DYNVARS_165_03---------------#'
#
# Small value with LIMIT Clause
=== modified file 'sql/sys_vars.cc'
--- a/sql/sys_vars.cc 2010-07-05 09:17:01 +0000
+++ b/sql/sys_vars.cc 2010-07-08 12:36:10 +0000
@@ -2379,7 +2379,7 @@ static Sys_var_harows Sys_select_limit(
"sql_select_limit",
"The maximum number of rows to return from SELECT statements",
SESSION_VAR(select_limit), NO_CMD_LINE,
- VALID_RANGE(1, HA_POS_ERROR), DEFAULT(HA_POS_ERROR), BLOCK_SIZE(1));
+ VALID_RANGE(0, HA_POS_ERROR), DEFAULT(HA_POS_ERROR), BLOCK_SIZE(1));
static bool update_timestamp(THD *thd, set_var *var)
{
Attachment: [text/bzr-bundle] bzr/guilhem@mysql.com-20100708123610-iqrt936t01lps5wg.bundle
Thread |
---|
• bzr commit into mysql-trunk-bugfixing branch (guilhem:3098) Bug#54682 | Guilhem Bichot | 8 Jul |