mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
subselect.result:
Added test case for bug #11867. Fixed results for two existing test cases. subselect.test: Added test case for bug #11867. item_subselect.cc: Fixed bug #11867. Added missing code in Item_in_subselect::row_value_transformer that caused problems for queries with ROW(elems) IN (SELECT DISTINCT cols FROM ...). sql/item_subselect.cc: Fixed bug #11867. Added missing code in Item_in_subselect::row_value_transformer that caused problems for queries with ROW(elems) IN (SELECT DISTINCT cols FROM ...). mysql-test/t/subselect.test: Added test case for bug #11867. mysql-test/r/subselect.result: Added test case for bug #11867. Fixed results for two existing test cases.
This commit is contained in:
@ -932,7 +932,7 @@ ROW(1, 1, 'a') IN (select a,b,c from t1)
|
|||||||
1
|
1
|
||||||
select ROW(1, 2, 'a') IN (select a,b,c from t1);
|
select ROW(1, 2, 'a') IN (select a,b,c from t1);
|
||||||
ROW(1, 2, 'a') IN (select a,b,c from t1)
|
ROW(1, 2, 'a') IN (select a,b,c from t1)
|
||||||
NULL
|
0
|
||||||
select ROW(1, 1, 'a') IN (select b,a,c from t1);
|
select ROW(1, 1, 'a') IN (select b,a,c from t1);
|
||||||
ROW(1, 1, 'a') IN (select b,a,c from t1)
|
ROW(1, 1, 'a') IN (select b,a,c from t1)
|
||||||
1
|
1
|
||||||
@ -950,7 +950,7 @@ ROW(1, 1, 'a') IN (select a,b,c from t1 where c='b' or c='a')
|
|||||||
1
|
1
|
||||||
select ROW(1, 2, 'a') IN (select a,b,c from t1 where c='b' or c='a');
|
select ROW(1, 2, 'a') IN (select a,b,c from t1 where c='b' or c='a');
|
||||||
ROW(1, 2, 'a') IN (select a,b,c from t1 where c='b' or c='a')
|
ROW(1, 2, 'a') IN (select a,b,c from t1 where c='b' or c='a')
|
||||||
NULL
|
0
|
||||||
select ROW(1, 1, 'a') IN (select b,a,c from t1 where c='b' or c='a');
|
select ROW(1, 1, 'a') IN (select b,a,c from t1 where c='b' or c='a');
|
||||||
ROW(1, 1, 'a') IN (select b,a,c from t1 where c='b' or c='a')
|
ROW(1, 1, 'a') IN (select b,a,c from t1 where c='b' or c='a')
|
||||||
1
|
1
|
||||||
@ -2727,3 +2727,18 @@ select * from (select max(fld) from t1) as foo;
|
|||||||
max(fld)
|
max(fld)
|
||||||
1
|
1
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
CREATE TABLE t1 (one int, two int, flag char(1));
|
||||||
|
CREATE TABLE t2 (one int, two int, flag char(1));
|
||||||
|
INSERT INTO t1 VALUES(1,2,'Y'),(2,3,'Y'),(3,4,'Y'),(5,6,'N'),(7,8,'N');
|
||||||
|
INSERT INTO t2 VALUES(1,2,'Y'),(2,3,'Y'),(3,4,'Y'),(5,6,'N'),(7,8,'N');
|
||||||
|
SELECT * FROM t1
|
||||||
|
WHERE ROW(one,two) IN (SELECT DISTINCT one,two FROM t2 WHERE flag = 'N');
|
||||||
|
one two flag
|
||||||
|
5 6 N
|
||||||
|
7 8 N
|
||||||
|
SELECT * FROM t1
|
||||||
|
WHERE ROW(one,two) IN (SELECT DISTINCT one,two FROM t1 WHERE flag = 'N');
|
||||||
|
one two flag
|
||||||
|
5 6 N
|
||||||
|
7 8 N
|
||||||
|
DROP TABLE t1,t2;
|
||||||
|
@ -1754,5 +1754,20 @@ insert into t1 values ('1');
|
|||||||
select * from (select max(fld) from t1) as foo;
|
select * from (select max(fld) from t1) as foo;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug #11867: queries with ROW(,elems>) IN (SELECT DISTINCT <cols> FROM ...)
|
||||||
|
#
|
||||||
|
|
||||||
|
CREATE TABLE t1 (one int, two int, flag char(1));
|
||||||
|
CREATE TABLE t2 (one int, two int, flag char(1));
|
||||||
|
INSERT INTO t1 VALUES(1,2,'Y'),(2,3,'Y'),(3,4,'Y'),(5,6,'N'),(7,8,'N');
|
||||||
|
INSERT INTO t2 VALUES(1,2,'Y'),(2,3,'Y'),(3,4,'Y'),(5,6,'N'),(7,8,'N');
|
||||||
|
|
||||||
|
SELECT * FROM t1
|
||||||
|
WHERE ROW(one,two) IN (SELECT DISTINCT one,two FROM t2 WHERE flag = 'N');
|
||||||
|
SELECT * FROM t1
|
||||||
|
WHERE ROW(one,two) IN (SELECT DISTINCT one,two FROM t1 WHERE flag = 'N');
|
||||||
|
|
||||||
|
DROP TABLE t1,t2;
|
||||||
|
|
||||||
# End of 4.1 tests
|
# End of 4.1 tests
|
||||||
|
@ -951,14 +951,19 @@ Item_in_subselect::row_value_transformer(JOIN *join)
|
|||||||
List_iterator_fast<Item> li(select_lex->item_list);
|
List_iterator_fast<Item> li(select_lex->item_list);
|
||||||
for (uint i= 0; i < n; i++)
|
for (uint i= 0; i < n; i++)
|
||||||
{
|
{
|
||||||
|
Item *func;
|
||||||
DBUG_ASSERT(left_expr->fixed && select_lex->ref_pointer_array[i]->fixed);
|
DBUG_ASSERT(left_expr->fixed && select_lex->ref_pointer_array[i]->fixed);
|
||||||
if (select_lex->ref_pointer_array[i]->
|
if (select_lex->ref_pointer_array[i]->
|
||||||
check_cols(left_expr->el(i)->cols()))
|
check_cols(left_expr->el(i)->cols()))
|
||||||
DBUG_RETURN(RES_ERROR);
|
DBUG_RETURN(RES_ERROR);
|
||||||
Item *func= new Item_ref_null_helper(this,
|
if (join->having || select_lex->with_sum_func ||
|
||||||
select_lex->ref_pointer_array+i,
|
select_lex->group_list.elements)
|
||||||
(char *) "<no matter>",
|
func= new Item_ref_null_helper(this,
|
||||||
(char *) "<list ref>");
|
select_lex->ref_pointer_array+i,
|
||||||
|
(char *) "<no matter>",
|
||||||
|
(char *) "<list ref>");
|
||||||
|
else
|
||||||
|
func= li++;
|
||||||
func=
|
func=
|
||||||
eq_creator.create(new Item_direct_ref((*optimizer->get_cache())->
|
eq_creator.create(new Item_direct_ref((*optimizer->get_cache())->
|
||||||
addr(i),
|
addr(i),
|
||||||
|
Reference in New Issue
Block a user