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.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index 112ce053648..2effe3a615c 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -2967,9 +2967,9 @@ void Item_func_str_to_date::fix_length_and_dec()
cached_field_type= MYSQL_TYPE_STRING;
max_length= MAX_DATETIME_FULL_WIDTH*MY_CHARSET_BIN_MB_MAXLEN;
cached_timestamp_type= MYSQL_TIMESTAMP_NONE;
- if ((const_item= args[1]->const_item()))
+ format= args[1]->val_str(&format_str);
+ if (!args[1]->null_value && (const_item= args[1]->const_item()))
{
- format= args[1]->val_str(&format_str);
cached_format_type= get_date_time_result_type(format->ptr(),
format->length());
switch (cached_format_type) {