diff options
author | unknown <monty@mysql.com> | 2005-02-08 14:41:09 +0200 |
---|---|---|
committer | unknown <monty@mysql.com> | 2005-02-08 14:41:09 +0200 |
commit | 63982db93ceac93bf6dd72f8cae41f8ea06cda0a (patch) | |
tree | 7f61ad1d6f95b1672a681f050e260fa65e4b13a7 /sql/item_row.cc | |
parent | 6a1e75621155f700bc6912f9669a5a374342b712 (diff) | |
download | mariadb-git-63982db93ceac93bf6dd72f8cae41f8ea06cda0a.tar.gz |
Better bugfix for "HAVING when refering to RAND()" (Bug #8216)
Ensure that references in HAVING, ORDER BY or GROUP BY are calculated after fields in SELECT.
This will ensure that any reference to these has a valid value.
Generalized the code for split_sum_func()
BitKeeper/etc/ignore:
added support-files/ndb-config-2-node.ini
mysql-test/r/group_by.result:
More complicated test to assure that rand() is only calulated once
mysql-test/r/user_var.result:
Back to old results :( (ok but not perfect)
mysql-test/t/group_by.test:
More complicated test to assure that rand() is only calulated once
sql/item.cc:
Better bugfix for "HAVING when refering to RAND()"
This will ensure that when refering to things like RAND() in HAVING through an alias we will not recalculate that rand() value in the HAVING part but use the value in the row
Generalize split_sum_func()
sql/item.h:
Better bugfix for "HAVING when refering to RAND()"
T
sql/item_cmpfunc.cc:
Better bugfix for "HAVING when refering to RAND()"
Use generalized split_sum_func2() function
sql/item_func.cc:
Better bugfix for "HAVING when refering to RAND()"
Use generalized split_sum_func2() function
sql/item_row.cc:
Better bugfix for "HAVING when refering to RAND()"
Use generalized split_sum_func2() function
sql/item_strfunc.cc:
Better bugfix for "HAVING when refering to RAND()"
Use generalized split_sum_func2() function
sql/sql_list.h:
Add functions to concatenate lists
sql/sql_select.cc:
Better bugfix for "HAVING when refering to RAND()"
Ensure that references in HAVING, ORDER BY or GROUP BY are calculated after fields in SELECT.
This will ensure that any reference to these has a valid value.
Diffstat (limited to 'sql/item_row.cc')
-rw-r--r-- | sql/item_row.cc | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/sql/item_row.cc b/sql/item_row.cc index 0ace0fc0451..12d202a1699 100644 --- a/sql/item_row.cc +++ b/sql/item_row.cc @@ -90,25 +90,10 @@ void Item_row::split_sum_func(THD *thd, Item **ref_pointer_array, { Item **arg, **arg_end; for (arg= items, arg_end= items+arg_count; arg != arg_end ; arg++) - { - 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; - Item *new_item= new Item_ref(ref_pointer_array + el, 0, (*arg)->name); - fields.push_front(*arg); - ref_pointer_array[el]= *arg; - thd->change_item_tree(arg, new_item); - } - } + (*arg)->split_sum_func2(thd, ref_pointer_array, fields, arg); } + void Item_row::update_used_tables() { used_tables_cache= 0; |