mirror of
https://github.com/MariaDB/server.git
synced 2025-01-30 18:41:56 +01:00
sql_select.cc:
Fixed bug #11479. The JOIN::reinit method cannot call setup_tables after the optimization phase since this function removes some optimization settings for joined tables. E.g. it resets values of the null_row flag to 0. subselect.result, subselect.test: Added a test case for bug #11479.
This commit is contained in:
parent
cd0f3596be
commit
9693dc6a6b
3 changed files with 33 additions and 1 deletions
|
@ -2817,3 +2817,19 @@ SELECT * FROM t1 WHERE (a,b) IN (('aaa','aaa'), ('aaa','bbb'));
|
|||
a b
|
||||
aaa aaa
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a int);
|
||||
CREATE TABLE t2 (a int, b int);
|
||||
CREATE TABLE t3 (b int NOT NULL);
|
||||
INSERT INTO t1 VALUES (1), (2), (3), (4);
|
||||
INSERT INTO t2 VALUES (1,10), (3,30);
|
||||
SELECT * FROM t2 LEFT JOIN t3 ON t2.b=t3.b
|
||||
WHERE t3.b IS NOT NULL OR t2.a > 10;
|
||||
a b b
|
||||
SELECT * FROM t1
|
||||
WHERE t1.a NOT IN (SELECT a FROM t2 LEFT JOIN t3 ON t2.b=t3.b
|
||||
WHERE t3.b IS NOT NULL OR t2.a > 10);
|
||||
a
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
|
|
|
@ -1796,4 +1796,20 @@ SELECT * FROM t1 WHERE (a,b) IN (('aaa','aaa'), ('aaa','bbb'));
|
|||
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug #11479: subquery over left join with an empty inner table
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (a int);
|
||||
CREATE TABLE t2 (a int, b int);
|
||||
CREATE TABLE t3 (b int NOT NULL);
|
||||
INSERT INTO t1 VALUES (1), (2), (3), (4);
|
||||
INSERT INTO t2 VALUES (1,10), (3,30);
|
||||
|
||||
SELECT * FROM t2 LEFT JOIN t3 ON t2.b=t3.b
|
||||
WHERE t3.b IS NOT NULL OR t2.a > 10;
|
||||
SELECT * FROM t1
|
||||
WHERE t1.a NOT IN (SELECT a FROM t2 LEFT JOIN t3 ON t2.b=t3.b
|
||||
WHERE t3.b IS NOT NULL OR t2.a > 10);
|
||||
|
||||
# End of 4.1 tests
|
||||
|
|
|
@ -984,7 +984,7 @@ JOIN::reinit()
|
|||
if (unit->select_limit_cnt == HA_POS_ERROR)
|
||||
select_lex->options&= ~OPTION_FOUND_ROWS;
|
||||
|
||||
if (setup_tables(tables_list))
|
||||
if (!optimized && setup_tables(tables_list))
|
||||
DBUG_RETURN(1);
|
||||
|
||||
/* Reset of sum functions */
|
||||
|
|
Loading…
Add table
Reference in a new issue