summaryrefslogtreecommitdiff
path: root/sql/item_timefunc.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/item_timefunc.cc')
-rw-r--r--sql/item_timefunc.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index 54513d93636..5efabbff726 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -2357,7 +2357,8 @@ String *Item_char_typecast::val_str(String *str)
if (res->length() > (length= (uint32) res->charpos(cast_length)))
{ // Safe even if const arg
char char_type[40];
- my_snprintf(char_type, sizeof(char_type), "CHAR(%lu)", length);
+ my_snprintf(char_type, sizeof(char_type), "%s(%lu)",
+ cast_cs == &my_charset_bin ? "BINARY" : "CHAR", length);
if (!res->alloced_length())
{ // Don't change const str