Commit b0c1e004 authored by unknown's avatar unknown

temporary preventing subselect in HAVING clause

parent c06575e4
...@@ -102,6 +102,13 @@ void Item_subselect::make_field (Send_field *tmp_field) ...@@ -102,6 +102,13 @@ void Item_subselect::make_field (Send_field *tmp_field)
bool Item_subselect::fix_fields(THD *thd,TABLE_LIST *tables) bool Item_subselect::fix_fields(THD *thd,TABLE_LIST *tables)
{ {
if (thd->having_fix_field)
{
//TODO: subselects in having do not suported now
my_printf_error(ER_SYNTAX_ERROR, ER(ER_SYNTAX_ERROR), MYF(0));
return 1;
}
// Is it one field subselect? // Is it one field subselect?
if (select_lex->item_list.elements != 1) if (select_lex->item_list.elements != 1)
{ {
......
...@@ -80,8 +80,8 @@ static void free_var(user_var_entry *entry) ...@@ -80,8 +80,8 @@ static void free_var(user_var_entry *entry)
****************************************************************************/ ****************************************************************************/
THD::THD():user_time(0),fatal_error(0),last_insert_id_used(0), THD::THD():user_time(0),fatal_error(0),last_insert_id_used(0),
insert_id_used(0),in_lock_tables(0), insert_id_used(0), in_lock_tables(0),
global_read_lock(0),bootstrap(0) global_read_lock(0), bootstrap(0), having_fix_field(0)
{ {
host=user=priv_user=db=query=ip=0; host=user=priv_user=db=query=ip=0;
host_or_ip="unknown ip"; host_or_ip="unknown ip";
......
...@@ -428,6 +428,8 @@ public: ...@@ -428,6 +428,8 @@ public:
bool query_error, bootstrap, cleanup_done; bool query_error, bootstrap, cleanup_done;
bool safe_to_cache_query; bool safe_to_cache_query;
bool volatile killed; bool volatile killed;
// TRUE when having fix field called
bool having_fix_field;
/* /*
If we do a purge of binary logs, log index info of the threads If we do a purge of binary logs, log index info of the threads
that are currently reading it needs to be adjusted. To do that that are currently reading it needs to be adjusted. To do that
......
...@@ -229,7 +229,11 @@ JOIN::prepare(TABLE_LIST *tables_init, ...@@ -229,7 +229,11 @@ JOIN::prepare(TABLE_LIST *tables_init,
{ {
thd->where="having clause"; thd->where="having clause";
thd->allow_sum_func=1; thd->allow_sum_func=1;
if (having->fix_fields(thd,tables_list) || thd->fatal_error) bool having_fix_field_store= thd->having_fix_field;
thd->having_fix_field= 1;
bool having_fix_rc= having->fix_fields(thd,tables_list);
thd->having_fix_field= having_fix_field_store;
if (having_fix_rc || thd->fatal_error)
DBUG_RETURN(-1); /* purecov: inspected */ DBUG_RETURN(-1); /* purecov: inspected */
if (having->with_sum_func) if (having->with_sum_func)
having->split_sum_func(all_fields); having->split_sum_func(all_fields);
......
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