summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <sanja@montyprogram.com>2012-06-21 18:47:13 +0300
committerunknown <sanja@montyprogram.com>2012-06-21 18:47:13 +0300
commit60561ae6133cf40f4fc445e1d6e8f395a20b2573 (patch)
treeb45c0166a329abe7f84e6b036e9953fa446e18f3 /sql
parentd9c3a3e39e4c5a6f060b7bbc1646ca74c123fbab (diff)
downloadmariadb-git-60561ae6133cf40f4fc445e1d6e8f395a20b2573.tar.gz
Fix for LP bug#1001505 and LP bug#1001510
We set correct cmp_context during preparation to avoid changing it later by Item_field::equal_fields_propagator. (see mysql bugs #57135 #57692 during merging)
Diffstat (limited to 'sql')
-rw-r--r--sql/item_cmpfunc.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 61554bdf420..847c51b8a5e 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -3095,6 +3095,15 @@ void Item_func_case::fix_length_and_dec()
return;
}
}
+ /*
+ Set cmp_context of all WHEN arguments. This prevents
+ Item_field::equal_fields_propagator() from transforming a
+ zerofill argument into a string constant. Such a change would
+ require rebuilding cmp_items.
+ */
+ for (i= 0; i < ncases; i+= 2)
+ args[i]->cmp_context= item_cmp_type(left_result_type,
+ args[i]->result_type());
}
if (else_expr_num == -1 || args[else_expr_num]->maybe_null)
@@ -4081,6 +4090,16 @@ void Item_func_in::fix_length_and_dec()
}
}
}
+ /*
+ Set cmp_context of all arguments. This prevents
+ Item_field::equal_fields_propagator() from transforming a zerofill integer
+ argument into a string constant. Such a change would require rebuilding
+ cmp_itmes.
+ */
+ for (arg= args + 1, arg_end= args + arg_count; arg != arg_end ; arg++)
+ {
+ arg[0]->cmp_context= item_cmp_type(left_result_type, arg[0]->result_type());
+ }
max_length= 1;
}