summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/r/func_math.result3
-rw-r--r--mysql-test/t/func_math.test5
-rw-r--r--sql/item_func.cc3
3 files changed, 8 insertions, 3 deletions
diff --git a/mysql-test/r/func_math.result b/mysql-test/r/func_math.result
index 9cb1e4a56d6..80b15d1d3c8 100644
--- a/mysql-test/r/func_math.result
+++ b/mysql-test/r/func_math.result
@@ -137,3 +137,6 @@ select * from t1;
round(1, 6)
1.000000
drop table t1;
+select abs(-2) * -2;
+abs(-2) * -2
+-4
diff --git a/mysql-test/t/func_math.test b/mysql-test/t/func_math.test
index 1f282b1fb76..ebbc594952c 100644
--- a/mysql-test/t/func_math.test
+++ b/mysql-test/t/func_math.test
@@ -72,4 +72,9 @@ show create table t1;
select * from t1;
drop table t1;
+#
+# Bug #11402: abs() forces rest of calculation to unsigned
+#
+select abs(-2) * -2;
+
# End of 4.1 tests
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 9e570cba1de..41573406949 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -765,10 +765,7 @@ void Item_func_abs::fix_length_and_dec()
max_length=args[0]->max_length;
hybrid_type= REAL_RESULT;
if (args[0]->result_type() == INT_RESULT)
- {
hybrid_type= INT_RESULT;
- unsigned_flag= 1;
- }
}