temporary preventing subselect in HAVING clause

This commit is contained in:
unknown 2002-06-07 21:26:43 +03:00
parent c06575e412
commit b0c1e00467
4 changed files with 16 additions and 3 deletions

View File

@ -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)
{ {

View File

@ -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";

View File

@ -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

View File

@ -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);