summaryrefslogtreecommitdiff
path: root/sql/item.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/item.cc')
-rw-r--r--sql/item.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/sql/item.cc b/sql/item.cc
index c33e5da0ca4..463de3e1c52 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -4460,7 +4460,7 @@ Field *Item::tmp_table_field_from_field_type(TABLE *table, bool fixed_length)
break;
case MYSQL_TYPE_NEWDATE:
case MYSQL_TYPE_DATE:
- field= new Field_date(maybe_null, name, &my_charset_bin);
+ field= new Field_newdate(maybe_null, name, &my_charset_bin);
break;
case MYSQL_TYPE_TIME:
field= new Field_time(maybe_null, name, &my_charset_bin);
@@ -6695,6 +6695,8 @@ enum_field_types Item_type_holder::get_real_type(Item *item)
*/
Field *field= ((Item_field *) item)->field;
enum_field_types type= field->real_type();
+ if (field->is_created_from_null_item)
+ return MYSQL_TYPE_NULL;
/* work around about varchar type field detection */
if (type == MYSQL_TYPE_STRING && field->type() == MYSQL_TYPE_VAR_STRING)
return MYSQL_TYPE_VAR_STRING;
@@ -6948,6 +6950,8 @@ Field *Item_type_holder::make_field_by_type(TABLE *table)
if (field)
field->init(table);
return field;
+ case MYSQL_TYPE_NULL:
+ return make_string_field(table);
default:
break;
}