--- a/sql/item_func.cc	Mon Apr  9 14:36:22 2007
+++ b/sql/item_func.cc	Wed Apr 18 20:08:57 2007
@@ -1046,9 +1046,20 @@
 
 void Item_decimal_typecast::print(String *str)
 {
+  String str_len;
   str->append(STRING_WITH_LEN("cast("));
   args[0]->print(str);
-  str->append(STRING_WITH_LEN(" as decimal)"));
+  str->append(STRING_WITH_LEN(" as decimal("));
+
+  str_len.set((longlong) (max_length - 2), &my_charset_bin);
+  str->append(str_len);
+
+  str->append(STRING_WITH_LEN(","));
+
+  str_len.set((longlong) decimals, &my_charset_bin);
+  str->append(str_len);
+
+  str->append(STRING_WITH_LEN("))"));
 }
 
 
