Commit d1bf703c authored by Guilhem Bichot's avatar Guilhem Bichot

backport of guilhem@mysql.com-20100628140739-i9vy8ugxp1v5aspb

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)
parent 9c8ddbcd
......@@ -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
......
......@@ -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
......
......@@ -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)
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment