diff options
author | monty@mysql.com <> | 2005-02-07 18:13:57 +0200 |
---|---|---|
committer | monty@mysql.com <> | 2005-02-07 18:13:57 +0200 |
commit | 32f91f48e8ac3a7ea998ec9cdf7d1c53b714250c (patch) | |
tree | 3fa14495db5e1376fa69b1a6f662a5e7afdc82da /sql/item_row.cc | |
parent | e7450d9781781666503837d748cf313e3f406f59 (diff) | |
download | mariadb-git-32f91f48e8ac3a7ea998ec9cdf7d1c53b714250c.tar.gz |
Fixed bug in HAVING when refering to RAND() through alias
(BUG 8216)
Diffstat (limited to 'sql/item_row.cc')
-rw-r--r-- | sql/item_row.cc | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/sql/item_row.cc b/sql/item_row.cc index 4e4957b980e..0ace0fc0451 100644 --- a/sql/item_row.cc +++ b/sql/item_row.cc @@ -84,15 +84,20 @@ bool Item_row::fix_fields(THD *thd, TABLE_LIST *tabl, Item **ref) return 0; } + void Item_row::split_sum_func(THD *thd, Item **ref_pointer_array, List<Item> &fields) { Item **arg, **arg_end; for (arg= items, arg_end= items+arg_count; arg != arg_end ; arg++) { - if ((*arg)->with_sum_func && (*arg)->type() != SUM_FUNC_ITEM) - (*arg)->split_sum_func(thd, ref_pointer_array, fields); - else if ((*arg)->used_tables() || (*arg)->type() == SUM_FUNC_ITEM) + Item *item= *arg; + if (item->type() != SUM_FUNC_ITEM && + (item->with_sum_func || + (item->used_tables() & PSEUDO_TABLE_BITS))) + item->split_sum_func(thd, ref_pointer_array, fields); + else if (item->type() == SUM_FUNC_ITEM || + (item->used_tables() && item->type() != REF_ITEM)) { uint el= fields.elements; ref_pointer_array[el]=*arg; |