summaryrefslogtreecommitdiff
path: root/sql/item_func.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/item_func.cc')
-rw-r--r--sql/item_func.cc13
1 files changed, 10 insertions, 3 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 4b376706500..152ee9fc8f6 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -431,7 +431,7 @@ void Item_args::propagate_equal_fields(THD *thd,
See comments in Item_cond::split_sum_func()
*/
-void Item_func::split_sum_func(THD *thd, Item **ref_pointer_array,
+void Item_func::split_sum_func(THD *thd, Ref_ptr_array ref_pointer_array,
List<Item> &fields, uint flags)
{
Item **arg, **arg_end;
@@ -4902,9 +4902,16 @@ Item_func_set_user_var::update_hash(void *ptr, uint length,
If we set a variable explicitely to NULL then keep the old
result type of the variable
*/
- if ((null_value= args[0]->null_value) && null_item)
+ if (args[0]->type() == Item::FIELD_ITEM)
+ {
+ /* args[0]->null_value may be outdated */
+ null_value= ((Item_field*)args[0])->field->is_null();
+ }
+ else
+ null_value= args[0]->null_value;
+ if (null_value && null_item)
res_type= m_var_entry->type; // Don't change type of item
- if (::update_hash(m_var_entry, (null_value= args[0]->null_value),
+ if (::update_hash(m_var_entry, null_value,
ptr, length, res_type, cs, unsigned_arg))
{
null_value= 1;