diff options
author | unknown <serg@serg.mysql.com> | 2001-04-17 14:17:22 +0200 |
---|---|---|
committer | unknown <serg@serg.mysql.com> | 2001-04-17 14:17:22 +0200 |
commit | 023f4e54f100144489feaa99a1e2ca92c0ddad7d (patch) | |
tree | 884e11a1a12c75cdab0c82cf051989c0ce956675 /sql | |
parent | 4b570fc359635b216abd8852c31ac32cb35bae46 (diff) | |
download | mariadb-git-023f4e54f100144489feaa99a1e2ca92c0ddad7d.tar.gz |
bugfix: HAVING MATCH
Diffstat (limited to 'sql')
-rw-r--r-- | sql/item.h | 2 | ||||
-rw-r--r-- | sql/item_func.cc | 9 | ||||
-rw-r--r-- | sql/sql_select.cc | 5 |
3 files changed, 10 insertions, 6 deletions
diff --git a/sql/item.h b/sql/item.h index 8b9a645d39b..9ad633d9278 100644 --- a/sql/item.h +++ b/sql/item.h @@ -298,8 +298,8 @@ public: class Item_ref :public Item_ident { - Item **ref; public: + Item **ref; Item_ref(char *db_par,char *table_name_par,char *field_name_par) :Item_ident(db_par,table_name_par,field_name_par),ref(0) {} Item_ref(Item **item, char *table_name_par,char *field_name_par) diff --git a/sql/item_func.cc b/sql/item_func.cc index 6c4e3e34fe3..84bc972608e 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -1961,12 +1961,15 @@ bool Item_func_match::fix_fields(THD *thd,struct st_table_list *tlist) while ((item=li++)) { - if (item->type() != Item::FIELD_ITEM || item->fix_fields(thd,tlist) || - !item->used_tables()) + if (item->fix_fields(thd,tlist)) + return 1; + if (item->type() == Item::REF_ITEM) + li.replace(item= *((Item_ref *)item)->ref); + if (item->type() != Item::FIELD_ITEM || !item->used_tables()) return 1; used_tables_cache|=item->used_tables(); } - /* check that all columns comes from the same table */ + /* check that all columns come from the same table */ if (count_bits(used_tables_cache) != 1) return 1; const_item_cache=0; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index db95214cfa3..e726a9969ca 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -178,8 +178,7 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds, setup_fields(thd,tables,fields,1,&all_fields) || setup_conds(thd,tables,&conds) || setup_order(thd,tables,fields,all_fields,order) || - setup_group(thd,tables,fields,all_fields,group,&hidden_group_fields) || - setup_ftfuncs(thd,tables,ftfuncs)) + setup_group(thd,tables,fields,all_fields,group,&hidden_group_fields)) DBUG_RETURN(-1); /* purecov: inspected */ if (having) @@ -191,6 +190,8 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds, if (having->with_sum_func) having->split_sum_func(all_fields); } + if (setup_ftfuncs(thd,tables,ftfuncs)) /* should be after having->fix_fields */ + DBUG_RETURN(-1); /* Check if one one uses a not constant column with group functions and no GROUP BY. |