mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 04:22:27 +01:00
Fixed LP bug #802845.
If the expression for a derived table contained a clause LIMIT 0 SELECT from such derived table incorrectly returned a non-empty set. Fixed by ensuring JOIN::do_send_rows to be updated after the call of st_select_lex_unit::set_limit that sets the value of JOIN::unit->select_limit_cnt.
This commit is contained in:
parent
bd62c82380
commit
55165f5174
3 changed files with 27 additions and 1 deletions
|
@ -725,3 +725,13 @@ a a a b
|
|||
c c c c
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1,t2,t3;
|
||||
#
|
||||
# LP bug #802845: select from derived table with limit 0
|
||||
#
|
||||
SELECT * FROM (SELECT 1 LIMIT 0) t;
|
||||
1
|
||||
CREATE TABLE t1 (a int);
|
||||
INSERT INTO t1 VALUES (7), (1), (3);
|
||||
SELECT * FROM (SELECT * FROM t1 LIMIT 0) t;
|
||||
a
|
||||
DROP TABLE t1;
|
||||
|
|
|
@ -343,3 +343,19 @@ SELECT * FROM t1, t2, v1 WHERE t2.a=t1.a AND t2.a=v1.a AND t2.a=v1.b;
|
|||
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1,t2,t3;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # LP bug #802845: select from derived table with limit 0
|
||||
--echo #
|
||||
|
||||
SELECT * FROM (SELECT 1 LIMIT 0) t;
|
||||
|
||||
CREATE TABLE t1 (a int);
|
||||
INSERT INTO t1 VALUES (7), (1), (3);
|
||||
|
||||
SELECT * FROM (SELECT * FROM t1 LIMIT 0) t;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
|
|
|
@ -865,6 +865,7 @@ JOIN::optimize()
|
|||
uint no_jbuf_after;
|
||||
|
||||
DBUG_ENTER("JOIN::optimize");
|
||||
do_send_rows = (unit->select_limit_cnt) ? 1 : 0;
|
||||
// to prevent double initialization on EXPLAIN
|
||||
if (optimized)
|
||||
DBUG_RETURN(0);
|
||||
|
@ -914,7 +915,6 @@ JOIN::optimize()
|
|||
select_limit= unit->select_limit_cnt;
|
||||
if (having || (select_options & OPTION_FOUND_ROWS))
|
||||
select_limit= HA_POS_ERROR;
|
||||
do_send_rows = (unit->select_limit_cnt) ? 1 : 0;
|
||||
// Ignore errors of execution if option IGNORE present
|
||||
if (thd->lex->ignore)
|
||||
thd->lex->current_select->no_error= 1;
|
||||
|
|
Loading…
Reference in a new issue