From: Date: October 20 2006 8:02am Subject: bk commit into 4.1 tree (igor:1.2532) BUG#23478 List-Archive: http://lists.mysql.com/commits/14028 X-Bug: 23478 Message-Id: <20061020060216.70453EE46D@igor.local> 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@stripped, 2006-10-19 23:02:11-07:00, igor@stripped +2 -0 Fixed bug #23478. If elements a not top-level IN subquery were accessed by an index and the subquery result set included a NULL value then the quantified predicate that contained the subquery was evaluated to NULL when it should return a non-null value. mysql-test/t/subselect.test@stripped, 2006-10-19 23:02:09-07:00, igor@stripped +17 -0 Added a test case for bug #23478. sql/item_subselect.cc@stripped, 2006-10-19 23:02:09-07:00, igor@stripped +3 -0 Fixed bug #23478. If elements a not top-level IN subquery were accessed by an index and the subquery result set included a NULL value then the quantified predicate that contained the subquery was evaluated to NULL when it should return a non-null value. # 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-opt/mysql-4.1-opt-bug23478 --- 1.160/mysql-test/t/subselect.test 2006-10-19 23:02:16 -07:00 +++ 1.161/mysql-test/t/subselect.test 2006-10-19 23:02:16 -07:00 @@ -1948,4 +1948,21 @@ DROP TABLE t1, t2; +# +# Bug #23478: not top-level IN subquery returning a non-empty result set +# with possible NULL values by index access from the outer query +# + +CREATE TABLE t1(a int, INDEX (a)); +INSERT INTO t1 VALUES (1), (3), (5), (7); +INSERT INTO t1 VALUES (NULL); + +CREATE TABLE t2(a int); +INSERT INTO t2 VALUES (1),(2),(3); + +EXPLAIN SELECT a, a IN (SELECT a FROM t1) FROM t2; +SELECT a, a IN (SELECT a FROM t1) FROM t2; + +DROP TABLE t1,t2; + # End of 4.1 tests --- 1.144/sql/item_subselect.cc 2006-10-19 23:02:16 -07:00 +++ 1.145/sql/item_subselect.cc 2006-10-19 23:02:16 -07:00 @@ -610,6 +610,7 @@ */ DBUG_ASSERT(0); DBUG_ASSERT(fixed == 1); + null_value= 0; if (exec()) { reset(); @@ -625,6 +626,7 @@ longlong Item_in_subselect::val_int() { DBUG_ASSERT(fixed == 1); + null_value= 0; if (exec()) { reset(); @@ -645,6 +647,7 @@ */ DBUG_ASSERT(0); DBUG_ASSERT(fixed == 1); + null_value= 0; if (exec()) { reset();