diff options
author | unknown <igor@olga.mysql.com> | 2007-01-26 17:10:45 -0800 |
---|---|---|
committer | unknown <igor@olga.mysql.com> | 2007-01-26 17:10:45 -0800 |
commit | 30161731869835a5cce05d71b5e707be5172166e (patch) | |
tree | c6913f1f16af767947932cddd38f22dc4edfaebb | |
parent | 0e5890e1fb62eab60f6fbb5cc4e27b9fbb1d64a0 (diff) | |
download | mariadb-git-30161731869835a5cce05d71b5e707be5172166e.tar.gz |
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:
Added a test case for bug #24420.
mysql-test/t/subselect3.test:
Added a test case for bug #24420.
-rw-r--r-- | mysql-test/r/subselect3.result | 16 | ||||
-rw-r--r-- | mysql-test/t/subselect3.test | 17 | ||||
-rw-r--r-- | sql/item.cc | 5 |
3 files changed, 37 insertions, 1 deletions
diff --git a/mysql-test/r/subselect3.result b/mysql-test/r/subselect3.result index 07ff17c9df9..29143b9e504 100644 --- a/mysql-test/r/subselect3.result +++ b/mysql-test/r/subselect3.result @@ -629,3 +629,19 @@ cc NULL NULL 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; diff --git a/mysql-test/t/subselect3.test b/mysql-test/t/subselect3.test index 23d78721dbe..ed8480ba464 100644 --- a/mysql-test/t/subselect3.test +++ b/mysql-test/t/subselect3.test @@ -472,3 +472,20 @@ select oref, a, a in (select min(ie) from t1 where oref=t2.oref group by grp) Z 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; + diff --git a/sql/item.cc b/sql/item.cc index 0017b64ba0d..9a55eb25e2c 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -1242,7 +1242,10 @@ void Item::split_sum_func2(THD *thd, Item **ref_pointer_array, 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); |