summaryrefslogtreecommitdiff
path: root/mysql-test/t/func_math.test
diff options
context:
space:
mode:
authorSergey Glukhov <Sergey.Glukhov@sun.com>2009-06-02 11:38:13 +0500
committerSergey Glukhov <Sergey.Glukhov@sun.com>2009-06-02 11:38:13 +0500
commit33734e956fb06435168ad4630515c02358871a0e (patch)
treefeaf78789a7104118740c975304683318faad5ae /mysql-test/t/func_math.test
parent47b334a64200d9413d3289fb3f011a6f4bc22ec2 (diff)
downloadmariadb-git-33734e956fb06435168ad4630515c02358871a0e.tar.gz
Bug#45152 crash with round() function on longtext column in a derived table
The crash happens due to wrong max_length value which is set on Item_func_round::fix_length_and_dec() stage. The value is set to args[0]->max_length which is too big in case of LONGTEXT(LONGBLOB) fields. The fix is to set max_length using float_length() function. mysql-test/r/func_math.result: test result mysql-test/t/func_math.test: test case sql/item_func.cc: The crash happens due to wrong max_length value which is set on Item_func_round::fix_length_and_dec() stage. The value is set to args[0]->max_length which is too big in case of LONGTEXT(LONGBLOB) fields. The fix is to set max_length using float_length() function.
Diffstat (limited to 'mysql-test/t/func_math.test')
-rw-r--r--mysql-test/t/func_math.test9
1 files changed, 9 insertions, 0 deletions
diff --git a/mysql-test/t/func_math.test b/mysql-test/t/func_math.test
index 593cfe90c1b..2c1094213e4 100644
--- a/mysql-test/t/func_math.test
+++ b/mysql-test/t/func_math.test
@@ -250,4 +250,13 @@ SELECT a, ROUND(a) FROM 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