summaryrefslogtreecommitdiff
path: root/sql/item_timefunc.h
diff options
context:
space:
mode:
authorevgen@moonbone.local <>2005-08-04 18:05:33 +0400
committerevgen@moonbone.local <>2005-08-04 18:05:33 +0400
commit697836c77fb9af725a5d9698bd6a169096b2b36c (patch)
treea183dafbfc74054559fed457d7bd04c1278d4573 /sql/item_timefunc.h
parent280da3cf15ed2f3fd5ff2d885e78e894af595ee5 (diff)
downloadmariadb-git-697836c77fb9af725a5d9698bd6a169096b2b36c.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.
Diffstat (limited to 'sql/item_timefunc.h')
-rw-r--r--sql/item_timefunc.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h
index 1a30b24b7ce..0df84d14bea 100644
--- a/sql/item_timefunc.h
+++ b/sql/item_timefunc.h
@@ -709,6 +709,12 @@ public:
{
return (new Field_date(maybe_null, name, t_arg, &my_charset_bin));
}
+ void fix_length_and_dec()
+ {
+ collation.set(&my_charset_bin);
+ max_length= 10;
+ maybe_null= 1;
+ }
};