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

fixed bug with thd->allow_sum_func value in subselect

parent 1b62dc02
...@@ -12,6 +12,9 @@ SELECT (SELECT 1 FROM (SELECT 1) HAVING a=1) as a; ...@@ -12,6 +12,9 @@ SELECT (SELECT 1 FROM (SELECT 1) HAVING a=1) as a;
Reference 'a' not supported (forward reference in item list) Reference 'a' not supported (forward reference in item list)
SELECT (SELECT 1 FROM (SELECT 1) HAVING b=1) as a,(SELECT 1 FROM (SELECT 1) HAVING a=1) as b; SELECT (SELECT 1 FROM (SELECT 1) HAVING b=1) as a,(SELECT 1 FROM (SELECT 1) HAVING a=1) as b;
Reference 'b' not supported (forward reference in item list) Reference 'b' not supported (forward reference in item list)
SELECT (SELECT 1),MAX(1) FROM (SELECT 1);
(SELECT 1) MAX(1)
1 1
drop table if exists t1,t2,t3,t4,t5,attend,clinic,inscrit; drop table if exists t1,t2,t3,t4,t5,attend,clinic,inscrit;
create table t1 (a int); create table t1 (a int);
create table t2 (a int, b int); create table t2 (a int, b int);
......
...@@ -5,6 +5,7 @@ SELECT (SELECT (SELECT 0 UNION SELECT 0)); ...@@ -5,6 +5,7 @@ SELECT (SELECT (SELECT 0 UNION SELECT 0));
SELECT (SELECT 1 FROM (SELECT 1) HAVING a=1) as a; SELECT (SELECT 1 FROM (SELECT 1) HAVING a=1) as a;
-- error 1245 -- error 1245
SELECT (SELECT 1 FROM (SELECT 1) HAVING b=1) as a,(SELECT 1 FROM (SELECT 1) HAVING a=1) as b; SELECT (SELECT 1 FROM (SELECT 1) HAVING b=1) as a,(SELECT 1 FROM (SELECT 1) HAVING a=1) as b;
SELECT (SELECT 1),MAX(1) FROM (SELECT 1);
drop table if exists t1,t2,t3,t4,t5,attend,clinic,inscrit; drop table if exists t1,t2,t3,t4,t5,attend,clinic,inscrit;
create table t1 (a int); create table t1 (a int);
create table t2 (a int, b int); create table t2 (a int, b int);
......
...@@ -2225,8 +2225,10 @@ int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds) ...@@ -2225,8 +2225,10 @@ int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds)
{ {
DBUG_ENTER("setup_conds"); DBUG_ENTER("setup_conds");
thd->set_query_id=1; thd->set_query_id=1;
thd->cond_count=0;
thd->allow_sum_func=0; thd->cond_count= 0;
bool save_allow_sum_func= thd->allow_sum_func;
thd->allow_sum_func= 0;
if (*conds) if (*conds)
{ {
thd->where="where clause"; thd->where="where clause";
...@@ -2299,6 +2301,7 @@ int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds) ...@@ -2299,6 +2301,7 @@ int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds)
table->on_expr=and_conds(table->on_expr,cond_and); table->on_expr=and_conds(table->on_expr,cond_and);
} }
} }
thd->allow_sum_func= save_allow_sum_func;
DBUG_RETURN(test(thd->fatal_error)); DBUG_RETURN(test(thd->fatal_error));
} }
......
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