Commit caa9645c authored by bell@sanja.is.com.ua's avatar bell@sanja.is.com.ua

Merge

parents f349adf8 6300a019
...@@ -1475,6 +1475,13 @@ dbid name ...@@ -1475,6 +1475,13 @@ dbid name
-1 Valid -1 Valid
-1 Valid 2 -1 Valid 2
drop table t1,t2,t3,t4; drop table t1,t2,t3,t4;
CREATE TABLE t1 (id int(11) default NULL) TYPE=MyISAM CHARSET=latin1;
INSERT INTO t1 VALUES (1),(5);
CREATE TABLE t2 (id int(11) default NULL) TYPE=MyISAM CHARSET=latin1;
INSERT INTO t2 VALUES (2),(6);
select * from t1 where (1,2,6) in (select * from t2);
ERROR 21000: Operand should contain 3 column(s)
DROP TABLE t1,t2;
create table t1 (s1 int); create table t1 (s1 int);
insert into t1 values (1); insert into t1 values (1);
insert into t1 values (2); insert into t1 values (2);
......
...@@ -989,6 +989,17 @@ select dbid, name, (date_format(now() , '%Y-%m-%d') - INTERVAL how_often DAY) > ...@@ -989,6 +989,17 @@ select dbid, name, (date_format(now() , '%Y-%m-%d') - INTERVAL how_often DAY) >
SELECT dbid, name FROM t3 a, t2 b, t4 WHERE dbid = - 1 AND primary_uid = '1' AND ((date_format(now() , '%Y-%m-%d') - INTERVAL how_often DAY) >= ifnull((SELECT date_format(max(create_date),'%Y-%m-%d') FROM t1 WHERE dbid = b.db_id AND taskid = a.taskgenid), '1950-01-01')) AND t4.task_id = taskid; SELECT dbid, name FROM t3 a, t2 b, t4 WHERE dbid = - 1 AND primary_uid = '1' AND ((date_format(now() , '%Y-%m-%d') - INTERVAL how_often DAY) >= ifnull((SELECT date_format(max(create_date),'%Y-%m-%d') FROM t1 WHERE dbid = b.db_id AND taskid = a.taskgenid), '1950-01-01')) AND t4.task_id = taskid;
drop table t1,t2,t3,t4; drop table t1,t2,t3,t4;
#
# cardinality check
#
CREATE TABLE t1 (id int(11) default NULL) TYPE=MyISAM CHARSET=latin1;
INSERT INTO t1 VALUES (1),(5);
CREATE TABLE t2 (id int(11) default NULL) TYPE=MyISAM CHARSET=latin1;
INSERT INTO t2 VALUES (2),(6);
-- error 1240
select * from t1 where (1,2,6) in (select * from t2);
DROP TABLE t1,t2;
# #
# DO and SET with errors # DO and SET with errors
# #
......
...@@ -514,6 +514,12 @@ Item_in_subselect::single_value_transformer(JOIN *join, ...@@ -514,6 +514,12 @@ Item_in_subselect::single_value_transformer(JOIN *join,
THD *thd= join->thd; THD *thd= join->thd;
thd->where= "scalar IN/ALL/ANY subquery"; thd->where= "scalar IN/ALL/ANY subquery";
if (select_lex->item_list.elements > 1)
{
my_error(ER_OPERAND_COLUMNS, MYF(0), 1);
DBUG_RETURN(RES_ERROR);
}
if ((abort_on_null || (upper_not && upper_not->top_level())) && if ((abort_on_null || (upper_not && upper_not->top_level())) &&
!select_lex->master_unit()->dependent && !select_lex->master_unit()->dependent &&
(func == &Item_bool_func2::gt_creator || (func == &Item_bool_func2::gt_creator ||
...@@ -606,11 +612,6 @@ Item_in_subselect::single_value_transformer(JOIN *join, ...@@ -606,11 +612,6 @@ Item_in_subselect::single_value_transformer(JOIN *join,
select_lex->dependent= 1; select_lex->dependent= 1;
Item *item; Item *item;
if (select_lex->item_list.elements > 1)
{
my_error(ER_OPERAND_COLUMNS, MYF(0), 1);
DBUG_RETURN(RES_ERROR);
}
item= (Item*) select_lex->item_list.head(); item= (Item*) select_lex->item_list.head();
...@@ -710,6 +711,12 @@ Item_in_subselect::row_value_transformer(JOIN *join, ...@@ -710,6 +711,12 @@ Item_in_subselect::row_value_transformer(JOIN *join,
SELECT_LEX *select_lex= join->select_lex; SELECT_LEX *select_lex= join->select_lex;
if (select_lex->item_list.elements != left_expr->cols())
{
my_error(ER_OPERAND_COLUMNS, MYF(0), left_expr->cols());
DBUG_RETURN(RES_ERROR);
}
if (!substitution) if (!substitution)
{ {
//first call for this unit //first call for this unit
......
...@@ -1795,6 +1795,7 @@ Item_func_group_concat::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) ...@@ -1795,6 +1795,7 @@ Item_func_group_concat::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
*/ */
for (i= 0 ; i < arg_count_order ; i++) for (i= 0 ; i < arg_count_order ; i++)
{ {
// order_item->item can be changed by fix_fields() call
ORDER *order_item= order[i]; ORDER *order_item= order[i];
if ((*order_item->item)->fix_fields(thd, tables, order_item->item) || if ((*order_item->item)->fix_fields(thd, tables, order_item->item) ||
(*order_item->item)->check_cols(1)) (*order_item->item)->check_cols(1))
......
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