Loading mysql-test/r/subselect.result +11 −0 Original line number Diff line number Diff line Loading @@ -2895,3 +2895,14 @@ select * from t1 where NOT(s1 = ALL (select s1/s1 from t1)); s1 2 drop table t1; CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a,b)); INSERT INTO t1 VALUES(26, 1), (48, 2); SELECT * FROM t1 r WHERE (r.a,r.b) IN (SELECT a,MAX(b) FROM t1 GROUP BY a); a b 26 1 48 2 SELECT * FROM t1 r WHERE (r.a,r.b) IN (SELECT a + 0,MAX(b) FROM t1 GROUP BY a); a b 26 1 48 2 DROP TABLE t1; mysql-test/t/subselect.test +12 −0 Original line number Diff line number Diff line Loading @@ -1861,4 +1861,16 @@ select * from t1 where NOT(s1+1 = ANY (select s1 from t1)); select * from t1 where (s1 = ALL (select s1/s1 from t1)); select * from t1 where NOT(s1 = ALL (select s1/s1 from t1)); drop table t1; # # Bug #16255: Subquery in where # CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a,b)); INSERT INTO t1 VALUES(26, 1), (48, 2); SELECT * FROM t1 r WHERE (r.a,r.b) IN (SELECT a,MAX(b) FROM t1 GROUP BY a); SELECT * FROM t1 r WHERE (r.a,r.b) IN (SELECT a + 0,MAX(b) FROM t1 GROUP BY a); DROP TABLE t1; # End of 4.1 tests sql/item_subselect.cc +5 −5 Original line number Diff line number Diff line Loading @@ -976,18 +976,18 @@ Item_in_subselect::row_value_transformer(JOIN *join) DBUG_RETURN(RES_ERROR); Item *item_eq= new Item_func_eq(new Item_direct_ref((*optimizer->get_cache())-> Item_ref((*optimizer->get_cache())-> addr(i), (char *)"<no matter>", (char *)in_left_expr_name), new Item_direct_ref(select_lex->ref_pointer_array + i, Item_ref(select_lex->ref_pointer_array + i, (char *)"<no matter>", (char *)"<list ref>") ); Item *item_isnull= new Item_func_isnull(new Item_direct_ref( select_lex-> Item_ref( select_lex-> ref_pointer_array+i, (char *)"<no matter>", (char *)"<list ref>") Loading @@ -1000,7 +1000,7 @@ Item_in_subselect::row_value_transformer(JOIN *join) new Item_is_not_null_test(this, new Item_direct_ref(select_lex-> Item_ref(select_lex-> ref_pointer_array + i, (char *)"<no matter>", (char *)"<list ref>") Loading Loading @@ -1057,7 +1057,7 @@ Item_in_subselect::row_value_transformer(JOIN *join) new Item_is_not_null_test(this, new Item_direct_ref(select_lex-> Item_ref(select_lex-> ref_pointer_array + i, (char *)"<no matter>", (char *)"<list ref>") Loading Loading
mysql-test/r/subselect.result +11 −0 Original line number Diff line number Diff line Loading @@ -2895,3 +2895,14 @@ select * from t1 where NOT(s1 = ALL (select s1/s1 from t1)); s1 2 drop table t1; CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a,b)); INSERT INTO t1 VALUES(26, 1), (48, 2); SELECT * FROM t1 r WHERE (r.a,r.b) IN (SELECT a,MAX(b) FROM t1 GROUP BY a); a b 26 1 48 2 SELECT * FROM t1 r WHERE (r.a,r.b) IN (SELECT a + 0,MAX(b) FROM t1 GROUP BY a); a b 26 1 48 2 DROP TABLE t1;
mysql-test/t/subselect.test +12 −0 Original line number Diff line number Diff line Loading @@ -1861,4 +1861,16 @@ select * from t1 where NOT(s1+1 = ANY (select s1 from t1)); select * from t1 where (s1 = ALL (select s1/s1 from t1)); select * from t1 where NOT(s1 = ALL (select s1/s1 from t1)); drop table t1; # # Bug #16255: Subquery in where # CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a,b)); INSERT INTO t1 VALUES(26, 1), (48, 2); SELECT * FROM t1 r WHERE (r.a,r.b) IN (SELECT a,MAX(b) FROM t1 GROUP BY a); SELECT * FROM t1 r WHERE (r.a,r.b) IN (SELECT a + 0,MAX(b) FROM t1 GROUP BY a); DROP TABLE t1; # End of 4.1 tests
sql/item_subselect.cc +5 −5 Original line number Diff line number Diff line Loading @@ -976,18 +976,18 @@ Item_in_subselect::row_value_transformer(JOIN *join) DBUG_RETURN(RES_ERROR); Item *item_eq= new Item_func_eq(new Item_direct_ref((*optimizer->get_cache())-> Item_ref((*optimizer->get_cache())-> addr(i), (char *)"<no matter>", (char *)in_left_expr_name), new Item_direct_ref(select_lex->ref_pointer_array + i, Item_ref(select_lex->ref_pointer_array + i, (char *)"<no matter>", (char *)"<list ref>") ); Item *item_isnull= new Item_func_isnull(new Item_direct_ref( select_lex-> Item_ref( select_lex-> ref_pointer_array+i, (char *)"<no matter>", (char *)"<list ref>") Loading @@ -1000,7 +1000,7 @@ Item_in_subselect::row_value_transformer(JOIN *join) new Item_is_not_null_test(this, new Item_direct_ref(select_lex-> Item_ref(select_lex-> ref_pointer_array + i, (char *)"<no matter>", (char *)"<list ref>") Loading Loading @@ -1057,7 +1057,7 @@ Item_in_subselect::row_value_transformer(JOIN *join) new Item_is_not_null_test(this, new Item_direct_ref(select_lex-> Item_ref(select_lex-> ref_pointer_array + i, (char *)"<no matter>", (char *)"<list ref>") Loading