summaryrefslogtreecommitdiff
path: root/mysql-test/t/func_group.test
diff options
context:
space:
mode:
authorSergey Glukhov <sergey.glukhov@oracle.com>2011-04-12 14:01:33 +0400
committerSergey Glukhov <sergey.glukhov@oracle.com>2011-04-12 14:01:33 +0400
commit7fa7a0cad95b0c8cc4f7f450f7f3411fa632b148 (patch)
tree7e37918911232c98342c8bdd144228021fb88611 /mysql-test/t/func_group.test
parent33c2a5e7e3f5ed2dee0f50f6d02052d8bf2234b9 (diff)
downloadmariadb-git-7fa7a0cad95b0c8cc4f7f450f7f3411fa632b148.tar.gz
Bug#11766270 59343: YEAR(4): INCORRECT RESULT AND VALGRIND WARNINGS WITH MIN/MAX, UNION
When we create temporary result table for UNION incorrect max_length for YEAR field is used and it leads to incorrect field value and incorrect result string length as YEAR field value calculation depends on field length. The fix is to use underlying item max_length for Item_sum_hybrid::max_length intialization. mysql-test/r/func_group.result: test case mysql-test/t/func_group.test: test case sql/field.cc: added assert sql/item_sum.cc: init Item_sum_hybrid::max_length with use underlying item max_length for INT result type.
Diffstat (limited to 'mysql-test/t/func_group.test')
-rw-r--r--mysql-test/t/func_group.test12
1 files changed, 12 insertions, 0 deletions
diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test
index 600b46fcde6..177a1ca2471 100644
--- a/mysql-test/t/func_group.test
+++ b/mysql-test/t/func_group.test
@@ -1128,5 +1128,17 @@ SELECT MAX(LENGTH(a)), LENGTH(MAX(a)), MIN(a), MAX(a), CONCAT(MIN(a)), CONCAT(MA
DROP TABLE t1;
--echo #
+--echo # Bug #11766270 59343: YEAR(4): INCORRECT RESULT AND VALGRIND WARNINGS WITH MIN/MAX, UNION
+--echo #
+
+CREATE TABLE t1(f1 YEAR(4));
+INSERT INTO t1 VALUES (0000),(2001);
+--enable_metadata
+(SELECT MAX(f1) FROM t1) UNION (SELECT MAX(f1) FROM t1);
+--disable_metadata
+DROP TABLE t1;
+
+
+--echo #
--echo End of 5.1 tests