Commit 2fb243ea authored by Satya B's avatar Satya B

merge to 5.1-bugteam

parents 6999f40d 9800aa29
...@@ -437,6 +437,13 @@ a ROUND(a) ...@@ -437,6 +437,13 @@ a ROUND(a)
-1e+16 -10000000000000002 -1e+16 -10000000000000002
1e+16 10000000000000002 1e+16 10000000000000002
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1(f1 LONGTEXT) engine=myisam;
INSERT INTO t1 VALUES ('a');
SELECT 1 FROM (SELECT ROUND(f1) AS a FROM t1) AS s WHERE a LIKE 'a';
1
SELECT 1 FROM (SELECT ROUND(f1, f1) AS a FROM t1) AS s WHERE a LIKE 'a';
1
DROP TABLE t1;
End of 5.0 tests End of 5.0 tests
SELECT 1e308 + 1e308; SELECT 1e308 + 1e308;
1e308 + 1e308 1e308 + 1e308
......
...@@ -269,6 +269,15 @@ SELECT a, ROUND(a) FROM t1; ...@@ -269,6 +269,15 @@ SELECT a, ROUND(a) FROM t1;
DROP TABLE t1; DROP TABLE t1;
#
# Bug#45152 crash with round() function on longtext column in a derived table
#
CREATE TABLE t1(f1 LONGTEXT) engine=myisam;
INSERT INTO t1 VALUES ('a');
SELECT 1 FROM (SELECT ROUND(f1) AS a FROM t1) AS s WHERE a LIKE 'a';
SELECT 1 FROM (SELECT ROUND(f1, f1) AS a FROM t1) AS s WHERE a LIKE 'a';
DROP TABLE t1;
--echo End of 5.0 tests --echo End of 5.0 tests
# #
......
...@@ -1944,8 +1944,8 @@ void Item_func_round::fix_length_and_dec() ...@@ -1944,8 +1944,8 @@ void Item_func_round::fix_length_and_dec()
unsigned_flag= args[0]->unsigned_flag; unsigned_flag= args[0]->unsigned_flag;
if (!args[1]->const_item()) if (!args[1]->const_item())
{ {
max_length= args[0]->max_length;
decimals= args[0]->decimals; decimals= args[0]->decimals;
max_length= float_length(decimals);
if (args[0]->result_type() == DECIMAL_RESULT) if (args[0]->result_type() == DECIMAL_RESULT)
{ {
max_length++; max_length++;
...@@ -1965,8 +1965,8 @@ void Item_func_round::fix_length_and_dec() ...@@ -1965,8 +1965,8 @@ void Item_func_round::fix_length_and_dec()
if (args[0]->decimals == NOT_FIXED_DEC) if (args[0]->decimals == NOT_FIXED_DEC)
{ {
max_length= args[0]->max_length;
decimals= min(decimals_to_set, NOT_FIXED_DEC); decimals= min(decimals_to_set, NOT_FIXED_DEC);
max_length= float_length(decimals);
hybrid_type= REAL_RESULT; hybrid_type= REAL_RESULT;
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment