From 697836c77fb9af725a5d9698bd6a169096b2b36c Mon Sep 17 00:00:00 2001 From: "evgen@moonbone.local" <> Date: Thu, 4 Aug 2005 18:05:33 +0400 Subject: 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. --- sql/item_timefunc.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'sql/item_timefunc.h') 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; + } }; -- cgit v1.2.1