From: Date: January 27 2007 2:10am Subject: bk commit into 5.0 tree (igor:1.2391) BUG#24420 List-Archive: http://lists.mysql.com/commits/18891 X-Bug: 24420 Message-Id: <20070127011051.EF60D11824A@olga.mysql.com> Below is the list of changes that have just been committed into a local 5.0 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, 2007-01-26 17:10:45-08:00, igor@stripped +3 -0 Fixed bug #24420. Objects of the classes Item_func_is_not_null_test and Item_func_trig_cond must be transparent for the method Item::split_sum_func2 as these classes are pure helpers. It means that the method Item::split_sum_func2 should look at those objects as at pure wrappers. mysql-test/r/subselect3.result@stripped, 2007-01-26 17:10:42-08:00, igor@stripped +16 -0 Added a test case for bug #24420. mysql-test/t/subselect3.test@stripped, 2007-01-26 17:10:42-08:00, igor@stripped +17 -0 Added a test case for bug #24420. sql/item.cc@stripped, 2007-01-26 17:10:43-08:00, igor@stripped +4 -1 Fixed bug #24420. Objects of the classes Item_func_is_not_null_test and Item_func_trig_cond must be transparent for the method Item::split_sum_func2 as these classes are pure helpers. It means that the method Item::split_sum_func2 should look at those objects as at pure wrappers. # 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: olga.mysql.com # Root: /home/igor/dev-opt/mysql-5.0-opt-bug24420 --- 1.251/sql/item.cc 2007-01-26 17:10:51 -08:00 +++ 1.252/sql/item.cc 2007-01-26 17:10:51 -08:00 @@ -1242,7 +1242,10 @@ if (type() == SUM_FUNC_ITEM && skip_registered && ((Item_sum *) this)->ref_by) return; - if (type() != SUM_FUNC_ITEM && with_sum_func) + if ((type() != SUM_FUNC_ITEM && with_sum_func) || + (type() == FUNC_ITEM && + (((Item_func *) this)->functype() == Item_func::ISNOTNULLTEST_FUNC || + ((Item_func *) this)->functype() == Item_func::TRIG_COND_FUNC))) { /* Will split complicated items and ignore simple ones */ split_sum_func(thd, ref_pointer_array, fields); --- 1.3/mysql-test/r/subselect3.result 2007-01-26 17:10:51 -08:00 +++ 1.4/mysql-test/r/subselect3.result 2007-01-26 17:10:51 -08:00 @@ -629,3 +629,19 @@ aa 1 1 bb NULL NULL drop table t1,t2; +create table t1 (a int, b int); +insert into t1 values (0,0), (2,2), (3,3); +create table t2 (a int, b int); +insert into t2 values (1,1), (3,3); +select a, b, (a,b) in (select a, min(b) from t2 group by a) Z from t1; +a b Z +0 0 0 +2 2 0 +3 3 1 +insert into t2 values (NULL,4); +select a, b, (a,b) in (select a, min(b) from t2 group by a) Z from t1; +a b Z +0 0 0 +2 2 0 +3 3 1 +drop table t1,t2; --- 1.4/mysql-test/t/subselect3.test 2007-01-26 17:10:51 -08:00 +++ 1.5/mysql-test/t/subselect3.test 2007-01-26 17:10:51 -08:00 @@ -472,3 +472,20 @@ drop table t1,t2; +# +# BUG#24420: row-based IN suqueries with aggregation when the left operand +# of the subquery predicate may contain NULL values +# + +create table t1 (a int, b int); +insert into t1 values (0,0), (2,2), (3,3); +create table t2 (a int, b int); +insert into t2 values (1,1), (3,3); + +select a, b, (a,b) in (select a, min(b) from t2 group by a) Z from t1; + +insert into t2 values (NULL,4); +select a, b, (a,b) in (select a, min(b) from t2 group by a) Z from t1; + +drop table t1,t2; +