Commit 251409bb authored by unknown's avatar unknown

BUG#16255: Merge to 5.0

parents d0394c70 f895a16c
...@@ -2915,6 +2915,28 @@ select * from t1 where NOT(s1 = ALL (select s1/s1 from t1)); ...@@ -2915,6 +2915,28 @@ select * from t1 where NOT(s1 = ALL (select s1/s1 from t1));
s1 s1
2 2
drop table t1; drop table t1;
create table t1 (
retailerID varchar(8) NOT NULL,
statusID int(10) unsigned NOT NULL,
changed datetime NOT NULL,
UNIQUE KEY retailerID (retailerID, statusID, changed)
);
INSERT INTO t1 VALUES("0026", "1", "2005-12-06 12:18:56");
INSERT INTO t1 VALUES("0026", "2", "2006-01-06 12:25:53");
INSERT INTO t1 VALUES("0037", "1", "2005-12-06 12:18:56");
INSERT INTO t1 VALUES("0037", "2", "2006-01-06 12:25:53");
INSERT INTO t1 VALUES("0048", "1", "2006-01-06 12:37:50");
INSERT INTO t1 VALUES("0059", "1", "2006-01-06 12:37:50");
select * from t1 r1
where (r1.retailerID,(r1.changed)) in
(SELECT r2.retailerId,(max(changed)) from t1 r2
group by r2.retailerId);
retailerID statusID changed
0026 2 2006-01-06 12:25:53
0037 2 2006-01-06 12:25:53
0048 1 2006-01-06 12:37:50
0059 1 2006-01-06 12:37:50
drop table t1;
create table t1 (df decimal(5,1)); create table t1 (df decimal(5,1));
insert into t1 values(1.1); insert into t1 values(1.1);
insert into t1 values(2.2); insert into t1 values(2.2);
......
...@@ -1868,7 +1868,30 @@ select * from t1 where NOT(s1+1 = ANY (select s1 from t1)); ...@@ -1868,7 +1868,30 @@ 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 (s1 = ALL (select s1/s1 from t1));
select * from t1 where NOT(s1 = ALL (select s1/s1 from t1)); select * from t1 where NOT(s1 = ALL (select s1/s1 from t1));
drop table t1; drop table t1;
# End of 4.1 tests
#
# Bug #16255: Subquery in where
#
create table t1 (
retailerID varchar(8) NOT NULL,
statusID int(10) unsigned NOT NULL,
changed datetime NOT NULL,
UNIQUE KEY retailerID (retailerID, statusID, changed)
);
INSERT INTO t1 VALUES("0026", "1", "2005-12-06 12:18:56");
INSERT INTO t1 VALUES("0026", "2", "2006-01-06 12:25:53");
INSERT INTO t1 VALUES("0037", "1", "2005-12-06 12:18:56");
INSERT INTO t1 VALUES("0037", "2", "2006-01-06 12:25:53");
INSERT INTO t1 VALUES("0048", "1", "2006-01-06 12:37:50");
INSERT INTO t1 VALUES("0059", "1", "2006-01-06 12:37:50");
select * from t1 r1
where (r1.retailerID,(r1.changed)) in
(SELECT r2.retailerId,(max(changed)) from t1 r2
group by r2.retailerId);
drop table t1;
# End of 4.1 tests # End of 4.1 tests
# #
......
...@@ -1098,24 +1098,23 @@ Item_in_subselect::row_value_transformer(JOIN *join) ...@@ -1098,24 +1098,23 @@ Item_in_subselect::row_value_transformer(JOIN *join)
DBUG_RETURN(RES_ERROR); DBUG_RETURN(RES_ERROR);
Item *item_eq= Item *item_eq=
new Item_func_eq(new new Item_func_eq(new
Item_direct_ref(&select_lex->context, Item_ref(&select_lex->context,
(*optimizer->get_cache())-> (*optimizer->get_cache())->
addr(i), addr(i),
(char *)"<no matter>", (char *)"<no matter>",
(char *)in_left_expr_name), (char *)in_left_expr_name),
new new
Item_direct_ref(&select_lex->context, Item_ref(&select_lex->context,
select_lex->ref_pointer_array + i, select_lex->ref_pointer_array + i,
(char *)"<no matter>", (char *)"<no matter>",
(char *)"<list ref>") (char *)"<list ref>")
); );
Item *item_isnull= Item *item_isnull=
new Item_func_isnull(new new Item_func_isnull(new
Item_direct_ref(&select_lex->context, Item_ref(&select_lex->context,
select_lex-> select_lex->ref_pointer_array+i,
ref_pointer_array+i, (char *)"<no matter>",
(char *)"<no matter>", (char *)"<list ref>")
(char *)"<list ref>")
); );
having_item= having_item=
and_items(having_item, and_items(having_item,
...@@ -1125,11 +1124,11 @@ Item_in_subselect::row_value_transformer(JOIN *join) ...@@ -1125,11 +1124,11 @@ Item_in_subselect::row_value_transformer(JOIN *join)
new new
Item_is_not_null_test(this, Item_is_not_null_test(this,
new new
Item_direct_ref(&select_lex->context, Item_ref(&select_lex->context,
select_lex-> select_lex->
ref_pointer_array + i, ref_pointer_array + i,
(char *)"<no matter>", (char *)"<no matter>",
(char *)"<list ref>") (char *)"<list ref>")
) )
); );
item_having_part2->top_level_item(); item_having_part2->top_level_item();
...@@ -1185,11 +1184,11 @@ Item_in_subselect::row_value_transformer(JOIN *join) ...@@ -1185,11 +1184,11 @@ Item_in_subselect::row_value_transformer(JOIN *join)
new new
Item_is_not_null_test(this, Item_is_not_null_test(this,
new new
Item_direct_ref(&select_lex->context, Item_ref(&select_lex->context,
select_lex-> select_lex->
ref_pointer_array + i, ref_pointer_array + i,
(char *)"<no matter>", (char *)"<no matter>",
(char *)"<list ref>") (char *)"<list ref>")
) )
); );
item_isnull= new item_isnull= new
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment