From f64483cb909aa557d27fde12090baae41f5d6578 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 8 Sep 2006 14:08:29 +0400 Subject: [PATCH 1/3] Bug #20924: CAST(expr as UNSIGNED) returns SIGNED value when used in various functions - Honor unsigned_flag in the corresponding functions - Use compare_int_signed_unsigned()/compare_int_unsigned_signed() instead of explicit comparison in GREATEST() and LEAST() mysql-test/r/case.result: Added test case for bug #20924 mysql-test/r/func_if.result: Added test case for bug #20924 mysql-test/r/func_test.result: Added test case for bug #20924 mysql-test/r/user_var.result: Added test case for bug #20924 mysql-test/t/case.test: Added test case for bug #20924 mysql-test/t/func_if.test: Added test case for bug #20924 mysql-test/t/func_test.test: Added test case for bug #20924 mysql-test/t/user_var.test: Added test case for bug #20924 sql/item_cmpfunc.cc: Bug #20924: CAST(expr as UNSIGNED) returns SIGNED value when used in various functions - Moved some code out of Arg_comparator to external functions to be reused in Item_func_min_max - Fixed IFNULL(), IF(), CASE() and COALESCE() sql/item_cmpfunc.h: Bug #20924: CAST(expr as UNSIGNED) returns SIGNED value when used in various functions - Moved some code out of Arg_comparator to external functions to be reused in Item_func_min_max sql/item_func.cc: Bug #20924: CAST(expr as UNSIGNED) returns SIGNED value when used in various functions Fixed LEAST(), GREATEST() and "SET @a=..." parts sql/item_func.h: Bug #20924: CAST(expr as UNSIGNED) returns SIGNED value when used in various functions Fixed "SET @a=..." part sql/sql_class.h: Bug #20924: CAST(expr as UNSIGNED) returns SIGNED value when used in various functions Fixed "SET @a=..." part --- mysql-test/r/case.result | 6 ++++++ mysql-test/r/func_if.result | 6 ++++++ mysql-test/r/func_test.result | 6 ++++++ mysql-test/r/user_var.result | 4 ++++ mysql-test/t/case.test | 6 ++++++ mysql-test/t/func_if.test | 10 ++++++++++ mysql-test/t/func_test.test | 6 ++++++ mysql-test/t/user_var.test | 6 ++++++ sql/item_cmpfunc.cc | 21 +++++++++----------- sql/item_cmpfunc.h | 14 +++++++++++++ sql/item_func.cc | 37 ++++++++++++++++++++++++++++------- sql/item_func.h | 2 +- sql/sql_class.h | 1 + 13 files changed, 105 insertions(+), 20 deletions(-) diff --git a/mysql-test/r/case.result b/mysql-test/r/case.result index a5495d0fc3e..ccac701bfc1 100644 --- a/mysql-test/r/case.result +++ b/mysql-test/r/case.result @@ -177,3 +177,9 @@ from t1 where b=3 group by b; min(a) min(case when 1=1 then a else NULL end) min(case when 1!=1 then NULL else a end) 2 2 2 drop table t1; +SELECT CASE 1 WHEN 1 THEN 18446744073709551615 ELSE 1 END; +CASE 1 WHEN 1 THEN 18446744073709551615 ELSE 1 END +18446744073709551615 +SELECT COALESCE(18446744073709551615); +COALESCE(18446744073709551615) +18446744073709551615 diff --git a/mysql-test/r/func_if.result b/mysql-test/r/func_if.result index 2c8f19f1754..e9aa195d175 100644 --- a/mysql-test/r/func_if.result +++ b/mysql-test/r/func_if.result @@ -99,3 +99,9 @@ a NULLIF(a,'') NULL NULL NULL DROP TABLE t1; +SELECT IF(1 != 0, 18446744073709551615, 1); +IF(1 != 0, 18446744073709551615, 1) +18446744073709551615 +SELECT IFNULL(NULL, 18446744073709551615); +IFNULL(NULL, 18446744073709551615) +18446744073709551615 diff --git a/mysql-test/r/func_test.result b/mysql-test/r/func_test.result index 8a28312b348..cc27865cc4c 100644 --- a/mysql-test/r/func_test.result +++ b/mysql-test/r/func_test.result @@ -183,3 +183,9 @@ select 5.1 mod 3, 5.1 mod -3, -5.1 mod 3, -5.1 mod -3; select 5 mod 3, 5 mod -3, -5 mod 3, -5 mod -3; 5 mod 3 5 mod -3 -5 mod 3 -5 mod -3 2 2 -2 -2 +SELECT GREATEST(1, 18446744073709551615); +GREATEST(1, 18446744073709551615) +18446744073709551615 +SELECT LEAST(1, 18446744073709551615); +LEAST(1, 18446744073709551615) +1 diff --git a/mysql-test/r/user_var.result b/mysql-test/r/user_var.result index 58b785d1432..dce852e84ae 100644 --- a/mysql-test/r/user_var.result +++ b/mysql-test/r/user_var.result @@ -203,3 +203,7 @@ select @@global.version; select @@session.VERSION; @@session.VERSION # +set @a=18446744073709551615; +select @a; +@a +18446744073709551615 diff --git a/mysql-test/t/case.test b/mysql-test/t/case.test index fd1b6e5247f..b868ae12b69 100644 --- a/mysql-test/t/case.test +++ b/mysql-test/t/case.test @@ -130,4 +130,10 @@ select min(a), min(case when 1=1 then a else NULL end), from t1 where b=3 group by b; drop table t1; +# +# Bug #20924: UNSIGNED values in CASE and COALESCE are treated as SIGNED +# +SELECT CASE 1 WHEN 1 THEN 18446744073709551615 ELSE 1 END; +SELECT COALESCE(18446744073709551615); + # End of 4.1 tests diff --git a/mysql-test/t/func_if.test b/mysql-test/t/func_if.test index 5756793c673..17117b07437 100644 --- a/mysql-test/t/func_if.test +++ b/mysql-test/t/func_if.test @@ -73,4 +73,14 @@ SELECT a, NULLIF(a,'') FROM t1 WHERE NULLIF(a,'') IS NULL; DROP TABLE t1; +# +# Bug #20924: UNSIGNED values in IF() are treated as SIGNED +# +SELECT IF(1 != 0, 18446744073709551615, 1); + +# +# Bug #20924: UNSIGNED values in IFNULL() are treated as SIGNED +# +SELECT IFNULL(NULL, 18446744073709551615); + # End of 4.1 tests diff --git a/mysql-test/t/func_test.test b/mysql-test/t/func_test.test index 2ad64b6c5a6..631639c7a74 100644 --- a/mysql-test/t/func_test.test +++ b/mysql-test/t/func_test.test @@ -108,4 +108,10 @@ select 5.1 mod 3, 5.1 mod -3, -5.1 mod 3, -5.1 mod -3; select 5 mod 3, 5 mod -3, -5 mod 3, -5 mod -3; +# +# Bug #20924: UNSIGNED values in GREATEST() and LEAST() are treated as SIGNED +# +SELECT GREATEST(1, 18446744073709551615); +SELECT LEAST(1, 18446744073709551615); + # End of 4.1 tests diff --git a/mysql-test/t/user_var.test b/mysql-test/t/user_var.test index 7691a574a2a..810d5e96da5 100644 --- a/mysql-test/t/user_var.test +++ b/mysql-test/t/user_var.test @@ -141,4 +141,10 @@ select @@global.version; --replace_column 1 # select @@session.VERSION; +# +# Bug #20924 SET on a user variable saves UNSIGNED as SIGNED +# +set @a=18446744073709551615; +select @a; + # End of 4.1 tests diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index f14efc7187b..cf8d0c39d58 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -619,11 +619,7 @@ int Arg_comparator::compare_int_signed_unsigned() if (!(*b)->null_value) { owner->null_value= 0; - if (sval1 < 0 || (ulonglong)sval1 < uval2) - return -1; - if ((ulonglong)sval1 == uval2) - return 0; - return 1; + return ::compare_int_signed_unsigned(sval1, uval2); } } owner->null_value= 1; @@ -644,13 +640,7 @@ int Arg_comparator::compare_int_unsigned_signed() if (!(*b)->null_value) { owner->null_value= 0; - if (sval2 < 0) - return 1; - if (uval1 < (ulonglong)sval2) - return -1; - if (uval1 == (ulonglong)sval2) - return 0; - return 1; + return ::compare_int_unsigned_signed(uval1, sval2); } } owner->null_value= 1; @@ -1162,11 +1152,13 @@ Item_func_ifnull::val_int() if (!args[0]->null_value) { null_value=0; + unsigned_flag= args[0]->unsigned_flag; return value; } value=args[1]->val_int(); if ((null_value=args[1]->null_value)) return 0; + unsigned_flag= args[1]->unsigned_flag; return value; } @@ -1286,6 +1278,7 @@ Item_func_if::val_int() Item *arg= args[0]->val_int() ? args[1] : args[2]; longlong value=arg->val_int(); null_value=arg->null_value; + unsigned_flag= arg->unsigned_flag; return value; } @@ -1492,6 +1485,7 @@ longlong Item_func_case::val_int() } res=item->val_int(); null_value=item->null_value; + unsigned_flag= item->unsigned_flag; return res; } @@ -1623,7 +1617,10 @@ longlong Item_func_coalesce::val_int() { longlong res=args[i]->val_int(); if (!args[i]->null_value) + { + unsigned_flag= args[i]->unsigned_flag; return res; + } } null_value=1; return 0; diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 73abe208d9e..513260205c2 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -1077,3 +1077,17 @@ inline Item *and_conds(Item *a, Item *b) } Item *and_expressions(Item *a, Item *b, Item **org_item); + +inline int compare_int_signed_unsigned(longlong sval, ulonglong uval) +{ + if (sval < 0 || (ulonglong)sval < uval) + return -1; + if ((ulonglong)sval == uval) + return 0; + return 1; +} + +inline int compare_int_unsigned_signed(ulonglong uval, longlong sval) +{ + return -compare_int_signed_unsigned(sval, uval); +} diff --git a/sql/item_func.cc b/sql/item_func.cc index 91ccef6511f..85865ad6fb6 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -1235,19 +1235,35 @@ longlong Item_func_min_max::val_int() { DBUG_ASSERT(fixed == 1); longlong value=0; + my_bool arg_unsigned_flag; + my_bool cmp; null_value=1; for (uint i=0; i < arg_count ; i++) { + longlong tmp= args[i]->val_int(); + arg_unsigned_flag= args[i]->unsigned_flag; if (null_value) { - value=args[i]->val_int(); + value= tmp; null_value=args[i]->null_value; + unsigned_flag= arg_unsigned_flag; } else { - longlong tmp=args[i]->val_int(); - if (!args[i]->null_value && (tmp < value ? cmp_sign : -cmp_sign) > 0) - value=tmp; + if (args[i]->null_value) + continue; + if (unsigned_flag && arg_unsigned_flag || + (!unsigned_flag && !arg_unsigned_flag)) + cmp= tmp < value; + else if (unsigned_flag) + cmp= compare_int_signed_unsigned(tmp, value) < 0; + else + cmp= compare_int_unsigned_signed(tmp, value) < 0; + if ((cmp ? cmp_sign : -cmp_sign) > 0) + { + value= tmp; + unsigned_flag= arg_unsigned_flag; + } } } return value; @@ -2313,6 +2329,7 @@ static user_var_entry *get_variable(HASH *hash, LEX_STRING &name, entry->length=0; entry->update_query_id=0; entry->collation.set(NULL, DERIVATION_IMPLICIT); + entry->unsigned_flag= 0; /* If we are here, we were called from a SET or a query which sets a variable. Imagine it is this: @@ -2390,7 +2407,7 @@ Item_func_set_user_var::fix_length_and_dec() bool Item_func_set_user_var::update_hash(void *ptr, uint length, Item_result type, CHARSET_INFO *cs, - Derivation dv) + Derivation dv, bool unsigned_arg) { if ((null_value=args[0]->null_value)) { @@ -2437,6 +2454,7 @@ bool Item_func_set_user_var::update_hash(void *ptr, uint length, entry->length= length; entry->type=type; entry->collation.set(cs, dv); + entry->unsigned_flag= unsigned_arg; } return 0; @@ -2507,7 +2525,10 @@ String *user_var_entry::val_str(my_bool *null_value, String *str, str->set(*(double*) value, decimals, &my_charset_bin); break; case INT_RESULT: - str->set(*(longlong*) value, &my_charset_bin); + if (!unsigned_flag) + str->set(*(longlong*) value, &my_charset_bin); + else + str->set(*(ulonglong*) value, &my_charset_bin); break; case STRING_RESULT: if (str->copy(value, length, collation.collation)) @@ -2548,6 +2569,7 @@ Item_func_set_user_var::check() case INT_RESULT: { save_result.vint= args[0]->val_int(); + unsigned_flag= args[0]->unsigned_flag; break; } case STRING_RESULT: @@ -2598,7 +2620,8 @@ Item_func_set_user_var::update() case INT_RESULT: { res= update_hash((void*) &save_result.vint, sizeof(save_result.vint), - INT_RESULT, &my_charset_bin, DERIVATION_IMPLICIT); + INT_RESULT, &my_charset_bin, DERIVATION_IMPLICIT, + unsigned_flag); break; } case STRING_RESULT: diff --git a/sql/item_func.h b/sql/item_func.h index f4a1258a02c..d9e1396fde6 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -962,7 +962,7 @@ public: longlong val_int(); String *val_str(String *str); bool update_hash(void *ptr, uint length, enum Item_result type, - CHARSET_INFO *cs, Derivation dv); + CHARSET_INFO *cs, Derivation dv, bool unsigned_arg= 0); bool check(); bool update(); enum Item_result result_type () const { return cached_result_type; } diff --git a/sql/sql_class.h b/sql/sql_class.h index f1cf9c7b3e2..2db0077c0b4 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -1460,6 +1460,7 @@ class user_var_entry char *value; ulong length, update_query_id, used_query_id; Item_result type; + bool unsigned_flag; double val(my_bool *null_value); longlong val_int(my_bool *null_value); From 5aa6e8615e0aeb3babafcd5e93e67b72027fcdaa Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 12 Sep 2006 16:25:40 +0400 Subject: [PATCH 2/3] Post-review fixes for bug #20924 mysql-test/r/case.result: Post-review fix for bug #20924 mysql-test/r/func_if.result: Post-review fix for bug #20924 mysql-test/r/func_test.result: Post-review fix for bug #20924 mysql-test/r/user_var.result: Post-review fix for bug #20924 mysql-test/t/case.test: Post-review fix for bug #20924 mysql-test/t/func_if.test: Post-review fix for bug #20924 mysql-test/t/func_test.test: Post-review fix for bug #20924 mysql-test/t/user_var.test: Post-review fix for bug #20924 sql/item_func.cc: Post-review fix for bug #20924 sql/item_func.h: Post-review fix for bug #20924 sql/log_event.cc: Post-review fix for bug #20924 --- mysql-test/r/case.result | 1 + mysql-test/r/func_if.result | 1 + mysql-test/r/func_test.result | 1 + mysql-test/r/user_var.result | 1 + mysql-test/t/case.test | 6 ++++-- mysql-test/t/func_if.test | 10 +++++++--- mysql-test/t/func_test.test | 6 ++++-- mysql-test/t/user_var.test | 6 ++++-- sql/item_func.cc | 13 ++++++------- sql/item_func.h | 2 +- sql/log_event.cc | 2 +- 11 files changed, 31 insertions(+), 18 deletions(-) diff --git a/mysql-test/r/case.result b/mysql-test/r/case.result index ccac701bfc1..db56fd82f72 100644 --- a/mysql-test/r/case.result +++ b/mysql-test/r/case.result @@ -183,3 +183,4 @@ CASE 1 WHEN 1 THEN 18446744073709551615 ELSE 1 END SELECT COALESCE(18446744073709551615); COALESCE(18446744073709551615) 18446744073709551615 +End of 4.1 tests diff --git a/mysql-test/r/func_if.result b/mysql-test/r/func_if.result index e9aa195d175..72275039ba7 100644 --- a/mysql-test/r/func_if.result +++ b/mysql-test/r/func_if.result @@ -105,3 +105,4 @@ IF(1 != 0, 18446744073709551615, 1) SELECT IFNULL(NULL, 18446744073709551615); IFNULL(NULL, 18446744073709551615) 18446744073709551615 +End of 4.1 tests diff --git a/mysql-test/r/func_test.result b/mysql-test/r/func_test.result index cc27865cc4c..7c9827a5005 100644 --- a/mysql-test/r/func_test.result +++ b/mysql-test/r/func_test.result @@ -189,3 +189,4 @@ GREATEST(1, 18446744073709551615) SELECT LEAST(1, 18446744073709551615); LEAST(1, 18446744073709551615) 1 +End of 4.1 tests diff --git a/mysql-test/r/user_var.result b/mysql-test/r/user_var.result index dce852e84ae..6797fb0799d 100644 --- a/mysql-test/r/user_var.result +++ b/mysql-test/r/user_var.result @@ -207,3 +207,4 @@ set @a=18446744073709551615; select @a; @a 18446744073709551615 +End of 4.1 tests diff --git a/mysql-test/t/case.test b/mysql-test/t/case.test index b868ae12b69..d0d503a8821 100644 --- a/mysql-test/t/case.test +++ b/mysql-test/t/case.test @@ -131,9 +131,11 @@ from t1 where b=3 group by b; drop table t1; # -# Bug #20924: UNSIGNED values in CASE and COALESCE are treated as SIGNED +# Bug #20924: CAST(expr as UNSIGNED) returns SIGNED value when used in various +# functions +# - UNSIGNED values in CASE and COALESCE are treated as SIGNED # SELECT CASE 1 WHEN 1 THEN 18446744073709551615 ELSE 1 END; SELECT COALESCE(18446744073709551615); -# End of 4.1 tests +--echo End of 4.1 tests diff --git a/mysql-test/t/func_if.test b/mysql-test/t/func_if.test index 17117b07437..69cfcf7860b 100644 --- a/mysql-test/t/func_if.test +++ b/mysql-test/t/func_if.test @@ -74,13 +74,17 @@ SELECT a, NULLIF(a,'') FROM t1 WHERE NULLIF(a,'') IS NULL; DROP TABLE t1; # -# Bug #20924: UNSIGNED values in IF() are treated as SIGNED +# Bug #20924: CAST(expr as UNSIGNED) returns SIGNED value when used in various +# functions +# - UNSIGNED values in IF() are treated as SIGNED # SELECT IF(1 != 0, 18446744073709551615, 1); # -# Bug #20924: UNSIGNED values in IFNULL() are treated as SIGNED +# Bug #20924: CAST(expr as UNSIGNED) returns SIGNED value when used in various +# functions +# - UNSIGNED values in IFNULL() are treated as SIGNED # SELECT IFNULL(NULL, 18446744073709551615); -# End of 4.1 tests +--echo End of 4.1 tests diff --git a/mysql-test/t/func_test.test b/mysql-test/t/func_test.test index 631639c7a74..549b0e60246 100644 --- a/mysql-test/t/func_test.test +++ b/mysql-test/t/func_test.test @@ -109,9 +109,11 @@ select 5.1 mod 3, 5.1 mod -3, -5.1 mod 3, -5.1 mod -3; select 5 mod 3, 5 mod -3, -5 mod 3, -5 mod -3; # -# Bug #20924: UNSIGNED values in GREATEST() and LEAST() are treated as SIGNED +# Bug #20924: CAST(expr as UNSIGNED) returns SIGNED value when used in various +# functions +# - UNSIGNED values in GREATEST() and LEAST() are treated as SIGNED # SELECT GREATEST(1, 18446744073709551615); SELECT LEAST(1, 18446744073709551615); -# End of 4.1 tests +--echo End of 4.1 tests diff --git a/mysql-test/t/user_var.test b/mysql-test/t/user_var.test index 810d5e96da5..b7c8f962637 100644 --- a/mysql-test/t/user_var.test +++ b/mysql-test/t/user_var.test @@ -142,9 +142,11 @@ select @@global.version; select @@session.VERSION; # -# Bug #20924 SET on a user variable saves UNSIGNED as SIGNED +# Bug #20924: CAST(expr as UNSIGNED) returns SIGNED value when used in various +# functions +# - SET on a user variable saves UNSIGNED as SIGNED # set @a=18446744073709551615; select @a; -# End of 4.1 tests +--echo End of 4.1 tests diff --git a/sql/item_func.cc b/sql/item_func.cc index 85865ad6fb6..d43dadfa4a4 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -1252,8 +1252,7 @@ longlong Item_func_min_max::val_int() { if (args[i]->null_value) continue; - if (unsigned_flag && arg_unsigned_flag || - (!unsigned_flag && !arg_unsigned_flag)) + if (unsigned_flag == arg_unsigned_flag) cmp= tmp < value; else if (unsigned_flag) cmp= compare_int_signed_unsigned(tmp, value) < 0; @@ -2614,26 +2613,26 @@ Item_func_set_user_var::update() case REAL_RESULT: { res= update_hash((void*) &save_result.vreal,sizeof(save_result.vreal), - REAL_RESULT, &my_charset_bin, DERIVATION_IMPLICIT); + REAL_RESULT, &my_charset_bin, DERIVATION_IMPLICIT, 0); break; } case INT_RESULT: { res= update_hash((void*) &save_result.vint, sizeof(save_result.vint), - INT_RESULT, &my_charset_bin, DERIVATION_IMPLICIT, - unsigned_flag); + INT_RESULT, &my_charset_bin, DERIVATION_IMPLICIT, + unsigned_flag); break; } case STRING_RESULT: { if (!save_result.vstr) // Null value res= update_hash((void*) 0, 0, STRING_RESULT, &my_charset_bin, - DERIVATION_IMPLICIT); + DERIVATION_IMPLICIT, 0); else res= update_hash((void*) save_result.vstr->ptr(), save_result.vstr->length(), STRING_RESULT, save_result.vstr->charset(), - DERIVATION_IMPLICIT); + DERIVATION_IMPLICIT, 0); break; } case ROW_RESULT: diff --git a/sql/item_func.h b/sql/item_func.h index d9e1396fde6..3a29b9d6f15 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -962,7 +962,7 @@ public: longlong val_int(); String *val_str(String *str); bool update_hash(void *ptr, uint length, enum Item_result type, - CHARSET_INFO *cs, Derivation dv, bool unsigned_arg= 0); + CHARSET_INFO *cs, Derivation dv, bool unsigned_arg); bool check(); bool update(); enum Item_result result_type () const { return cached_result_type; } diff --git a/sql/log_event.cc b/sql/log_event.cc index 19c32b2d28e..ef375a30441 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -2607,7 +2607,7 @@ int User_var_log_event::exec_event(struct st_relay_log_info* rli) a single record and with a single column. Thus, like a column value, it could always have IMPLICIT derivation. */ - e.update_hash(val, val_len, type, charset, DERIVATION_IMPLICIT); + e.update_hash(val, val_len, type, charset, DERIVATION_IMPLICIT, 0); free_root(thd->mem_root,0); rli->inc_event_relay_log_pos(get_event_len()); From d31a3434650a9991bcc16478e65efd7d2ea23c76 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 12 Sep 2006 18:28:36 +0400 Subject: [PATCH 3/3] Fixed compilation --- sql/item_func.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sql/item_func.cc b/sql/item_func.cc index 187ed56169d..f39b8289f73 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -3574,7 +3574,7 @@ update_hash(user_var_entry *entry, bool set_null, void *ptr, uint length, bool Item_func_set_user_var::update_hash(void *ptr, uint length, Item_result type, - CHARSET_INFO *cs, Derivation dv + CHARSET_INFO *cs, Derivation dv, bool unsigned_arg) { /* @@ -3816,11 +3816,11 @@ Item_func_set_user_var::update() { if (!save_result.vdec) // Null value res= update_hash((void*) 0, 0, DECIMAL_RESULT, &my_charset_bin, - DERIVATION_IMPLICIT); + DERIVATION_IMPLICIT, 0); else res= update_hash((void*) save_result.vdec, sizeof(my_decimal), DECIMAL_RESULT, - &my_charset_bin, DERIVATION_IMPLICIT); + &my_charset_bin, DERIVATION_IMPLICIT, 0); break; } case ROW_RESULT: @@ -4176,7 +4176,7 @@ bool Item_user_var_as_out_param::fix_fields(THD *thd, Item **ref) void Item_user_var_as_out_param::set_null_value(CHARSET_INFO* cs) { if (::update_hash(entry, TRUE, 0, 0, STRING_RESULT, cs, - DERIVATION_IMPLICIT)) + DERIVATION_IMPLICIT, 0)) current_thd->fatal_error(); // Probably end of memory } @@ -4185,7 +4185,7 @@ void Item_user_var_as_out_param::set_value(const char *str, uint length, CHARSET_INFO* cs) { if (::update_hash(entry, FALSE, (void*)str, length, STRING_RESULT, cs, - DERIVATION_IMPLICIT)) + DERIVATION_IMPLICIT, 0)) current_thd->fatal_error(); // Probably end of memory }