summaryrefslogtreecommitdiff
path: root/mysql-test/r/group_by.result
diff options
context:
space:
mode:
authorunknown <evgen@moonbone.local>2005-08-04 18:05:33 +0400
committerunknown <evgen@moonbone.local>2005-08-04 18:05:33 +0400
commitb2dc376afe3a3f37ab11bfa292c1bf041fd89db1 (patch)
treea183dafbfc74054559fed457d7bd04c1278d4573 /mysql-test/r/group_by.result
parente012ec5207100c992fc1c7f04fe5e8ab094c0c7b (diff)
downloadmariadb-git-b2dc376afe3a3f37ab11bfa292c1bf041fd89db1.tar.gz
Fix bug#12266 GROUP BY DATE(LEFT(column,8)) returns result strings with reduced
length. When temporary field created for DATE(LEFT(column,8)) expression, max_length value is taken from Item_date_typecast, and it is getting it from underlaid Item_func_left and it's max_length is 8 in given expression. And all this results in stripping last 2 digits. To Item_date_typecast class added its own fix_length_and_dec() function that sets max_length value to 10, which is proper for DATE field. mysql-test/t/group_by.test: Test case for bug#12266 GROUP BY DATE(LEFT(column,8)) returns result strings with reduced length. mysql-test/r/group_by.result: Test case for bug#12266 GROUP BY DATE(LEFT(column,8)) returns result strings with reduced length. sql/item_timefunc.h: Fix bug#12266 GROUP BY DATE(LEFT(column,8)) returns result strings with reduced length. To Item_date_typecast class added its own fix_length_and_dec() which sets proper max_length value.
Diffstat (limited to 'mysql-test/r/group_by.result')
-rw-r--r--mysql-test/r/group_by.result7
1 files changed, 7 insertions, 0 deletions
diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result
index 295663fe1d3..8287a042d60 100644
--- a/mysql-test/r/group_by.result
+++ b/mysql-test/r/group_by.result
@@ -757,3 +757,10 @@ SELECT n+1 AS n FROM t1 GROUP BY n;
n
2
DROP TABLE t1;
+create table t1 (f1 date);
+insert into t1 values('2005-06-06');
+insert into t1 values('2005-06-06');
+select date(left(f1+0,8)) from t1 group by 1;
+date(left(f1+0,8))
+2005-06-06
+drop table t1;