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

merge

parents 8e80431f 777316c3
......@@ -1486,3 +1486,10 @@ ERROR 42S22: Unknown column 't1.s2' in 'group statement'
select count(*) from t2 group by t1.s2;
ERROR 42S02: Unknown table 't1' in group statement
drop table t1, t2;
CREATE TABLE t1(COLA FLOAT NOT NULL,COLB FLOAT NOT NULL,COLC VARCHAR(20) DEFAULT NULL,PRIMARY KEY (COLA, COLB));
CREATE TABLE t2(COLA FLOAT NOT NULL,COLB FLOAT NOT NULL,COLC CHAR(1) NOT NULL,PRIMARY KEY (COLA));
INSERT INTO t1 VALUES (1,1,'1A3240'), (1,2,'4W2365');
INSERT INTO t2 VALUES (100, 200, 'C');
SELECT DISTINCT COLC FROM t1 WHERE COLA = (SELECT COLA FROM t2 WHERE COLB = 200 AND COLC ='C' LIMIT 1);
COLC
DROP TABLE t1, t2;
......@@ -999,3 +999,13 @@ select * from t1 where (select count(*) from t2 group by t1.s2) = 1;
-- error 1109
select count(*) from t2 group by t1.s2;
drop table t1, t2;
#
# fix_fields() in add_ref_to_table_cond()
#
CREATE TABLE t1(COLA FLOAT NOT NULL,COLB FLOAT NOT NULL,COLC VARCHAR(20) DEFAULT NULL,PRIMARY KEY (COLA, COLB));
CREATE TABLE t2(COLA FLOAT NOT NULL,COLB FLOAT NOT NULL,COLC CHAR(1) NOT NULL,PRIMARY KEY (COLA));
INSERT INTO t1 VALUES (1,1,'1A3240'), (1,2,'4W2365');
INSERT INTO t2 VALUES (100, 200, 'C');
SELECT DISTINCT COLC FROM t1 WHERE COLA = (SELECT COLA FROM t2 WHERE COLB = 200 AND COLC ='C' LIMIT 1);
DROP TABLE t1, t2;s
......@@ -512,7 +512,6 @@ String *Item_in_subselect::val_str(String *str)
Item_subselect::trans_res
Item_in_subselect::single_value_transformer(JOIN *join,
Item *left_expr,
compare_func_creator func)
{
DBUG_ENTER("Item_in_subselect::single_value_transformer");
......@@ -587,7 +586,7 @@ Item_in_subselect::single_value_transformer(JOIN *join,
// left expression belong to outer select
SELECT_LEX *current= thd->lex.current_select, *up;
thd->lex.current_select= up= current->return_after_parsing();
if (left_expr->fix_fields(thd, up->get_table_list(), 0))
if (left_expr->fix_fields(thd, up->get_table_list(), &left_expr))
{
thd->lex.current_select= current;
DBUG_RETURN(RES_ERROR);
......@@ -716,8 +715,7 @@ Item_in_subselect::single_value_transformer(JOIN *join,
}
Item_subselect::trans_res
Item_in_subselect::row_value_transformer(JOIN *join,
Item *left_expr)
Item_in_subselect::row_value_transformer(JOIN *join)
{
DBUG_ENTER("Item_in_subselect::row_value_transformer");
......@@ -800,16 +798,16 @@ Item_subselect::trans_res
Item_in_subselect::select_transformer(JOIN *join)
{
if (left_expr->cols() == 1)
return single_value_transformer(join, left_expr,
return single_value_transformer(join,
&Item_bool_func2::eq_creator);
return row_value_transformer(join, left_expr);
return row_value_transformer(join);
}
Item_subselect::trans_res
Item_allany_subselect::select_transformer(JOIN *join)
{
return single_value_transformer(join, left_expr, func);
return single_value_transformer(join, func);
}
subselect_single_select_engine::
......
......@@ -210,10 +210,8 @@ public:
}
trans_res select_transformer(JOIN *join);
trans_res single_value_transformer(JOIN *join,
Item *left_expr,
compare_func_creator func);
trans_res row_value_transformer(JOIN * join,
Item *left_expr);
trans_res row_value_transformer(JOIN * join);
longlong val_int();
double val();
String *val_str(String*);
......
......@@ -2279,7 +2279,11 @@ int set_var::update(THD *thd)
int set_var_user::check(THD *thd)
{
return (user_var_item->fix_fields(thd,0, (Item**) 0) ||
/*
Item_func_set_user_var can't substitute something else on its place =>
0 can be passed as last argument
*/
return (user_var_item->fix_fields(thd, 0, (Item**) 0) ||
user_var_item->check()) ? -1 : 0;
}
......
......@@ -8525,11 +8525,7 @@ static bool add_ref_to_table_cond(THD *thd, JOIN_TAB *join_tab)
if (thd->is_fatal_error)
DBUG_RETURN(TRUE);
/*
Here we pass 0 as the first argument to fix_fields that don't need
to do any stack checking (This is already done in the initial fix_fields).
*/
cond->fix_fields((THD *) 0,(TABLE_LIST *) 0, (Item**)&cond);
cond->fix_fields(thd,(TABLE_LIST *) 0, (Item**)&cond);
if (join_tab->select)
{
error=(int) cond->add(join_tab->select->cond);
......
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