From: Date: August 16 2005 6:34am Subject: bk commit into 4.1 tree (igor:1.2376) BUG#11479 List-Archive: http://lists.mysql.com/internals/28324 X-Bug: 11479 Message-Id: <20050816043407.AEAC746F2A@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.2376 05/08/15 21:33:58 igor@stripped +3 -0 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. sql/sql_select.cc 1.430 05/08/15 21:26:07 igor@stripped +1 -1 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. mysql-test/r/subselect.result 1.171 05/08/15 21:25:25 igor@stripped +16 -0 Added a test case for bug #11479. mysql-test/t/subselect.test 1.151 05/08/15 21:24:47 igor@stripped +16 -0 Added a test case for bug #11479. # 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.429/sql/sql_select.cc Fri Aug 12 21:45:08 2005 +++ 1.430/sql/sql_select.cc Mon Aug 15 21:26:07 2005 @@ -984,7 +984,7 @@ 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 */ --- 1.170/mysql-test/r/subselect.result Fri Aug 12 21:45:06 2005 +++ 1.171/mysql-test/r/subselect.result Mon Aug 15 21:25:25 2005 @@ -2817,3 +2817,19 @@ 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 --- 1.150/mysql-test/t/subselect.test Fri Aug 12 21:45:07 2005 +++ 1.151/mysql-test/t/subselect.test Mon Aug 15 21:24:47 2005 @@ -1796,4 +1796,20 @@ 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